1. Declare the secrets schema
Each PolicyData oracle declares the secrets it requires as a JSON Schema, stored on-chain as the oracle’ssecretsSchemaCid. Uploaded secrets are validated against this schema before being stored.
Create secrets_schema.json:
secretsSchemaCid (drop --secrets-schema-file).
2. Upload secrets (encrypted)
Secrets are encrypted client-side with HPKE before they ever leave your machine. The operator decrypts them in memory at evaluation time; the plaintext is never persisted and never sent over the network. Only the on-chain owner of the PolicyClient can upload secrets.newt_getSecretsPublicKey, seal the envelope locally, and submit it via newt_storeEncryptedSecrets. The operator validates the plaintext against your secretsSchemaCid and stores only the encrypted envelope.
3. Access secrets inside the oracle
Your WASM oracle reads secrets through thenewton:provider/secrets host interface (declared in newton-provider.wit). Calling get() returns the decrypted secrets JSON as raw bytes — the operator has already decrypted them; you only decode and parse:
get()returns aresult<secret-response, string>;secret-response.valueislist<u8>— the bytes of the decrypted secrets JSON object. The scope (which PolicyClient + PolicyData) is bound by the operator’s execution context, so you do not pass any identifiers.- The named keys you read (
VAULTS_FYI_API_KEYabove) must match the keys you uploaded and the properties insecrets_schema.json. - Put credentials in request headers, never in the URL.
- Fail closed: if a fetch errors, return a namespaced
errorso your Rego can deny on it (see Chaining Data Oracles).
4. Test that secrets resolve
Before submitting production tasks, verify the oracle reads its secrets correctly:Next Steps
Encrypting Secrets
The HPKE wire protocol and security model
Chaining Data Oracles
Per-oracle secret scoping in multi-oracle policies
Policy Packs
Prebuilt oracles and the keys each one needs
CLI Reference
newton-cli secrets commands and flags