@seams/sayso-verdict
v0.2.0
Published
Zero-dependency WebCrypto Ed25519 verifier and intent digest builder for SaySo signed verdicts (`sayso_verdict_v1`).
Readme
@seams/sayso-verdict
Checks a signed SaySo verdict (sayso_verdict_v1) and builds the intent that the verdict binds. It has no dependencies and uses only WebCrypto, so it runs in Node, a browser and a Cloudflare Worker.
npm install @seams/sayso-verdictimport { createIntent, verifyVerdict } from '@seams/sayso-verdict';
const { intent, intentDigest } = await createIntent({
userId: '[email protected]',
action: 'bank/transfer',
payload: JSON.stringify({ to: 'acct_9182', amount_usd: 45 }),
sentence: 'Send $45 to Bob Miller',
guardedWordIndexes: [0, 1, 2, 3, 5, 6], // no forgiveness in "send", "forty five dollars" and "bob miller"
});
// Send `intent` to the SaySo verifier with the recording. Then check its answer:
const result = await verifyVerdict({
verdictJson,
signatureB64,
publicKey: SAYSO_PUBLIC_KEY_HEX,
userId: '[email protected]',
action: 'bank/transfer',
intentDigest,
});
if (!result.ok) throw new Error(result.refusal.code);What it gives:
createIntent: the intent, itsintentDigestand the words that the user must say.verifyVerdict: the Ed25519 signature, the kind, the outcome, the expiry and each binding that you pass (user, action, intent, spoken text, audio). AVerdictReplayGuardmakes a verdict single-use.createEnrollmentTokenandcreateVerifyToken: short-lived HMAC tokens that let a browser call the verifier.canonicalWav,pcm16ToCanonicalWavandaudioDigest: the audio form that the verdict'saudio_digestcovers.
The SaySo README describes the verifier, the guarded words and the digest formats.
