Implementation:A5c ai Babysitter command authorization minting
| Knowledge Sources | |
|---|---|
| Domains | Cryptography, Policy_Enforcement, Authorization |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Interface specification for minting short-lived command authorizations that bind verified evidence to a specific tool call.
Description
The CommandAuthorizationPayload is the signed payload type that authorizes a single tool execution. It is NOT a library API you call directly — it is a pattern the policy enforcement system uses. The payload is signed with signPayload and verified with verifyCommandAuthorization.
The payload binds:
- Policy identity: policyId, policyDocHash, configEpoch
- Tool context: toolName, toolCallId, commandHash, argsHash, credentialScope
- Evidence chain: evidenceFingerprints, evidenceEnvelopeHashes, evidenceStepBindings
- Temporal bounds: issuedAt, expiresAt (short-lived)
- Session: matchedChainId, runId?, sessionId?
The bridgeProvenAnswer function in proven-bridge.ts bridges legacy approval answers into the proven authorization system.
Usage
- Policy enforcement Step 4: Mint a command authorization after verifying the evidence chain, binding it to the specific tool call context.
Code Reference
Source Location
- Repository: Babysitter
- File (payload type): packages/adapters/policy/src/verify-envelope-trusted.ts:L127-145
- File (gate):** packages/adapters/policy/src/verify-envelope-trusted.ts:L355-421
- File (bridge):** packages/adapters/policy/src/proven-bridge.ts:L65-90+
Signature
interface CommandAuthorizationPayload {
payloadType: 'command-authorization';
policyId: string;
policyDocHash: string;
configEpoch: number;
matchedChainId: string;
toolName: string;
toolCallId: string;
commandHash: string;
argsHash: string;
credentialScope: string;
evidenceFingerprints: string[];
evidenceEnvelopeHashes: string[];
evidenceStepBindings: EvidenceStepBinding[];
runId?: string;
sessionId?: string;
issuedAt: string;
expiresAt: string;
}
// Mint: sign the payload
import { signPayload } from "@a5c-ai/trust-core";
const envelope = signPayload(privateKey, fingerprint, payload);
// Verify: at the execution gate
import { verifyCommandAuthorization } from "@a5c-ai/policy-adapter";
const result = verifyCommandAuthorization(envelope, gateContext);
// Bridge legacy approvals
import { bridgeProvenAnswer } from "@a5c-ai/policy-adapter/proven";
Import
// The payload is constructed and signed, not imported as a class
import { signPayload } from "@a5c-ai/trust-core";
import { verifyCommandAuthorization } from "@a5c-ai/policy-adapter";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| policyId | string | Yes | Policy identifier |
| policyDocHash | string | Yes | Integrity-verified policy doc hash |
| configEpoch | number | Yes | Policy version |
| toolName | string | Yes | Tool to authorize |
| toolCallId | string | Yes | Specific call ID |
| commandHash | string | Yes | Canonicalized argv hash |
| argsHash | string | Yes | Canonicalized args hash |
| evidenceFingerprints | string[] | Yes | Evidence key fingerprints |
| issuedAt | string | Yes | ISO timestamp |
| expiresAt | string | Yes | Short-lived expiry |
Outputs
| Name | Type | Description |
|---|---|---|
| SignedEnvelope | object | Signed command authorization for a specific tool call |
Usage Examples
Mint a Command Authorization
import { signPayload, createKeyPair } from "@a5c-ai/trust-core";
import { argsHash, commandHash } from "@a5c-ai/policy-adapter";
const keyPair = createKeyPair();
const payload: CommandAuthorizationPayload = {
payloadType: "command-authorization",
policyId: "shell-exec-policy",
policyDocHash: "sha256:abc123...",
configEpoch: 42,
matchedChainId: "chain-1",
toolName: "shell-exec",
toolCallId: "call-001",
commandHash: commandHash(["git", "push", "origin", "main"]),
argsHash: argsHash({ repo: "origin" }),
credentialScope: "write",
evidenceFingerprints: ["fp-model-1", "fp-approval-1"],
evidenceEnvelopeHashes: ["hash-env-1", "hash-env-2"],
evidenceStepBindings: [
{ stepIndex: 0, requiredKind: "model-decision", envelopeHash: "hash-env-1" },
{ stepIndex: 1, requiredKind: "human-approval", envelopeHash: "hash-env-2" },
],
issuedAt: new Date().toISOString(),
expiresAt: new Date(Date.now() + 60_000).toISOString(), // 60s lifetime
};
const envelope = signPayload(keyPair.privateKey, keyPair.fingerprint, payload);
// Submit envelope to the execution gate