The properties below are the ones implemented and covered by the suite in this repository. The byte-level profile is SPEC.md.
Signed amount, currency, and recipient
The Ed25519 signature covers the canonical mandate: per-call cap, total cap, currency, tools, counterparties, subject, expiry, and any audience, tenant, or policy tags. Key order does not change the signature. Changing a signed field does.
A verifier pins the issuer public key. A mandate re-signed by any other key is INVALID_SIGNATURE, even when the embedded key matches the attacker. Equal-to-cap amounts are allowed. One cent over the per-call cap is EXCEEDS_PER_CALL_CAP and does not count. Past the total is EXCEEDS_TOTAL_CAP.
Fail-closed verification
Signature failure wins, so untrusted fields are ignored. On the money path, omitted amount, currency, or recipient is MALFORMED, stored as an empty field, and the handler does not run. Denied amounts do not advance spend.
USD has 2 minor units, JPY has 0, BHD has 3. A sign, an exponent, a non-string number, or more fractional digits than that scale is MALFORMED and is not rounded. 10.5 USD is authorized as 10.50.
Frozen command
On ALLOW, the handler receives a frozen command. Its amount, currency, and recipient are the signed values. Its arguments are a frozen clone, not the caller’s object. Observers receive frozen copies of the decision and the receipt.
Mutating the original input, or attempting to write the published receipt, does not change the command the handler runs or the receipt stored on the ledger. withMandateGuard is the demo path for a non-money tool. A missing amount there becomes 0.00. Do not use it to move money.
No cross-domain replay
The signing input is UTF-8 of the domain label, a newline, and canonical JSON. The labels are dsn.v0.1.mandate, dsn.v0.1.receipt, and dsn.v0.1.args. A mandate signature does not verify as a receipt, and a receipt signature does not verify as a mandate. Any other version label is rejected.
That binds a signature to one document type. It is not a nonce. A second in-policy call is allowed until a cap, expiry, or revocation says otherwise. Argument digests use dsn.v0.1.args. Values that cannot be canonicalized are denied with MALFORMED and still appended.
UTC authorization clock
expiresAt is YYYY-MM-DDTHH:MM:SSZ or the same form with exactly three fractional digits. The year is 0100–9999. Offsets, including +00:00, a lowercase z, and impossible dates are MALFORMED.
Expiry is exclusive, in epoch milliseconds: the call is allowed one millisecond before that instant and denied at it. The clock is copied once, before any verifier callback await. Mutating that Date afterward does not move the decision or the receipt timestamp. The instant is authorization time, not the time the handler returns.
Hash-chained receipts
verifyLedgerChain recomputes each SHA-256, checks prevHash and seq, and verifies the Ed25519 signature. Mutation, reordering, deletion, or a forged signature fails with HASH_MISMATCH, LINK_MISMATCH, SEQ_MISMATCH, or INVALID_SIGNATURE.
Pass expectedHead from outside the array to test whether this export ends at a head you trust. A match does not prove there is no later receipt elsewhere. v0.1 does not issue that checkpoint. Receipts store a digest of the arguments, not the arguments. Appends in one process are serialized, so concurrent calls there cannot both pass the same remaining budget.