Skip to main content
A secret is a sealed value an operator sets. Code never holds its clear value: only a performer opens it, when it sends a task. Declare one with secret() and place it in the app tree; its path is its name.
bijection/crm.ts
Set the value with the CLI. It reads the value from standard input or --from-file, never from an argument, and setting it again rotates it:
A secret is used as:
  • http(url, { bearer }), sent as Authorization: Bearer <secret>;
  • a receiver’s auth, for the integrations;
  • a route verifier, verifier.bearer(secret) (see Reactions).

One value per member

secret({ under: family }) holds one value per member of a family: each tenant’s own credential.
An operator sets one member’s value with bijection secret set billing.tenantKey/acme. For a mutation that accepts a credential, declare its argument as t.credential. The caller supplies a string. The host seals it before the handler runs, and the handler receives a Sealed<string> it can store with ctx.put(tenantKey.of(member), apiKey) under that member’s label. ctx.retract(tenantKey.of(member)) removes the value. ctx.has(tenantKey.of(member)) checks whether a value is sealed. A send presents the value of the member its task’s label names.

Keys

A key is a secret declared with its algorithm and uses, secret({ alg, uses }). The head signs with ed25519, rs256 and es256 keys and computes MACs with hmac-sha256 keys. Key material stays in the host.
bijection/receipts.ts
Set the key with bijection secret set receipts --alg ed25519. At a branch or a retained version, signing and MAC reads produce a deterministic trial artifact. publicJwk returns { keys } for the world’s Version, with the current signing key first and each unretired key identified by its kid. Rotating at the same label and algorithm keeps the previous public key valid. Run bijection secret list to find its kid, then retire it with bijection secret remove receipts --kid <kid>. Removing the secret without --kid withdraws the entire set at that Version. Check a MAC with ctx.get(key.equal({ mac: data, tag })), where tag is a Uint8Array. MAC keys default to uses: ["equal"]. Add "mac" to issue tags. Signing keys default to ["sign", "publicJwk"]. The Program carries these uses. bijection secret set supplies the material for the declared algorithm. The kernel computes the expected tag through custody using the real key at the world’s Version, compares in constant time and returns only a boolean. For signatures, verify checks against the public keys valid at that Version. Trial artifacts are publicly computable and never verify. @bijectionhq/library-keys also provides isTrialSignature, signJwt and verifyJwt, which ignores a token’s trial mark and checks it against the real key. To sign what a task sends, declare signing on its receiver so the host signs at dispatch. For configuration that is not secret, see Environment variables.