Mandate · Guide
Require a passkey
Use biometric approval to prove a person was present when an action was approved. The person confirms with a passkey on their device (face, fingerprint or device PIN), Provenance verifies the signed result, and only then does the token carry biometric_bound: true. A policy rule can require it.
Before you begin: export the full-access sandbox key, which has the admin scope for device enrollment and the mandate scope for authorize. The passkey steps run in a browser on a device with a platform authenticator, served from the domain your Provenance server is configured for.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe
- Enroll oncepasskey registered to the device
- Each approvalchallenge → passkey check → assertion
- Tokenbiometric_bound: true
1. Get an enrollment challenge
Registration answers a one-time challenge from POST /v1/admin/devices/enrollment_challenge. It expires after 10 minutes.
curl -s -X POST $PROVENANCE_API/v1/admin/devices/enrollment_challenge \
-H "Authorization: Bearer $PROVENANCE_KEY" | tee enrollment.json
const res = await fetch(`${process.env.PROVENANCE_API}/v1/admin/devices/enrollment_challenge`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
});
const { challenge } = await res.json();
import os
import httpx
api, headers = os.environ["PROVENANCE_API"], {"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}
challenge = httpx.post(f"{api}/v1/admin/devices/enrollment_challenge", headers=headers).json()["challenge"]
{
"object": "enrollment_challenge",
"challenge": "l-0I_oYv2HlBJzNgJ_32LdnJfi-clZfHMnlIc90HIuA",
"expires_at": "2026-10-24T13:50:51.162Z"
}
2. Register the passkey and enroll the device
In the browser, create a passkey over the challenge with navigator.credentials.create, requiring user verification so the device asks for the biometric. Send the result to your backend, which enrolls the device at POST /v1/admin/devices with webauthn_registration.
const b64u = (buf: ArrayBuffer) => btoa(String.fromCharCode(...new Uint8Array(buf))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
const fromB64u = (s: string) => Uint8Array.from(atob(s.replace(/-/g, "+").replace(/_/g, "/")), (c) => c.charCodeAt(0));
const credential = (await navigator.credentials.create({
publicKey: {
challenge: fromB64u(challenge),
rp: { id: location.hostname, name: "Example Bank" },
user: { id: crypto.getRandomValues(new Uint8Array(16)), name: "dana@example.com", displayName: "Dana" },
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
authenticatorSelection: { authenticatorAttachment: "platform", userVerification: "required" },
},
})) as PublicKeyCredential;
const response = credential.response as AuthenticatorAttestationResponse;
const webauthnRegistration = {
challenge,
attestationObject: b64u(response.attestationObject),
clientDataJson: b64u(response.clientDataJSON),
};
Your backend enrolls the device with it:
curl $PROVENANCE_API/v1/admin/devices \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{ \"webauthn_registration\": $(cat registration.json) }"
const device = await prov.attest.devices.enroll({ webauthnRegistration });
device = prov.attest.devices.enroll(webauthn_registration=webauthn_registration)
The response is the enrolled device. Keep its device_id: it's the device you name at authorize.
3. Get a biometric challenge for the approval
Each authorization answers a fresh challenge from POST /. A challenge works once and expires after five minutes.
curl -s -X POST $PROVENANCE_API/v1/mandate/biometric_challenges \
-H "Authorization: Bearer $PROVENANCE_KEY"
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const { challenge: approvalChallenge } = await prov.mandate.intents.biometricChallenge();
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
approval_challenge = prov.mandate.intents.biometric_challenge()["challenge"]
{
"object": "biometric_challenge",
"challenge": "Ges6jEttTznIA0Q73-KbzeI6pct_n2UNdfsEONcxxmA",
"expires_at": "2026-10-24T13:45:51.177Z"
}
4. Sign the challenge and authorize
In the browser, show the person the action and run navigator.credentials.get over the challenge. The device prompts for face or fingerprint and signs the challenge with the passkey.
const assertion = (await navigator.credentials.get({
publicKey: { challenge: fromB64u(approvalChallenge), rpId: location.hostname, userVerification: "required" },
})) as PublicKeyCredential;
const signed = assertion.response as AuthenticatorAssertionResponse;
const biometricAssertion = {
authenticatorData: b64u(signed.authenticatorData),
clientDataJson: b64u(signed.clientDataJSON),
signature: b64u(signed.signature),
};
Authorize with the challenge and the assertion. Provenance checks that the enrolled passkey signed this exact challenge, from your domain, with the person verified, before it mints the token:
curl $PROVENANCE_API/v1/mandate/intents \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{
\"action_description\": \"Wire \$12,000 to Acme Corp for PO-7781\",
\"agent_session_id\": \"sess_treasury_1\",
\"device_id\": \"$DEVICE_ID\",
\"biometric_challenge\": \"$APPROVAL_CHALLENGE\",
\"biometric_assertion\": $(cat assertion.json)
}"
const auth = await prov.mandate.intents.create({
actionDescription: "Wire $12,000 to Acme Corp for PO-7781",
agentSessionId: "sess_treasury_1",
deviceId: device.deviceId,
biometricChallenge: approvalChallenge,
biometricAssertion,
});
auth = prov.mandate.intents.create(
action_description="Wire $12,000 to Acme Corp for PO-7781",
agent_session_id="sess_treasury_1",
device_id=device["device_id"],
biometric_challenge=approval_challenge,
biometric_assertion=biometric_assertion,
)
{
"object": "intent_authorization",
"intent_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ijc1MjY5NmZmMGY1ZTRmNTMifQ.eyJpc3MiOiJwcm92ZW5hbmNlLWF1dGhvcml6ZSJ9.dUvSg20-l4xn1dRTrhQTU8F0W9tRDWpE1INz793rICt-daFn5wVgd0SndvqNIquHFUih1aFMJ24rCoZCMq3AOA",
"expires_at": "2026-10-24T17:44:02.000Z",
"attestation_id": "4a1d2c6e-9b0f-4e57-8d3a-1f6c2b7e9a40",
"biometric_bound": true
}
A missing, forged or reused assertion gives biometric_bound: false; authorize doesn't fail, so your policy decides. Native apps get the same assertion from the capture SDK, signed in the phone's secure hardware.
5. Require it in policy
A rule with require: { biometric: true } refuses a token without a verified passkey check. Try one with POST /, which uses the account key and changes nothing:
curl $PROVENANCE_API/v1/mandate/policies/simulate \
-H "Authorization: Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" \
-H "Content-Type: application/json" \
-d '{
"document": { "rules": [{ "id": "wires-need-passkey", "when": [{ "fact": "action_type", "op": "eq", "value": "wire" }], "require": { "biometric": true } }] },
"facts": { "action_type": "wire", "biometric_bound": false }
}'
const account = new Provenance({ apiKey: "prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", baseUrl: process.env.PROVENANCE_API });
const sim = await account.policy.simulate({
document: { rules: [{ id: "wires-need-passkey", when: [{ fact: "action_type", op: "eq", value: "wire" }], require: { biometric: true } }] },
facts: { action_type: "wire", biometric_bound: false },
});
account = Provenance("prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", base_url=os.environ["PROVENANCE_API"])
sim = account.policy.simulate(
document={"rules": [{"id": "wires-need-passkey", "when": [{"fact": "action_type", "op": "eq", "value": "wire"}], "require": {"biometric": True}}]},
facts={"action_type": "wire", "biometric_bound": False},
)
{
"object": "policy_simulation",
"domain": "intent",
"allowed": false,
"reason": "policy_biometric_required",
"policy": {
"id": "pol_3F9A1C7E52B04D8E6A1F27C9B4",
"version": 0,
"rule": {
"id": "wires-need-passkey",
"name": null,
"phase": "assess",
"action": "reject",
"conditions": [
{ "fact": "action_type", "op": "eq", "value": "wire", "actual": "wire" }
]
}
}
}
To ask for the passkey only when the action is sent for approval, combine "approval": true with "biometric": true. Then the approver's passkey check, on the approval page or in the console, satisfies the rule instead of the token's; see step-up approval.
Enrol a person's phone with a link
A passkey belongs to the site that made it, so your own site can't make one for Provenance. To name your customer's phone on their grant, ask for an enrollment link at POST / with your mandate key. Show enroll_url as a QR code, or text short_url. The person opens it on the phone and makes a passkey on Provenance's page. The link works once, for 15 minutes by default.
curl -s -X POST $PROVENANCE_API/v1/mandate/device_enrollments \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "display_name": "Maya", "reference": "customer_2041" }' | tee enrollment.json
const enrollment = await prov.mandate.deviceEnrolments.create({ displayName: "Maya", reference: "customer_2041" });
// Show enrollment.enrollUrl as a QR code, or text enrollment.shortUrl.
enrollment = prov.mandate.device_enrolments.create(display_name="Maya", reference="customer_2041")
Read it back until status is enrolled, then name device_id on the person's grant. Their plan approvals, raises and step-ups are then approved by that phone's passkey.
curl $PROVENANCE_API/v1/mandate/device_enrollments/$(jq -r .id enrollment.json) \
-H "Authorization: Bearer $PROVENANCE_KEY"
const { status, deviceId } = await prov.mandate.deviceEnrolments.get(enrollment.id);
e = prov.mandate.device_enrolments.get(enrollment["id"])
To discard the phone, revoke the enrollment at POST /: a pending link stops working, and an enrolled phone's device is revoked, so its passkey approves nothing after. A second completion of the same link is 409 device_enrollment_closed.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
biometric_ with an assertion | The assertion didn't verify: a reused or expired challenge, another device's passkey, or the user-verified flag missing | Get a fresh challenge and require userVerification: "required". |
NotAllowedError in the browser | The person cancelled, or the page's domain doesn't match the server's configured domain | Retry; serve the page from the configured domain. |
400 parameter_ on webauthn_ | The registration didn't verify or its challenge expired | Get a new enrollment challenge and register again. |
409 device_ | The enrollment link already enrolled a phone, was revoked or expired | Read the enrollment; make a new link for another phone. |
valid: false, policy_ at verify | The rule requires a passkey and the token has none | Authorize again with a biometric assertion. |