Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(secret-channel): vendor the Agent Secret Channel (ASC/1) crypto core (#20442)

Arvin Xuebf30ccc297e
diff --git a/.prettierignore b/.prettierignore
index 267cb62e380..338a7d26334 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -64,6 +64,11 @@ Dockerfile*
# add other ignore file below
.next
+# vendored unchanged from the Agent Secret Channel reference implementation
+packages/secret-channel/src/asc/
+packages/secret-channel/test/vectors/
+packages/secret-channel/test/vectors.test.ts
+
# generated files (regenerate with `bun generate` in packages/sdk)
packages/sdk/src/generated/
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 8e59f90c148..ed48b16bfa9 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -225,6 +225,10 @@ export default eslint(
'.agents/skills/acceptance/**',
// Generated by `bun run shell:vendor` in apps/desktop.
'apps/desktop/shell/rescue/electron-updater.cjs',
+ // Vendored unchanged from the Agent Secret Channel reference implementation.
+ 'packages/secret-channel/src/asc/**',
+ 'packages/secret-channel/test/vectors/**',
+ 'packages/secret-channel/test/vectors.test.ts',
// dependencies
'node_modules',
// ci
diff --git a/packages/secret-channel/README.md b/packages/secret-channel/README.md
new file mode 100644
index 00000000000..df3ed51ea5e
--- /dev/null
+++ b/packages/secret-channel/README.md
@@ -0,0 +1,23 @@
+# @lobechat/secret-channel
+
+The Agent Secret Channel (ASC/1, `draft-asc-protocol-00`) crypto core: signed single-use
+requests, the canonical 14-field AAD, HPKE (RFC 9180) envelope seal/open and redaction
+placeholders.
+
+`src/asc/` is vendored unchanged from the reference implementation
+(`agent-secret-channel` → `packages/asc-core`): it equals `main` `442ae4d` with the fix branches
+`fix/redact-short-secret-variants` (`e078942`), `fix/fail-closed-suite-and-version` (`5f6f40d`),
+`fix/frame-and-expiry-hardening` (`d1ab2d2`), `fix/opener-request-version` (`8f2e39d`, stacked on
+`fix/frame-and-expiry-hardening`), `fix/malformed-identity-key` (`6681e84`) and
+`fix/collision-free-placeholder` (`1761f01`, stacked on `fix/streaming-redaction-overlap`) applied.
+`test/vectors/` are the protocol's test vectors, so `test/vectors.test.ts` proves this copy is
+byte-for-byte conformant. Update both together; never edit `src/asc/` here without changing the
+upstream first.
+
+Two files are LobeHub additions: `src/persistedRecipient.ts`, a per-request recipient key that can be
+stored between two HTTP requests (serverless Executor), opened with the same checks and error
+codes as `EphemeralRecipient.open`; and `src/derivedIdentity.ts`, a stable Executor identity derived
+with HKDF from a secret every server instance shares. `src/index.ts` re-exports all three. Lint and Prettier skip the vendored files
+(`eslint.config.mjs`, `.prettierignore`) so they stay byte-identical to upstream.
+
+Licensed Apache-2.0 (same as upstream).
diff --git a/packages/secret-channel/package.json b/packages/secret-channel/package.json
new file mode 100644
index 00000000000..b00f7749601
--- /dev/null
+++ b/packages/secret-channel/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "@lobechat/secret-channel",
+ "version": "0.1.0",
+ "private": true,
+ "description": "Agent Secret Channel (ASC/1) crypto core: signed single-use requests, canonical AAD, HPKE envelope seal/open, redaction placeholders",
+ "license": "Apache-2.0",
+ "type": "module",
+ "exports": {
+ ".": "./src/index.ts"
+ },
+ "scripts": {
+ "test": "vitest run"
+ },
+ "dependencies": {
+ "@hpke/core": "1.9.0",
+ "@hpke/dhkem-x25519": "1.8.0",
+ "@noble/curves": "2.4.0",
+ "@noble/hashes": "2.4.0"
+ },
+ "devDependencies": {
+ "@types/node": "^24.13.3",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/packages/secret-channel/src/asc/aad.ts b/packages/secret-channel/src/asc/aad.ts
new file mode 100644
index 00000000000..0e5ac9430a8
--- /dev/null
+++ b/packages/secret-channel/src/asc/aad.ts
@@ -0,0 +1,126 @@
+import { sha256 } from '@noble/hashes/sha2.js';
+
+import { ASC_AAD_MAGIC, ASC_SUITE, ASC_VERSION } from './constants';
+import { encodeFields, toBase64Url } from './encoding';
+import { AscError } from './errors';
+import type { AscRequest } from './types';
+
+/** The 14 bound values, in AAD order (spec §6.4.1). */
+export interface AscAadBinding {
+ argvHash: string;
+ displayHash: string;
+ ephPub: string;
+ executorId: string;
+ exePath: string;
+ expiresAt: number;
+ identityKeyFp: string;
+ kind: string;
+ requestId: string;
+ runId: string;
+ suite: string;
+ targetKind: string;
+ v: number;
+}
+
+/** The Request fields a receiver binds before trusting it: the AAD inputs plus `v` ([ASC-EXT-02]). */
+export type AscBindableRequest = Pick<
+ AscRequest,
+ | 'executor'
+ | 'expiresAt'
+ | 'id'
+ | 'kind'
+ | 'label'
+ | 'purpose'
+ | 'requester'
+ | 'suite'
+ | 'target'
+ | 'v'
+>;
+
+/** The Request's suite label (spec §6.10): the `suite` member, or the Base suite when absent. */
+export const requestSuite = (request: Pick<AscRequest, 'suite'>): string => request.suite ?? ASC_SUITE;
+
+/** spec §6.4.2: SHA-256 over u32 count ‖ (u32 len ‖ UTF-8 arg)*, base64url. */
+export const hashArgv = (argv: readonly string[]): string =>
+ toBase64Url(sha256(encodeFields([...argv])));
+
+/** spec §6.4.3: everything the Host shows as "system observed" is covered by the signature. */
+export const hashDisplay = (
+ request: Pick<AscRequest, 'executor' | 'label' | 'purpose' | 'target'>,
+): string =>
+ toBase64Url(
+ sha256(
+ encodeFields([
+ request.target.argvDisplay,
+ request.target.promptText ?? '',
+ request.target.verification,
+ request.purpose.systemObserved,
+ request.executor.executorName,
+ request.label,
+ ]),
+ ),
+ );
+
+export const aadBindingFromRequest = (request: AscBindableRequest): AscAadBinding => ({
+ argvHash: request.target.argvHash,
+ displayHash: hashDisplay(request),
+ ephPub: request.executor.ephPub,
+ executorId: request.executor.executorId,
+ exePath: request.target.exePath,
+ expiresAt: request.expiresAt,
+ identityKeyFp: request.executor.identityKeyFp,
+ kind: request.kind,
+ requestId: request.id,
+ runId: request.requester.runId,
+ suite: requestSuite(request),
+ targetKind: request.target.kind,
+ v: ASC_VERSION,
+});
+
+/** Field names in AAD order; index 0 is the magic. Used by tests and test vectors. */
+export const AAD_FIELD_ORDER = [
+ 'magic',
+ 'v',
+ 'suite',
+ 'requestId',
+ 'runId',
+ 'executorId',
+ 'identityKeyFp',
+ 'ephPub',
+ 'targetKind',
+ 'exePath',
+ 'argvHash',
+ 'kind',
+ 'displayHash',
+ 'expiresAt',
+] as const;
+
+export const aadFields = (binding: AscAadBinding): string[] => {
+ if (!Number.isSafeInteger(binding.expiresAt) || binding.expiresAt <= 0)
+ throw new AscError('INVALID_REQUEST', 'expiresAt must be a positive integer (unix ms)');
+ if (!binding.requestId || !binding.runId || !binding.executorId || !binding.ephPub || !binding.argvHash)
+ throw new AscError('INVALID_REQUEST', 'missing binding field');
+
+ return [
+ ASC_AAD_MAGIC,
+ String(binding.v),
+ binding.suite,
+ binding.requestId,
+ binding.runId,
+ binding.executorId,
+ binding.identityKeyFp,
+ binding.ephPub,
+ binding.targetKind,
+ binding.exePath,
+ binding.argvHash,
+ binding.kind,
+ binding.displayHash,
+ String(binding.expiresAt),
+ ];
+};
+
+/** Canonical AAD bytes (spec §6.4). */
+export const encodeAad = (binding: AscAadBinding): Uint8Array => encodeFields(aadFields(binding));
+
+export const encodeRequestAad = (request: AscBindableRequest) =>
+ encodeAad(aadBindingFromRequest(request));
diff --git a/packages/secret-channel/src/asc/constants.ts b/packages/secret-channel/src/asc/constants.ts
new file mode 100644
index 00000000000..77e0dec5fd4
--- /dev/null
+++ b/packages/secret-channel/src/asc/constants.ts
@@ -0,0 +1,30 @@
+/** ASC wire/protocol version (spec §4, §9). Bumping it changes every domain-separation label. */
+export const ASC_VERSION = 1 as const;
+
+/** HPKE (RFC 9180) Base mode suite (spec §6.1). A Request without a `suite` member uses it. */
+export const ASC_SUITE = 'DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM' as const;
+/** HPKE Auth mode suite: the Client authenticates with its paired static key (spec §6.1, §6.10). */
+export const ASC_SUITE_AUTH = 'DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth' as const;
+export type AscSuite = typeof ASC_SUITE | typeof ASC_SUITE_AUTH;
+export const ASC_SUITES: readonly string[] = [ASC_SUITE, ASC_SUITE_AUTH];
+export const ASC_SUITE_IDS = { aead: 0x0002, kdf: 0x0001, kem: 0x0020 } as const;
+
+/** Domain-separation labels (spec §6.1, §6.4, §6.5). */
+export const ASC_HPKE_INFO = 'asc/v1/hpke-info';
+export const ASC_AAD_MAGIC = 'asc/v1/aad';
+export const ASC_SIGNATURE_CONTEXT = 'asc/v1/request-sig';
+
+/** Request lifetime (spec §6.7). */
+export const ASC_DEFAULT_TTL_SEC = 300;
+export const ASC_MAX_TTL_SEC = 900;
+
+/** Plaintext framing (spec §6.6). */
+export const ASC_PAD_BLOCK = 256;
+export const ASC_MAX_SECRET_BYTES = 4093;
+
+/** Envelope size bounds (spec §6.8). */
+export const ASC_MAX_ENC_B64_LENGTH = 64;
+export const ASC_MAX_CT_B64_LENGTH = 8192;
+
+/** Values shorter than this are not full-text redacted (spec §7.4). */
+export const ASC_MIN_REDACT_LENGTH = 4;
diff --git a/packages/secret-channel/src/asc/encoding.ts b/packages/secret-channel/src/asc/encoding.ts
new file mode 100644
index 00000000000..62eab39c992
--- /dev/null
+++ b/packages/secret-channel/src/asc/encoding.ts
@@ -0,0 +1,96 @@
+const textEncoder = new TextEncoder();
+const textDecoder = new TextDecoder('utf-8', { fatal: true });
+
+export const utf8Encode = (value: string): Uint8Array => textEncoder.encode(value);
+export const utf8Decode = (bytes: Uint8Array): string => textDecoder.decode(bytes);
+
+const B64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
+const B64_LOOKUP = new Map([...B64_ALPHABET].map((char, index) => [char, index]));
+
+/** RFC 4648 §5 base64url without padding. Local implementation: identical in browsers, Node, Bun. */
+export const toBase64Url = (bytes: Uint8Array): string => {
+ let out = '';
+ let i = 0;
+ for (; i + 2 < bytes.length; i += 3) {
+ const n = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
+ out += B64_ALPHABET[(n >> 18) & 63] + B64_ALPHABET[(n >> 12) & 63];
+ out += B64_ALPHABET[(n >> 6) & 63] + B64_ALPHABET[n & 63];
+ }
+ const rest = bytes.length - i;
+ if (rest === 1) {
+ const n = bytes[i] << 16;
+ out += B64_ALPHABET[(n >> 18) & 63] + B64_ALPHABET[(n >> 12) & 63];
+ } else if (rest === 2) {
+ const n = (bytes[i] << 16) | (bytes[i + 1] << 8);
+ out +=
+ B64_ALPHABET[(n >> 18) & 63] + B64_ALPHABET[(n >> 12) & 63] + B64_ALPHABET[(n >> 6) & 63];
+ }
+ return out;
+};
+
+export const fromBase64Url = (value: string): Uint8Array => {
+ if (value.length % 4 === 1) throw new TypeError('invalid base64url length');
+ const out = new Uint8Array(Math.floor((value.length * 3) / 4));
+ let buffer = 0;
+ let bits = 0;
+ let o = 0;
+ for (const char of value) {
+ const index = B64_LOOKUP.get(char);
+ if (index === undefined) throw new TypeError('invalid base64url character');
+ buffer = (buffer << 6) | index;
+ bits += 6;
+ if (bits >= 8) {
+ bits -= 8;
+ out[o++] = (buffer >> bits) & 0xff;
+ }
+ }
+ return out;
+};
+
+export const concatBytes = (...parts: Uint8Array[]): Uint8Array => {
+ const out = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
+ let offset = 0;
+ for (const part of parts) {
+ out.set(part, offset);
+ offset += part.length;
+ }
+ return out;
+};
+
+export const u32be = (value: number): Uint8Array => {
+ const out = new Uint8Array(4);
+ new DataView(out.buffer).setUint32(0, value, false);
+ return out;
+};
+
+/** Length-prefixed (u32 big-endian) field list (spec §6.4): unambiguous, no delimiters or escaping. */
+export const encodeFields = (fields: string[]): Uint8Array =>
+ concatBytes(
+ u32be(fields.length),
+ ...fields.flatMap((field) => {
+ const bytes = utf8Encode(field);
+ return [u32be(bytes.length), bytes];
+ }),
+ );
+
+export const bytesEqual = (a: Uint8Array, b: Uint8Array): boolean => {
+ if (a.length !== b.length) return false;
+ let diff = 0;
+ for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i];
+ return diff === 0;
+};
+
+/** Best-effort zeroisation of a buffer we own. JS gives no hard guarantee (GC copies, strings). */
+export const wipe = (bytes: Uint8Array | undefined | null) => {
+ bytes?.fill(0);
+};
+
+export const toHex = (bytes: Uint8Array): string =>
+ [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
+
+export const fromHex = (hex: string): Uint8Array => {
+ if (hex.length % 2 !== 0 || /[^\da-f]/i.test(hex)) throw new TypeError('invalid hex');
+ const out = new Uint8Array(hex.length / 2);
+ for (let i = 0; i < out.length; i++) out[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
+ return out;
+};
diff --git a/packages/secret-channel/src/asc/errors.ts b/packages/secret-channel/src/asc/errors.ts
new file mode 100644
index 00000000000..0b15a09002a
--- /dev/null
+++ b/packages/secret-channel/src/asc/errors.ts
@@ -0,0 +1,27 @@
+/** ASC error codes (spec §8). Messages never include secret material, ciphertext or key bytes. */
+export type AscErrorCode =
+ | 'BAD_SIGNATURE'
+ | 'DECRYPT_FAILED'
+ | 'EXPIRED'
+ | 'FINGERPRINT_MISMATCH'
+ | 'INVALID_ENVELOPE'
+ | 'INVALID_REQUEST'
+ | 'REPLAYED'
+ | 'REQUEST_MISMATCH'
+ | 'SECRET_TOO_LARGE'
+ | 'SENDER_AUTH_REQUIRED'
+ | 'UNKNOWN_SENDER'
+ | 'UNSUPPORTED_VERSION';
+
+export class AscError extends Error {
+ readonly code: AscErrorCode;
+
+ constructor(code: AscErrorCode, message?: string) {
+ super(message ? `${code}: ${message}` : code);
+ this.name = 'AscError';
+ this.code = code;
+ }
+}
+
+export const isAscError = (error: unknown, code?: AscErrorCode): error is AscError =>
+ error instanceof AscError && (code === undefined || error.code === code);
diff --git a/packages/secret-channel/src/asc/hpke.ts b/packages/secret-channel/src/asc/hpke.ts
new file mode 100644
index 00000000000..1f25f6d2ca1
--- /dev/null
+++ b/packages/secret-channel/src/asc/hpke.ts
@@ -0,0 +1,310 @@
+import { Aes256Gcm, CipherSuite, HkdfSha256 } from '@hpke/core';
+import { DhkemX25519HkdfSha256 } from '@hpke/dhkem-x25519';
+
+import { type AscBindableRequest, encodeRequestAad, requestSuite } from './aad';
+import {
+ ASC_HPKE_INFO,
+ ASC_MAX_CT_B64_LENGTH,
+ ASC_MAX_ENC_B64_LENGTH,
+ ASC_MAX_SECRET_BYTES,
+ ASC_PAD_BLOCK,
+ ASC_SUITE,
+ ASC_SUITE_AUTH,
+ ASC_VERSION,
+} from './constants';
+import { fromBase64Url, toBase64Url, utf8Encode, wipe } from './encoding';
+import { AscError, isAscError } from './errors';
+import { type AscTrustCheck, verifyRequest } from './identity';
+import { type AscClientKey, type AscPairedClients, fingerprintClientKey, isClientKeyFingerprint } from './sender';
+import type { AscEnvelope } from './types';
+
+/**
+ * HPKE Base or Auth mode, DHKEM(X25519, HKDF-SHA256) / HKDF-SHA256 / AES-256-GCM (spec §6.1).
+ * The X25519 KEM is pure JS so behaviour does not depend on WebCrypto X25519 support.
+ */
+const createSuite = () =>
+ new CipherSuite({
+ aead: new Aes256Gcm(),
+ kdf: new HkdfSha256(),
+ kem: new DhkemX25519HkdfSha256(),
+ });
+
+let suiteSingleton: CipherSuite | undefined;
+export const getSuite = () => (suiteSingleton ??= createSuite());
+
+const HPKE_INFO = utf8Encode(ASC_HPKE_INFO);
+
+const toArrayBuffer = (bytes: Uint8Array): ArrayBuffer =>
+ bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
+
+// ─── Plaintext framing (spec §6.6): 0x01 ‖ u16be(len) ‖ secret ‖ 0x00… to a multiple of 256 ───
+
+const FRAME_VERSION = 0x01;
+const FRAME_HEADER = 3;
+
+export const framePlaintext = (secret: Uint8Array): Uint8Array => {
+ if (secret.length === 0) throw new AscError('INVALID_REQUEST', 'empty secret');
+ if (secret.length > ASC_MAX_SECRET_BYTES) throw new AscError('SECRET_TOO_LARGE');
+
+ const size = Math.ceil((secret.length + FRAME_HEADER) / ASC_PAD_BLOCK) * ASC_PAD_BLOCK;
+ const framed = new Uint8Array(size);
+ framed[0] = FRAME_VERSION;
+ framed[1] = (secret.length >> 8) & 0xff;
+ framed[2] = secret.length & 0xff;
+ framed.set(secret, FRAME_HEADER);
+ return framed;
+};
+
+export const unframePlaintext = (framed: Uint8Array): Uint8Array => {
+ if (framed.length < ASC_PAD_BLOCK || framed.length % ASC_PAD_BLOCK !== 0)
+ throw new AscError('INVALID_ENVELOPE', 'bad padded length');
+ if (framed[0] !== FRAME_VERSION) throw new AscError('UNSUPPORTED_VERSION');
+
+ // The declared length is bounded by the protocol maximum, not just by the padded buffer: a frame
+ // large enough to fit a longer declaration must not smuggle a secret `framePlaintext` would have
+ // refused ([ASC-L2-21], [ASC-L2-22]).
+ const length = (framed[1] << 8) | framed[2];
+ if (length === 0 || length > ASC_MAX_SECRET_BYTES || length > framed.length - FRAME_HEADER)
+ throw new AscError('INVALID_ENVELOPE', 'bad secret length');
+
+ let padding = 0;
+ for (let i = FRAME_HEADER + length; i < framed.length; i++) padding |= framed[i];
+ if (padding !== 0) throw new AscError('INVALID_ENVELOPE', 'non-zero padding');
+
+ return framed.slice(FRAME_HEADER, FRAME_HEADER + length);
+};
+
+// ─── Client key (spec §6.10) ─────────────────────────────────────────────────────────────────
+
+const exportKeyPair = async (keyPair: HpkeKeyPair): Promise<AscClientKey> => {
+ const suite = getSuite();
+ return {
+ privateKey: new Uint8Array(await suite.kem.serializePrivateKey(keyPair.privateKey)),
+ publicKey: toBase64Url(new Uint8Array(await suite.kem.serializePublicKey(keyPair.publicKey))),
+ };
+};
+
+/** [ASC-L2-33]: a fresh Client key from a CSPRNG. */
+export const generateClientKey = async (): Promise<AscClientKey> => exportKeyPair(await getSuite().kem.generateKeyPair());
+
+/** Test-vector hook ONLY: Client key = DeriveKeyPair(ikmS) (RFC 9180 §7.1.3). */
+export const clientKeyFromIkm = async (ikmS: Uint8Array): Promise<AscClientKey> =>
+ exportKeyPair(await getSuite().kem.deriveKeyPair(toArrayBuffer(ikmS)));
+
+const importClientKey = async (key: AscClientKey) => {
+ const suite = getSuite();
+ return {
+ privateKey: await suite.kem.deserializePrivateKey(toArrayBuffer(key.privateKey)),
+ publicKey: await suite.kem.deserializePublicKey(toArrayBuffer(fromBase64Url(key.publicKey))),
+ };
+};
+
+// ─── Client: seal ────────────────────────────────────────────────────────────────────────────
+
+export interface SealParams {
+ /**
+ * Test-vector hook ONLY: HPKE `ikmE` for DeriveKeyPair of the sender ephemeral key
+ * (RFC 9180 §7.1.3). Production callers MUST NOT pass it (spec §6.2).
+ */
+ deterministicIkmE?: Uint8Array;
+ now?: number;
+ request: AscBindableRequest;
+ secret: Uint8Array;
+ /** This Client's key; required for an Auth-suite Request ([ASC-L2-39]). */
+ sender?: AscClientKey;
+ trust?: AscTrustCheck;
+}
+
+export const sealSecret = async ({
+ deterministicIkmE,
+ now = Date.now(),
+ request,
+ secret,
+ sender,
+ trust,
+}: SealParams): Promise<AscEnvelope> => {
+ const suiteLabel = requestSuite(request);
+ // [ASC-L2-39]: never seal under a suite this Client does not implement.
+ if (suiteLabel !== ASC_SUITE && suiteLabel !== ASC_SUITE_AUTH) throw new AscError('UNSUPPORTED_VERSION');
+ if (now >= request.expiresAt) throw new AscError('EXPIRED');
+
+ verifyRequest(request, trust);
+
+ const auth = suiteLabel === ASC_SUITE_AUTH;
+ // [ASC-L2-39]: an Auth-suite Request needs this Client's key; there is no fallback to Base.
+ if (auth && !sender) throw new AscError('SENDER_AUTH_REQUIRED', 'this Client holds no Client key');
+
+ const suite = getSuite();
+ const framed = framePlaintext(secret);
+ try {
+ const recipientPublicKey = await suite.kem.deserializePublicKey(
+ toArrayBuffer(fromBase64Url(request.executor.ephPub)),
+ );
+ const { ct, enc } = await suite.seal(
+ {
+ info: toArrayBuffer(HPKE_INFO),
+ recipientPublicKey,
+ ...(auth ? { senderKey: await importClientKey(sender!) } : {}),
+ ...(deterministicIkmE ? { ekm: toArrayBuffer(deterministicIkmE) } : {}),
+ },
+ toArrayBuffer(framed),
+ toArrayBuffer(encodeRequestAad(request)),
+ );
+ return {
+ ct: toBase64Url(new Uint8Array(ct)),
+ enc: toBase64Url(new Uint8Array(enc)),
+ requestId: request.id,
+ ...(auth ? { sender: fingerprintClientKey(sender!.publicKey) } : {}),
+ suite: auth ? ASC_SUITE_AUTH : ASC_SUITE,
+ v: ASC_VERSION,
+ };
+ } finally {
+ wipe(framed);
+ }
+};
+
+// ─── Executor: one ephemeral recipient per request, single use (spec §6.7) ───────────────────
+
+export type EphemeralRecipientState = 'pending' | 'consumed' | 'expired' | 'destroyed';
+
+type HpkeKeyPair = Awaited<ReturnType<CipherSuite['kem']['generateKeyPair']>>;
+
+export class EphemeralRecipient {
+ readonly publicKey: string;
+ private keyPair: HpkeKeyPair | undefined;
+ private _state: EphemeralRecipientState = 'pending';
+
+ private constructor(keyPair: HpkeKeyPair, publicKey: string) {
+ this.keyPair = keyPair;
+ this.publicKey = publicKey;
+ }
+
+ /**
+ * `deterministicIkmR` is a test-vector hook ONLY (RFC 9180 DeriveKeyPair). Production callers
+ * MUST NOT pass it: the key has to come from a CSPRNG (spec §6.2).
+ */
+ static async create(deterministicIkmR?: Uint8Array): Promise<EphemeralRecipient> {
+ const suite = getSuite();
+ const keyPair = deterministicIkmR
+ ? await suite.kem.deriveKeyPair(toArrayBuffer(deterministicIkmR))
+ : await suite.kem.generateKeyPair();
+ const publicKey = toBase64Url(
+ new Uint8Array(await suite.kem.serializePublicKey(keyPair.publicKey)),
+ );
+ return new EphemeralRecipient(keyPair, publicKey);
+ }
+
+ get state(): EphemeralRecipientState {
+ return this._state;
+ }
+
+ /**
+ * Decrypt `envelope` for the Executor's own copy of `request`. Errors: REQUEST_MISMATCH,
+ * SENDER_AUTH_REQUIRED, UNKNOWN_SENDER (none of them consumes the key), REPLAYED, EXPIRED,
+ * UNSUPPORTED_VERSION, INVALID_ENVELOPE, DECRYPT_FAILED. Every attempt that reaches decryption
+ * consumes the key first (fail closed). `pairedClients` is the Executor's own set of paired
+ * Client keys ([ASC-L2-34]); an Auth-suite Request opens only with one of them ([ASC-L2-38]).
+ */
+ async open(
+ request: AscBindableRequest,
+ envelope: AscEnvelope,
+ now: number = Date.now(),
+ pairedClients: AscPairedClients = new Map(),
+ ) {
+ if (envelope.requestId !== request.id) throw new AscError('REQUEST_MISMATCH');
+ if (request.executor.ephPub !== this.publicKey)
+ throw new AscError('REQUEST_MISMATCH', 'ephemeral key does not belong to request');
+
+ // [ASC-EXT-02]: a receiver MUST reject a message whose `v` it does not implement. Checking
+ // `envelope.v` alone is not enough — the AAD binds the constant version, so a future-version
+ // Request would still decrypt here and be interpreted with v1 semantics.
+ if (request.v !== ASC_VERSION)
+ throw new AscError('UNSUPPORTED_VERSION', `request version ${request.v}`);
+
+ if (this._state !== 'pending' || !this.keyPair)
+ throw new AscError(this._state === 'expired' ? 'EXPIRED' : 'REPLAYED', `recipient is ${this._state}`);
+
+ // [ASC-L2-26]: at or after `expiresAt` the recipient is destroyed and the request refused,
+ // matching the Client's seal check ([ASC-L2-29]) and the Relay ([ASC-RL-05]).
+ if (now >= request.expiresAt) {
+ this.drop('expired');
+ throw new AscError('EXPIRED');
+ }
+
+ // [ASC-L2-38]: an Auth-suite Request accepts only an Auth Envelope from a paired Client. These
+ // checks precede consumption, like REQUEST_MISMATCH: nothing is decrypted, so a Relay that
+ // injects its own Envelope learns nothing and cannot pre-empt the paired Client's answer.
+ // [ASC-L2-02]: only the implemented suite labels are acceptable. An unrecognised Request label
+ // MUST NOT fall through to Base mode, where the Relay could inject a value of its own choosing.
+ const requestSuiteLabel = requestSuite(request);
+ if (requestSuiteLabel !== ASC_SUITE && requestSuiteLabel !== ASC_SUITE_AUTH)
+ throw new AscError('UNSUPPORTED_VERSION');
+ const auth = requestSuiteLabel === ASC_SUITE_AUTH;
+
+ let senderPublicKey: string | undefined;
+ if (auth) {
+ if (envelope.suite !== ASC_SUITE_AUTH || envelope.sender === undefined)
+ throw new AscError('SENDER_AUTH_REQUIRED');
+ senderPublicKey = isClientKeyFingerprint(envelope.sender) ? pairedClients.get(envelope.sender) : undefined;
+ if (!senderPublicKey) throw new AscError('UNKNOWN_SENDER');
+ }
+
+ const keyPair = this.keyPair;
+ this.drop('consumed');
+
+ try {
+ if (envelope.v !== ASC_VERSION || envelope.suite !== requestSuite(request))
+ throw new AscError('UNSUPPORTED_VERSION');
+ // [ASC-L2-40]: `sender` only with the Auth suite.
+ if (!auth && 'sender' in envelope) throw new AscError('INVALID_ENVELOPE');
+ if (
+ typeof envelope.enc !== 'string' ||
+ typeof envelope.ct !== 'string' ||
+ envelope.enc.length > ASC_MAX_ENC_B64_LENGTH ||
+ envelope.ct.length > ASC_MAX_CT_B64_LENGTH
+ )
+ throw new AscError('INVALID_ENVELOPE');
+
+ let framed: Uint8Array;
+ try {
+ framed = new Uint8Array(
+ await getSuite().open(
+ {
+ enc: toArrayBuffer(fromBase64Url(envelope.enc)),
+ info: toArrayBuffer(HPKE_INFO),
+ recipientKey: keyPair,
+ ...(senderPublicKey
+ ? { senderPublicKey: await getSuite().kem.deserializePublicKey(toArrayBuffer(fromBase64Url(senderPublicKey))) }
+ : {}),
+ },
+ toArrayBuffer(fromBase64Url(envelope.ct)),
+ toArrayBuffer(encodeRequestAad(request)),
+ ),
+ );
+ } catch (error) {
+ if (isAscError(error)) throw error;
+ throw new AscError('DECRYPT_FAILED');
+ }
+
+ try {
+ return unframePlaintext(framed);
+ } finally {
+ wipe(framed);
+ }
+ } catch (error) {
+ if (isAscError(error)) throw error;
+ throw new AscError('INVALID_ENVELOPE');
+ }
+ }
+
+ /** Drop the private key without using it (denied / cancelled / expired / run ended). */
+ destroy() {
+ if (this._state === 'pending') this.drop('destroyed');
+ else this.keyPair = undefined;
+ }
+
+ private drop(state: EphemeralRecipientState) {
+ this.keyPair = undefined;
+ this._state = state;
+ }
+}
diff --git a/packages/secret-channel/src/asc/identity.ts b/packages/secret-channel/src/asc/identity.ts
new file mode 100644
index 00000000000..4248b3ef98d
--- /dev/null
+++ b/packages/secret-channel/src/asc/identity.ts
@@ -0,0 +1,85 @@
+import { ed25519 } from '@noble/curves/ed25519.js';
+import { sha256 } from '@noble/hashes/sha2.js';
+
+import { type AscBindableRequest, encodeRequestAad } from './aad';
+import { ASC_SIGNATURE_CONTEXT, ASC_VERSION } from './constants';
+import { bytesEqual, concatBytes, fromBase64Url, toBase64Url, utf8Encode } from './encoding';
+import { AscError } from './errors';
+
+/** Long-term Executor identity (spec §6.2). Storage is the Executor's responsibility. */
+export interface AscIdentityKeyPair {
+ /** Raw 32-byte Ed25519 public key, base64url. */
+ publicKey: string;
+ /** Raw 32-byte Ed25519 seed. */
+ secretKey: Uint8Array;
+}
+
+export const generateIdentity = (): AscIdentityKeyPair => {
+ const { publicKey, secretKey } = ed25519.keygen();
+ return { publicKey: toBase64Url(publicKey), secretKey };
+};
+
+export const identityFromSeed = (seed: Uint8Array): AscIdentityKeyPair => ({
+ publicKey: toBase64Url(ed25519.getPublicKey(seed)),
+ secretKey: seed,
+});
+
+/** `SHA256:` + base64url(SHA-256(raw public key)) (spec §6.3). */
+export const fingerprintIdentityKey = (publicKey: string): string =>
+ `SHA256:${toBase64Url(sha256(fromBase64Url(publicKey)))}`;
+
+/** First 80 bits of the fingerprint as five upper-case hex groups (spec §6.3). */
+export const formatFingerprintForDisplay = (fingerprint: string): string => {
+ const raw = fromBase64Url(fingerprint.replace(/^SHA256:/, '')).slice(0, 10);
+ const hex = [...raw].map((b) => b.toString(16).padStart(2, '0')).join('').toUpperCase();
+ return hex.match(/.{4}/g)!.join('-');
+};
+
+/** spec §6.5: the signed message is the context label followed by the canonical AAD. */
+export const signatureMessage = (request: AscBindableRequest) =>
+ concatBytes(utf8Encode(ASC_SIGNATURE_CONTEXT), encodeRequestAad(request));
+
+export const signRequest = (request: AscBindableRequest, secretKey: Uint8Array): string =>
+ toBase64Url(ed25519.sign(signatureMessage(request), secretKey));
+
+export interface AscTrustCheck {
+ /** Fingerprint pinned by this Client for `executor.executorId`, if any (spec §6.3). */
+ pinnedFingerprint?: string;
+}
+
+/** Client side, before sealing (spec §6.5). Throws FINGERPRINT_MISMATCH / BAD_SIGNATURE. */
+export const verifyRequest = (request: AscBindableRequest, { pinnedFingerprint }: AscTrustCheck = {}) => {
+ // [ASC-EXT-02]: a receiver MUST reject a message whose `v` it does not implement, and MUST NOT
+ // fall back to a lower version. The AAD binds the constant version, so without this check a
+ // tampered `v` would still verify as version 1.
+ const version: number = request.v;
+ if (version !== ASC_VERSION) throw new AscError('UNSUPPORTED_VERSION', `request version ${version}`);
+
+ const { identityPublicKey, identityKeyFp, sig } = request.executor;
+
+ // A malformed key cannot match any fingerprint: classify it as a mismatch instead of letting the
+ // base64url decode raise a raw `TypeError` at callers that route failures through `AscError`
+ // ([ASC-L2-28]).
+ let actualFingerprint: string;
+ try {
+ actualFingerprint = fingerprintIdentityKey(identityPublicKey);
+ } catch {
+ throw new AscError('FINGERPRINT_MISMATCH', 'identity key is not valid base64url');
+ }
+ if (actualFingerprint !== identityKeyFp)
+ throw new AscError('FINGERPRINT_MISMATCH', 'identityKeyFp does not match identity key');
+
+ if (
+ pinnedFingerprint !== undefined &&
+ !bytesEqual(utf8Encode(pinnedFingerprint), utf8Encode(identityKeyFp))
+ )
+ throw new AscError('FINGERPRINT_MISMATCH', 'executor identity changed since pinning');
+
+ let ok = false;
+ try {
+ ok = ed25519.verify(fromBase64Url(sig), signatureMessage(request), fromBase64Url(identityPublicKey));
+ } catch {
+ ok = false;
+ }
+ if (!ok) throw new AscError('BAD_SIGNATURE');
+};
diff --git a/packages/secret-channel/src/asc/index.ts b/packages/secret-channel/src/asc/index.ts
new file mode 100644
index 00000000000..427efc136b8
--- /dev/null
+++ b/packages/secret-channel/src/asc/index.ts
@@ -0,0 +1,11 @@
+export * from './aad';
+export * from './constants';
+export * from './encoding';
+export * from './errors';
+export * from './hpke';
+export * from './identity';
+export * from './redact';
+export * from './request';
+export * from './sender';
+export type * from './types';
+export { sha256 } from '@noble/hashes/sha2.js';
diff --git a/packages/secret-channel/src/asc/redact.ts b/packages/secret-channel/src/asc/redact.ts
new file mode 100644
index 00000000000..67a84919e9b
--- /dev/null
+++ b/packages/secret-channel/src/asc/redact.ts
@@ -0,0 +1,206 @@
+import { ASC_MIN_REDACT_LENGTH as MIN_REDACT_LENGTH } from './constants';
+import { toBase64Url, utf8Encode } from './encoding';
+
+/** Label charset kept conservative so the placeholder itself can never smuggle content. */
+export const sanitizeSecretLabel = (label: string): string =>
+ label
+ .normalize('NFKC')
+ .replaceAll(/[^\w.-]+/g, '-')
+ .replaceAll(/^-+|-+$/g, '')
+ .slice(0, 40) || 'secret';
+
+/** The only representation of a secret allowed in DB, model context and traces (spec §7.4). */
+export const formatSecretPlaceholder = (label: string) => `«secret:${sanitizeSecretLabel(label)}»`;
+
+/**
+ * Wrap a placeholder in `separator`, between every pair of adjacent characters and around both
+ * ends. With a separator that appears in none of the Run's variants no variant can appear inside
+ * the result, and none can cross from the neighbouring text into it either (spec §7.4,
+ * [ASC-L3-09]).
+ */
+const wrapPlaceholder = (placeholder: string, separator: string): string =>
+ `${separator}${[...placeholder].join(separator)}${separator}`;
+
+const toHex = (bytes: Uint8Array) =>
+ [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
+
+const toBase64 = (bytes: Uint8Array) => {
+ const url = toBase64Url(bytes);
+ return url.replaceAll('-', '+').replaceAll('_', '/');
+};
+
+/**
+ * Encoded forms under which a secret commonly re-appears in output: raw, URL-encoded, JSON-escaped,
+ * base64 (std/url, with and without padding), hex (lower/upper).
+ */
+export const secretVariants = (value: string): string[] => {
+ const bytes = utf8Encode(value);
+ const b64 = toBase64(bytes);
+ const padded = b64 + '='.repeat((4 - (b64.length % 4)) % 4);
+ const hex = toHex(bytes);
+ const variants = new Set([
+ value,
+ encodeURIComponent(value),
+ JSON.stringify(value).slice(1, -1),
+ b64,
+ padded,
+ toBase64Url(bytes),
+ hex,
+ hex.toUpperCase(),
+ ]);
+ return [...variants].filter((variant) => variant.length >= MIN_REDACT_LENGTH);
+};
+
+export interface SecretRedactor {
+ /** Register a delivered secret for this operation. */
+ add: (label: string, value: string) => void;
+ /** Forget every registered value (operation ended). */
+ clear: () => void;
+ /** Length of the longest registered variant. */
+ readonly maxLength: number;
+ redact: (text: string) => string;
+ /**
+ * Redact the decided leading part of `text` and return the raw `carry` re-fed with the next
+ * chunk. Matches resolve left to right, and any suffix a longer variant may still complete from
+ * stays raw, so `carry` is always shorter than the longest variant: a stream buffers at most one
+ * variant's worth, and a match is never split across the boundary or emitted with its own prefix
+ * already redacted. With overlapping variants the result may differ from `redact` on the same
+ * text, but it never re-emits a registered variant.
+ */
+ redactDecided: (text: string) => { carry: string; out: string };
+ readonly size: number;
+}
+
+/**
+ * Executor-side known-value redactor (spec §7.4). One instance per operation.
+ * It only defeats accidental echo; adversarial transforms (rev, xor, split printing) are out of
+ * scope and documented as a limitation.
+ */
+export const createSecretRedactor = (): SecretRedactor => {
+ let patterns: { label: string; variant: string }[] = [];
+ // Variants bucketed by first character so the streaming scan only compares plausible candidates.
+ let byFirst = new Map<string, { label: string; variant: string }[]>();
+ let placeholders = new Map<string, string>();
+
+ const index = () => {
+ byFirst = new Map();
+ for (const pattern of patterns) {
+ const bucket = byFirst.get(pattern.variant[0]);
+ if (bucket) bucket.push(pattern);
+ else byFirst.set(pattern.variant[0], [pattern]);
+ }
+ };
+
+ /** A character that appears in no registered variant, so escaping with it cannot be matched. */
+ const pickSeparator = () => {
+ const used = new Set([...patterns.map((p) => p.variant).join('')]);
+ for (let code = 0x200b; code <= 0x10ffff; code++) {
+ if (code >= 0xd800 && code <= 0xdfff) continue; // lone surrogates
+ const candidate = String.fromCodePoint(code);
+ if (!used.has(candidate)) return candidate;
+ }
+ /* c8 ignore next -- the union of a Run's variants never covers every code point */
+ return '·';
+ };
+
+ /**
+ * A placeholder must not carry a delivered secret: neither inside itself (a secret equal to, or
+ * inside, `secret` or the label) nor composed with the text beside it (a secret like `»abcdef`
+ * formed by the closing `»` and the `abcdef` that follows the placeholder). The plain §7.4 form
+ * is kept while neither can happen; otherwise the same characters are wrapped in a separator that
+ * appears in none of the Run's variants, which no variant can contain or cross.
+ */
+ const refreshPlaceholders = () => {
+ placeholders = new Map();
+ const edges = patterns.some((p) => p.variant.includes('«') || p.variant.includes('»'));
+ for (const { label } of patterns) {
+ const plain = formatSecretPlaceholder(label);
+ const collides = edges || patterns.some((p) => plain.includes(p.variant));
+ placeholders.set(label, collides ? wrapPlaceholder(plain, pickSeparator()) : plain);
+ }
+ };
+
+ const redactText = (text: string) => {
+ let out = text;
+ for (const { label, variant } of patterns) {
+ const placeholder = placeholders.get(label) ?? formatSecretPlaceholder(label);
+ if (out.includes(variant)) out = out.split(variant).join(placeholder);
+ }
+ return out;
+ };
+
+ return {
+ add(label, value) {
+ // No whole-value length guard here: `secretVariants` already drops the representations
+ // shorter than the minimum. Gating on the raw value would skip a short secret's longer
+ // encodings too (e.g. `abc` → `YWJj`, `616263`), leaving them in the output unredacted.
+ for (const variant of secretVariants(value)) patterns.push({ label, variant });
+ // Longest first so a raw value inside its own longer encoding is handled by the longer match.
+ patterns.sort((a, b) => b.variant.length - a.variant.length);
+ index();
+ refreshPlaceholders();
+ },
+ clear() {
+ patterns = [];
+ index();
+ refreshPlaceholders();
+ },
+ get maxLength() {
+ return patterns[0]?.variant.length ?? 0;
+ },
+ redact: redactText,
+ redactDecided(text) {
+ const length = text.length;
+ const longest = patterns[0]?.variant.length ?? 0;
+ if (longest === 0) return { carry: '', out: text };
+
+ let out = '';
+ let decided = 0;
+ let at = 0;
+ while (at < length) {
+ // Only a suffix shorter than the longest variant can still be completed into a match.
+ const remaining = length - at;
+ if (
+ remaining < longest &&
+ patterns.some((p) => p.variant.length > remaining && p.variant.startsWith(text.slice(at)))
+ )
+ break;
+ const match = byFirst.get(text[at])?.find((p) => text.startsWith(p.variant, at));
+ if (match) {
+ const placeholder = placeholders.get(match.label) ?? formatSecretPlaceholder(match.label);
+ out += redactText(text.slice(decided, at)) + placeholder;
+ at += match.variant.length;
+ decided = at;
+ } else {
+ at += 1;
+ }
+ }
+ out += redactText(text.slice(decided, at));
+ return { carry: text.slice(at), out };
+ },
+ get size() {
+ return patterns.length;
+ },
+ };
+};
+
+/**
+ * Chunk-boundary-safe wrapper for stdout/stderr streams. It redacts only the prefix whose matches
+ * are already decided and carries the raw suffix into the next chunk, so a secret split across
+ * chunks is still caught and the buffer never exceeds one variant. Call `flush()` at end of stream.
+ */
+export const createStreamingRedactor = (redactor: SecretRedactor) => {
+ let pending = '';
+ return {
+ flush(): string {
+ const out = redactor.redact(pending);
+ pending = '';
+ return out;
+ },
+ push(chunk: string): string {
+ const { carry, out } = redactor.redactDecided(pending + chunk);
+ pending = carry;
+ return out;
+ },
+ };
+};
diff --git a/packages/secret-channel/src/asc/request.ts b/packages/secret-channel/src/asc/request.ts
new file mode 100644
index 00000000000..445b2ebfb31
--- /dev/null
+++ b/packages/secret-channel/src/asc/request.ts
@@ -0,0 +1,86 @@
+import {
+ ASC_DEFAULT_TTL_SEC,
+ ASC_MAX_TTL_SEC,
+ ASC_SUITE,
+ ASC_SUITE_AUTH,
+ ASC_VERSION,
+} from './constants';
+import { toBase64Url } from './encoding';
+import { AscError } from './errors';
+import { fingerprintIdentityKey, signRequest } from './identity';
+import { isVerifierChecked } from './sender';
+import type { AscRequest } from './types';
+
+/** 128 random bits, base64url (spec §5.1). */
+export const generateRequestId = (): string =>
+ toBase64Url(crypto.getRandomValues(new Uint8Array(16)));
+
+export interface CreateRequestParams extends Pick<
+ AscRequest,
+ 'kind' | 'label' | 'purpose' | 'requester' | 'suite' | 'target'
+> {
+ ephPub: string;
+ executor: { executorId: string; executorName: string };
+ /** Injected for test vectors only; defaults to a fresh random id. */
+ id?: string;
+ identity: { publicKey: string; secretKey: Uint8Array };
+ now?: number;
+ /**
+ * [ASC-L2-35]: the Sink writes a new secret instead of checking one that already exists, which
+ * makes the Request value-accepting even for a `password` / `passphrase` / `otp` kind.
+ */
+ setsNewSecret?: boolean;
+ ttlSec?: number;
+}
+
+/** Executor side: assemble a request and sign its binding (spec §6.5). */
+export const createRequest = ({
+ ephPub,
+ executor,
+ id = generateRequestId(),
+ identity,
+ kind,
+ label,
+ now = Date.now(),
+ purpose,
+ requester,
+ setsNewSecret,
+ suite,
+ target,
+ ttlSec = ASC_DEFAULT_TTL_SEC,
+}: CreateRequestParams): AscRequest => {
+ if (!Number.isFinite(ttlSec) || ttlSec <= 0 || ttlSec > ASC_MAX_TTL_SEC)
+ throw new AscError('INVALID_REQUEST', `ttlSec must be in (0, ${ASC_MAX_TTL_SEC}]`);
+
+ // [ASC-L2-36]: a value-accepting Request MUST carry the Auth suite, whether or not a Client is
+ // paired. Base mode is only sound when the Sink checks the value against a secret that already
+ // exists ([ASC-L2-37]), so a value-accepting Request never falls back to it ([ASC-EXT-07]).
+ const requestSuiteLabel = isVerifierChecked(kind, target.kind, { setsNewSecret })
+ ? suite
+ : ASC_SUITE_AUTH;
+
+ const unsigned: AscRequest = {
+ createdAt: now,
+ executor: {
+ ephPub,
+ executorId: executor.executorId,
+ executorName: executor.executorName,
+ identityKeyFp: fingerprintIdentityKey(identity.publicKey),
+ identityPublicKey: identity.publicKey,
+ sig: '',
+ },
+ expiresAt: now + Math.floor(ttlSec * 1000),
+ id,
+ kind,
+ label,
+ persistence: 'once',
+ purpose,
+ requester,
+ // Omitted for the Base suite so that Base Requests keep their draft-00 shape (spec §6.10).
+ ...(requestSuiteLabel && requestSuiteLabel !== ASC_SUITE ? { suite: requestSuiteLabel } : {}),
+ target,
+ v: ASC_VERSION,
+ };
+
+ return { ...unsigned, executor: { ...unsigned.executor, sig: signRequest(unsigned, identity.secretKey) } };
+};
diff --git a/packages/secret-channel/src/asc/sender.ts b/packages/secret-channel/src/asc/sender.ts
new file mode 100644
index 00000000000..35f8d5b2e6d
--- /dev/null
+++ b/packages/secret-channel/src/asc/sender.ts
@@ -0,0 +1,46 @@
+/**
+ * Sender authentication (spec §6.10): the Client's static X25519 key for HPKE Auth mode, its
+ * fingerprint, and the classification that decides which Requests need it.
+ */
+import { fingerprintIdentityKey } from './identity';
+import { fromBase64Url, toBase64Url } from './encoding';
+
+/** Long-term Client key ([ASC-L2-33]). The private key never leaves the Client's device. */
+export interface AscClientKey {
+ /** Raw 32-byte X25519 private key. */
+ privateKey: Uint8Array;
+ /** Raw 32-byte X25519 public key, base64url. */
+ publicKey: string;
+}
+
+/** `SHA256:` + base64url(SHA-256(raw public key)), the same construction as §6.3. */
+export const fingerprintClientKey = (publicKey: string): string => fingerprintIdentityKey(publicKey);
+
+/** [ASC-L2-40]: the `sender` member is a clientKeyFp. */
+export const isClientKeyFingerprint = (value: unknown): value is string =>
+ typeof value === 'string' && /^SHA256:[A-Za-z0-9_-]{43}$/.test(value);
+
+/** Paired Client keys as the Executor stores them: clientKeyFp → public key ([ASC-L2-34]). */
+export type AscPairedClients = ReadonlyMap<string, string>;
+
+export const pairedClientsFrom = (publicKeys: Iterable<string>): AscPairedClients =>
+ new Map([...publicKeys].map((publicKey) => [fingerprintClientKey(publicKey), publicKey]));
+
+/** Validate a base64url X25519 public key given by the Human during pairing. */
+export const parseClientPublicKey = (publicKey: string): string => {
+ const raw = fromBase64Url(publicKey);
+ if (raw.length !== 32) throw new TypeError('a Client public key is 32 bytes');
+ return toBase64Url(raw);
+};
+
+const VERIFIER_CHECKED_KINDS = new Set(['password', 'passphrase', 'otp']);
+const VERIFIER_CHECKED_TARGETS = new Set(['sudo', 'ssh']);
+
+/**
+ * [ASC-L2-35]: a Request is verifier-checked when its Sink checks the value against a secret that
+ * already exists (password / passphrase / otp for sudo or ssh). Everything else — tokens,
+ * approvals, git, env-run, oauth, mcp-url, pty prompts, unknown kinds, and Sinks that set a new
+ * secret — is value-accepting and needs sender authentication ([ASC-L2-36]).
+ */
+export const isVerifierChecked = (kind: string, targetKind: string, options: { setsNewSecret?: boolean } = {}) =>
+ !options.setsNewSecret && VERIFIER_CHECKED_KINDS.has(kind) && VERIFIER_CHECKED_TARGETS.has(targetKind);
diff --git a/packages/secret-channel/src/asc/types.ts b/packages/secret-channel/src/asc/types.ts
new file mode 100644
index 00000000000..755cf2d43c2
--- /dev/null
+++ b/packages/secret-channel/src/asc/types.ts
@@ -0,0 +1,94 @@
+/**
+ * ASC core types (spec §5). Nothing in here carries a secret value: a request is metadata that a
+ * Relay may store and a Host may show to the model.
+ */
+import type { AscSuite, ASC_VERSION } from './constants';
+
+/** What the human is asked for (spec §5.2, registry §11.2). */
+export type AscSecretKind = 'password' | 'passphrase' | 'token' | 'otp' | 'approval' | (string & {});
+
+/** Where the secret goes, as observed by the Executor (spec §5.2, registry §11.3). */
+export type AscTargetKind =
+ | 'sudo'
+ | 'ssh'
+ | 'git'
+ | 'pty-prompt'
+ | 'env-run'
+ | 'oauth'
+ | 'mcp-url'
+ | (string & {});
+
+/** Strength of the Executor's peer verification (spec §4.5). */
+export type AscVerification = 'verified' | 'unverified';
+
+export interface AscTarget {
+ /** Human-readable argv as observed by the Executor, redacted; bound via displayHash. */
+ argvDisplay: string;
+ /** base64url(SHA-256(encodeFields(argv))) (spec §6.4.2). */
+ argvHash: string;
+ /** Absolute executable path of the sink as reported by the OS; '' when not applicable. */
+ exePath: string;
+ kind: AscTargetKind;
+ /** Prompt text the sink passed to the Askpass helper; bound via displayHash. */
+ promptText?: string;
+ verification: AscVerification;
+}
+
+export interface AscExecutorBinding {
+ /** Stable, opaque Executor identifier. */
+ executorId: string;
+ /** Human-readable Executor name shown to the user; bound via displayHash. */
+ executorName: string;
+ /** Per-request X25519 public key, raw 32 bytes, base64url. */
+ ephPub: string;
+ /** `SHA256:` + base64url(SHA-256(identityPublicKey raw)). */
+ identityKeyFp: string;
+ /** Long-term Ed25519 public key, raw 32 bytes, base64url. */
+ identityPublicKey: string;
+ /** Ed25519 over ASC_SIGNATURE_CONTEXT ‖ AAD, base64url. */
+ sig: string;
+}
+
+export interface AscRequest {
+ createdAt: number;
+ executor: AscExecutorBinding;
+ expiresAt: number;
+ id: string;
+ kind: AscSecretKind;
+ label: string;
+ persistence: 'once';
+ purpose: {
+ /** Requester-supplied explanation. Untrusted, NOT bound; Hosts label it as unverified. */
+ agentClaim?: string;
+ /** Executor-generated description of the observed target; bound via displayHash. */
+ systemObserved: string;
+ };
+ /** Suite label (spec §6.1, §6.10); absent means the Base suite. Bound as AAD field 2. */
+ suite?: AscSuite;
+ requester: {
+ /** Identifier of the agent run the request belongs to; bound into the AAD. */
+ runId: string;
+ source: 'askpass' | 'tool' | 'pty-detect' | 'user-initiated' | (string & {});
+ };
+ target: AscTarget;
+ v: typeof ASC_VERSION;
+}
+
+/** Client → Relay → Executor (spec §6.8). */
+export interface AscEnvelope {
+ ct: string;
+ enc: string;
+ requestId: string;
+ /** Auth suite only: clientKeyFp of the sealing Client key (spec §6.10). */
+ sender?: string;
+ suite: AscSuite;
+ v: typeof ASC_VERSION;
+}
+
+/** The only result a Requester (agent) ever receives (spec §5.4). */
+export interface AscGrantResult {
+ attempt?: number;
+ note?: string;
+ requestId: string;
+ status: 'provided' | 'denied' | 'expired' | 'authorized' | 'failed';
+}
diff --git a/packages/secret-channel/src/derivedIdentity.ts b/packages/secret-channel/src/derivedIdentity.ts
new file mode 100644
index 00000000000..5609f08a047
--- /dev/null
+++ b/packages/secret-channel/src/derivedIdentity.ts
@@ -0,0 +1,29 @@
+/**
+ * LobeHub addition (not vendored): a stable Executor identity derived from a
+ * server secret.
+ *
+ * ASC leaves identity storage to the Executor (spec §6.2). A horizontally
+ * scaled, serverless Executor has no single disk to keep a generated key on,
+ * so it derives the Ed25519 seed from a secret every instance already shares:
+ * HKDF-SHA256(ikm = server secret, salt = "asc/v1/executor-identity", info =
+ * executorId). The identity stays the same across instances and deploys —
+ * which is what lets clients TOFU-pin its fingerprint — and changes only when
+ * the secret is rotated, exactly like any other key rotation.
+ */
+import { hkdf } from '@noble/hashes/hkdf.js';
+import { sha256 } from '@noble/hashes/sha2.js';
+
+import { utf8Encode } from './asc/encoding';
+import { type AscIdentityKeyPair, identityFromSeed } from './asc/identity';
+
+const IDENTITY_SALT = 'asc/v1/executor-identity';
+
+export const deriveIdentityFromSecret = (
+ secret: Uint8Array,
+ executorId: string,
+): AscIdentityKeyPair => {
+ if (secret.length < 16) throw new Error('executor identity secret must be at least 128 bits');
+ return identityFromSeed(
+ hkdf(sha256, secret, utf8Encode(IDENTITY_SALT), utf8Encode(executorId), 32),
+ );
+};
diff --git a/packages/secret-channel/src/index.ts b/packages/secret-channel/src/index.ts
new file mode 100644
index 00000000000..8b42e3d5b98
--- /dev/null
+++ b/packages/secret-channel/src/index.ts
@@ -0,0 +1,4 @@
+// Vendored ASC/1 reference core (unchanged) + the LobeHub additions.
+export * from './asc';
+export * from './derivedIdentity';
+export * from './persistedRecipient';
diff --git a/packages/secret-channel/src/persistedRecipient.ts b/packages/secret-channel/src/persistedRecipient.ts
new file mode 100644
index 00000000000..d6e0f50cbab
--- /dev/null
+++ b/packages/secret-channel/src/persistedRecipient.ts
@@ -0,0 +1,136 @@
+/**
+ * LobeHub addition (not vendored): an ephemeral recipient whose private key can
+ * be stored between two HTTP requests.
+ *
+ * The reference {@link EphemeralRecipient} keeps its key in process memory,
+ * which assumes the Executor is one long-lived process. A serverless Executor
+ * creates the request in one invocation and opens the envelope in another, so
+ * it has to persist the key — sealed under its own at-rest key — and destroy
+ * that copy *before* it calls {@link openWithPersistedKey}. Everything else
+ * mirrors `EphemeralRecipient.open` check for check, with the same error
+ * codes, so the conformance properties carry over:
+ *
+ * - REQUEST_MISMATCH / SENDER_AUTH_REQUIRED fire before any decryption;
+ * - EXPIRED is checked against the request's own `expiresAt`;
+ * - version / suite / size limits are enforced before HPKE runs;
+ * - every failure inside decryption is DECRYPT_FAILED or INVALID_ENVELOPE and
+ * never carries plaintext, ciphertext or key bytes.
+ */
+import { type AscBindableRequest, encodeRequestAad, requestSuite } from './asc/aad';
+import {
+ ASC_HPKE_INFO,
+ ASC_MAX_CT_B64_LENGTH,
+ ASC_MAX_ENC_B64_LENGTH,
+ ASC_SUITE,
+ ASC_SUITE_AUTH,
+ ASC_VERSION,
+} from './asc/constants';
+import { fromBase64Url, toBase64Url, utf8Encode, wipe } from './asc/encoding';
+import { AscError, isAscError } from './asc/errors';
+import { getSuite, unframePlaintext } from './asc/hpke';
+import type { AscEnvelope } from './asc/types';
+
+const toArrayBuffer = (bytes: Uint8Array): ArrayBuffer =>
+ bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
+
+export interface PersistableRecipientKey {
+ /** Raw X25519 private key, base64url. Seal it at rest; never log it. */
+ privateKey: string;
+ /** Raw X25519 public key, base64url — the request's `executor.ephPub`. */
+ publicKey: string;
+}
+
+/** A fresh per-request X25519 key pair from the CSPRNG (spec §6.2). */
+export const generatePersistableRecipientKey = async (): Promise<PersistableRecipientKey> => {
+ const suite = getSuite();
+ const keyPair = await suite.kem.generateKeyPair();
+ return {
+ privateKey: toBase64Url(
+ new Uint8Array(await suite.kem.serializePrivateKey(keyPair.privateKey)),
+ ),
+ publicKey: toBase64Url(new Uint8Array(await suite.kem.serializePublicKey(keyPair.publicKey))),
+ };
+};
+
+export interface OpenWithPersistedKeyParams {
+ envelope: AscEnvelope;
+ /** The key taken from storage. The caller MUST already have destroyed the stored copy. */
+ key: PersistableRecipientKey;
+ now?: number;
+ /** The Executor's own copy of the request (never the client's). */
+ request: AscBindableRequest;
+}
+
+/**
+ * Open an envelope with a key that was persisted between requests. Base suite
+ * only: the server-side Executor holds no paired Client keys, so an
+ * Auth-suite request cannot be opened here and is refused up front.
+ */
+export const openWithPersistedKey = async ({
+ envelope,
+ key,
+ now = Date.now(),
+ request,
+}: OpenWithPersistedKeyParams): Promise<Uint8Array> => {
+ if (envelope.requestId !== request.id) throw new AscError('REQUEST_MISMATCH');
+ if (request.executor.ephPub !== key.publicKey)
+ throw new AscError('REQUEST_MISMATCH', 'ephemeral key does not belong to request');
+ const requestSuiteLabel = requestSuite(request);
+ if (requestSuiteLabel === ASC_SUITE_AUTH) throw new AscError('SENDER_AUTH_REQUIRED');
+ // [ASC-L2-02]: a Base-only opener must refuse a label it does not implement rather than let an
+ // unrecognised Request fall through to Base mode without sender authentication.
+ if (requestSuiteLabel !== ASC_SUITE) throw new AscError('UNSUPPORTED_VERSION');
+ // [ASC-EXT-02]: reject a Request version this implementation does not speak, before consuming.
+ if (request.v !== ASC_VERSION)
+ throw new AscError('UNSUPPORTED_VERSION', `request version ${request.v}`);
+ // [ASC-L2-26]: at or after `expiresAt`, matching `EphemeralRecipient.open` and the Client seal.
+ if (now >= request.expiresAt) throw new AscError('EXPIRED');
+
+ if (envelope.v !== ASC_VERSION || envelope.suite !== requestSuiteLabel)
+ throw new AscError('UNSUPPORTED_VERSION');
+ if ('sender' in envelope) throw new AscError('INVALID_ENVELOPE');
+ if (
+ typeof envelope.enc !== 'string' ||
+ typeof envelope.ct !== 'string' ||
+ envelope.enc.length > ASC_MAX_ENC_B64_LENGTH ||
+ envelope.ct.length > ASC_MAX_CT_B64_LENGTH
+ )
+ throw new AscError('INVALID_ENVELOPE');
+
+ const suite = getSuite();
+ let privateBytes: Uint8Array | undefined;
+ let framed: Uint8Array;
+ try {
+ // A corrupted or tampered record must fail as DECRYPT_FAILED, not a raw base64url decode error.
+ privateBytes = fromBase64Url(key.privateKey);
+ const recipientKey = {
+ privateKey: await suite.kem.deserializePrivateKey(toArrayBuffer(privateBytes)),
+ publicKey: await suite.kem.deserializePublicKey(toArrayBuffer(fromBase64Url(key.publicKey))),
+ };
+ framed = new Uint8Array(
+ await suite.open(
+ {
+ enc: toArrayBuffer(fromBase64Url(envelope.enc)),
+ info: toArrayBuffer(utf8Encode(ASC_HPKE_INFO)),
+ recipientKey,
+ },
+ toArrayBuffer(fromBase64Url(envelope.ct)),
+ toArrayBuffer(encodeRequestAad(request)),
+ ),
+ );
+ } catch (error) {
+ if (isAscError(error)) throw error;
+ throw new AscError('DECRYPT_FAILED');
+ } finally {
+ wipe(privateBytes);
+ }
+
+ try {
+ return unframePlaintext(framed);
+ } catch (error) {
+ if (isAscError(error)) throw error;
+ throw new AscError('INVALID_ENVELOPE');
+ } finally {
+ wipe(framed);
+ }
+};
diff --git a/packages/secret-channel/test/fail-closed.test.ts b/packages/secret-channel/test/fail-closed.test.ts
new file mode 100644
index 00000000000..08427eeb852
--- /dev/null
+++ b/packages/secret-channel/test/fail-closed.test.ts
@@ -0,0 +1,216 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ ASC_SUITE,
+ ASC_SUITE_AUTH,
+ ASC_VERSION,
+ createRequest,
+ EphemeralRecipient,
+ generateIdentity,
+ generatePersistableRecipientKey,
+ hashArgv,
+ isAscError,
+ openWithPersistedKey,
+ verifyRequest,
+} from '../src';
+
+const identity = generateIdentity();
+const UNKNOWN_SUITE = 'DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-128-GCM';
+
+const target = (kind: string) => ({
+ argvDisplay: `sink ${kind}`,
+ argvHash: hashArgv(['sink', kind]),
+ exePath: `/usr/bin/${kind}`,
+ kind,
+ verification: 'verified' as const,
+});
+
+const build = (
+ over: {
+ ephPub?: string;
+ kind?: string;
+ setsNewSecret?: boolean;
+ suite?: string;
+ targetKind?: string;
+ } = {},
+) =>
+ createRequest({
+ ephPub: over.ephPub ?? 'A'.repeat(43),
+ executor: { executorId: 'exec-TEST', executorName: 'Test box' },
+ identity,
+ kind: over.kind ?? 'token',
+ label: 'unit',
+ purpose: { systemObserved: 'unit' },
+ requester: { runId: 'run-1', source: 'tool' },
+ setsNewSecret: over.setsNewSecret,
+ suite: over.suite as never,
+ target: target(over.targetKind ?? 'git'),
+ });
+
+const codeOf = async (fn: () => unknown) => {
+ try {
+ await fn();
+ return null;
+ } catch (error) {
+ if (isAscError(error)) return error.code;
+ throw error;
+ }
+};
+
+describe('fail closed', () => {
+ it('[ASC-L2-36] gives a value-accepting Request the Auth suite even when none is asked for', () => {
+ expect(build({ kind: 'token' }).suite).toBe(ASC_SUITE_AUTH);
+ expect(build({ kind: 'approval', targetKind: 'git' }).suite).toBe(ASC_SUITE_AUTH);
+ // A Sink that writes a new secret is value-accepting even for a verifier-checked kind and
+ // target ([ASC-L2-35], [ASC-EXT-07]) — the ssh-keygen case.
+ expect(build({ kind: 'passphrase', setsNewSecret: true, targetKind: 'ssh' }).suite).toBe(
+ ASC_SUITE_AUTH,
+ );
+ });
+
+ it('[ASC-L2-37] keeps Base for a verifier-checked Request without a Client, and honours Auth', () => {
+ expect(build({ kind: 'password', targetKind: 'sudo' }).suite).toBeUndefined();
+ expect(build({ kind: 'password', targetKind: 'sudo', suite: ASC_SUITE_AUTH }).suite).toBe(
+ ASC_SUITE_AUTH,
+ );
+ });
+
+ it('[ASC-EXT-02] rejects a Request whose v this implementation does not speak', () => {
+ const request = build({ kind: 'password', targetKind: 'sudo' });
+ expect(() => verifyRequest(request)).not.toThrow();
+ expect(() => verifyRequest({ ...request, v: 2 as never })).toThrowError(
+ expect.objectContaining({ code: 'UNSUPPORTED_VERSION' }),
+ );
+ });
+
+ it('[ASC-L2-28] maps a malformed identity key to FINGERPRINT_MISMATCH, not a decode error', () => {
+ const request = build({ kind: 'password', targetKind: 'sudo' });
+
+ // Relay-supplied metadata: a key that is not valid base64url must fail as an ASC error, since
+ // callers classify failures through `AscError`.
+ for (const identityPublicKey of ['!', 'abc!', 'AAAAA', ''])
+ expect(() =>
+ verifyRequest({ ...request, executor: { ...request.executor, identityPublicKey } }),
+ ).toThrowError(expect.objectContaining({ code: 'FINGERPRINT_MISMATCH' }));
+ });
+
+ it('[ASC-EXT-02] the Executor opener rejects a Request whose v it does not speak', async () => {
+ const recipient = await EphemeralRecipient.create();
+ const request = build({ ephPub: recipient.publicKey, kind: 'password', targetKind: 'sudo' });
+ const envelope = {
+ ct: 'AA',
+ enc: 'AA',
+ requestId: request.id,
+ suite: ASC_SUITE,
+ v: ASC_VERSION,
+ };
+
+ expect(
+ await codeOf(() => recipient.open({ ...request, v: 2 as never }, envelope, Date.now())),
+ ).toBe('UNSUPPORTED_VERSION');
+ // Refused before consumption: a v1 Request still gets as far as decryption, not REPLAYED.
+ expect(await codeOf(() => recipient.open(request, envelope, Date.now()))).not.toBe('REPLAYED');
+ });
+
+ it('[ASC-EXT-02] the persisted opener rejects a Request whose v it does not speak', async () => {
+ const key = await generatePersistableRecipientKey();
+ const request = build({ ephPub: key.publicKey, kind: 'password', targetKind: 'sudo' });
+ const envelope = {
+ ct: 'AA',
+ enc: 'AA',
+ requestId: request.id,
+ suite: ASC_SUITE,
+ v: ASC_VERSION,
+ };
+
+ expect(
+ await codeOf(() =>
+ openWithPersistedKey({ envelope, key, request: { ...request, v: 2 as never } }),
+ ),
+ ).toBe('UNSUPPORTED_VERSION');
+ });
+
+ it('[ASC-L2-28] maps a malformed persisted private key to DECRYPT_FAILED, not a decode error', async () => {
+ const key = await generatePersistableRecipientKey();
+ const request = build({ ephPub: key.publicKey, kind: 'password', targetKind: 'sudo' });
+ const envelope = {
+ ct: 'AA',
+ enc: 'AA',
+ requestId: request.id,
+ suite: ASC_SUITE,
+ v: ASC_VERSION,
+ };
+
+ // A corrupted or tampered at-rest record must fail as an ASC error, since callers classify
+ // failures through `AscError`.
+ expect(
+ await codeOf(() =>
+ openWithPersistedKey({ envelope, key: { ...key, privateKey: '!' }, request }),
+ ),
+ ).toBe('DECRYPT_FAILED');
+ });
+
+ it('[ASC-L2-02] refuses an unrecognised Request suite label instead of opening it in Base mode', async () => {
+ const recipient = await EphemeralRecipient.create();
+ const request = build({ ephPub: recipient.publicKey, kind: 'password', targetKind: 'sudo' });
+ expect(request.suite).toBeUndefined();
+
+ const unknown = { ...request, suite: UNKNOWN_SUITE as never };
+ const envelope = {
+ ct: 'AA',
+ enc: 'AA',
+ requestId: unknown.id,
+ suite: UNKNOWN_SUITE as never,
+ v: ASC_VERSION,
+ };
+
+ // The label is refused before any key consumption, like REQUEST_MISMATCH ([ASC-L2-38]).
+ expect(await codeOf(() => recipient.open(unknown, envelope, Date.now()))).toBe(
+ 'UNSUPPORTED_VERSION',
+ );
+
+ // Not consumed: the recipient is still pending, so a Base-suite Envelope gets as far as
+ // decryption rather than being refused as REPLAYED.
+ expect(
+ await codeOf(() =>
+ recipient.open(request, { ...envelope, suite: ASC_SUITE as never }, Date.now()),
+ ),
+ ).not.toBe('REPLAYED');
+ });
+
+ it('[ASC-L2-02] the persisted Base-only opener refuses an unrecognised Request suite label', async () => {
+ const key = await generatePersistableRecipientKey();
+ const request = build({ ephPub: key.publicKey, kind: 'password', targetKind: 'sudo' });
+ expect(request.suite).toBeUndefined();
+
+ const unknown = { ...request, suite: UNKNOWN_SUITE as never };
+ const envelope = {
+ ct: 'AA',
+ enc: 'AA',
+ requestId: unknown.id,
+ suite: UNKNOWN_SUITE as never,
+ v: ASC_VERSION,
+ };
+
+ expect(await codeOf(() => openWithPersistedKey({ envelope, key, request: unknown }))).toBe(
+ 'UNSUPPORTED_VERSION',
+ );
+ });
+
+ it('[ASC-L2-02] the persisted opener still refuses the Auth suite up front', async () => {
+ const key = await generatePersistableRecipientKey();
+ const request = build({ ephPub: key.publicKey, kind: 'token' });
+ expect(request.suite).toBe(ASC_SUITE_AUTH);
+
+ const envelope = {
+ ct: 'AA',
+ enc: 'AA',
+ requestId: request.id,
+ suite: ASC_SUITE_AUTH,
+ v: ASC_VERSION,
+ };
+ expect(await codeOf(() => openWithPersistedKey({ envelope, key, request }))).toBe(
+ 'SENDER_AUTH_REQUIRED',
+ );
+ });
+});
diff --git a/packages/secret-channel/test/framing-and-expiry.test.ts b/packages/secret-channel/test/framing-and-expiry.test.ts
new file mode 100644
index 00000000000..3f50e5233bd
--- /dev/null
+++ b/packages/secret-channel/test/framing-and-expiry.test.ts
@@ -0,0 +1,119 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ ASC_MAX_SECRET_BYTES,
+ ASC_PAD_BLOCK,
+ createRequest,
+ EphemeralRecipient,
+ framePlaintext,
+ generateIdentity,
+ hashArgv,
+ isAscError,
+ sealSecret,
+ unframePlaintext,
+ utf8Decode,
+ utf8Encode,
+} from '../src';
+
+const identity = generateIdentity();
+
+const passwordRequest = (ephPub: string) =>
+ createRequest({
+ ephPub,
+ executor: { executorId: 'exec-TEST', executorName: 'Test box' },
+ identity,
+ kind: 'password',
+ label: 'unit',
+ purpose: { systemObserved: 'unit' },
+ requester: { runId: 'run-1', source: 'tool' },
+ target: {
+ argvDisplay: 'sink sudo',
+ argvHash: hashArgv(['sink', 'sudo']),
+ exePath: '/usr/bin/sudo',
+ kind: 'sudo',
+ verification: 'verified',
+ },
+ });
+
+const codeOf = async (fn: () => unknown) => {
+ try {
+ await fn();
+ return null;
+ } catch (error) {
+ if (isAscError(error)) return error.code;
+ throw error;
+ }
+};
+
+/** Build a frame with an arbitrary declared length, bypassing `framePlaintext`'s own limits. */
+const craftFrame = (declaredLength: number, blocks: number) => {
+ const frame = new Uint8Array(blocks * ASC_PAD_BLOCK);
+ frame[0] = 0x01;
+ frame[1] = (declaredLength >> 8) & 0xff;
+ frame[2] = declaredLength & 0xff;
+ return frame;
+};
+
+describe('plaintext framing bounds', () => {
+ it('round-trips a maximum-size secret', () => {
+ const secret = new Uint8Array(ASC_MAX_SECRET_BYTES).fill(0x41);
+ const framed = framePlaintext(secret);
+ expect(framed.length).toBe(4096);
+ expect(unframePlaintext(framed)).toEqual(secret);
+ });
+
+ it('accepts a frame that declares exactly the maximum secret', () => {
+ expect(unframePlaintext(craftFrame(ASC_MAX_SECRET_BYTES, 16)).length).toBe(
+ ASC_MAX_SECRET_BYTES,
+ );
+ });
+
+ it('[ASC-L2-22] rejects a declared length above the protocol maximum', () => {
+ // 17 blocks (4352 bytes) is a positive multiple of 256 and has room for the over-long
+ // declaration, so only the protocol maximum stops a frame that `framePlaintext` would never
+ // have produced from handing back an over-long secret.
+ expect(() => unframePlaintext(craftFrame(ASC_MAX_SECRET_BYTES + 1, 17))).toThrowError(
+ expect.objectContaining({ code: 'INVALID_ENVELOPE' }),
+ );
+ });
+});
+
+describe('request lifetime boundary', () => {
+ it('[ASC-L2-29] the Client refuses to seal at exactly expiresAt', async () => {
+ const recipient = await EphemeralRecipient.create();
+ const request = passwordRequest(recipient.publicKey);
+
+ expect(
+ await codeOf(() =>
+ sealSecret({ now: request.expiresAt, request, secret: utf8Encode('hunter2') }),
+ ),
+ ).toBe('EXPIRED');
+ });
+
+ it('still opens one millisecond before expiresAt', async () => {
+ const recipient = await EphemeralRecipient.create();
+ const request = passwordRequest(recipient.publicKey);
+ const envelope = await sealSecret({
+ now: request.expiresAt - 1,
+ request,
+ secret: utf8Encode('hunter2'),
+ });
+
+ const opened = await recipient.open(request, envelope, request.expiresAt - 1);
+ expect(utf8Decode(opened)).toBe('hunter2');
+ });
+
+ it('[ASC-L2-26] the Executor refuses at exactly expiresAt, like the Client', async () => {
+ const recipient = await EphemeralRecipient.create();
+ const request = passwordRequest(recipient.publicKey);
+ const envelope = await sealSecret({
+ now: request.expiresAt - 1,
+ request,
+ secret: utf8Encode('hunter2'),
+ });
+
+ expect(await codeOf(() => recipient.open(request, envelope, request.expiresAt))).toBe(
+ 'EXPIRED',
+ );
+ });
+});
diff --git a/packages/secret-channel/test/persistedRecipient.test.ts b/packages/secret-channel/test/persistedRecipient.test.ts
new file mode 100644
index 00000000000..0d092aa1e68
--- /dev/null
+++ b/packages/secret-channel/test/persistedRecipient.test.ts
@@ -0,0 +1,133 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ type AscRequest,
+ createRequest,
+ EphemeralRecipient,
+ generateIdentity,
+ generatePersistableRecipientKey,
+ hashArgv,
+ isAscError,
+ openWithPersistedKey,
+ sealSecret,
+ utf8Decode,
+ utf8Encode,
+} from '../src';
+
+const identity = generateIdentity();
+
+/**
+ * A verifier-checked Request ([ASC-L2-35]). The persisted opener is Base-only, and Base mode is
+ * only sound for a Sink that checks the value against a secret that already exists ([ASC-L2-37]).
+ * `createRequest` forces a value-accepting Request onto the Auth suite ([ASC-L2-36]), which this
+ * Base-only path cannot open at all — so the fixture has to be a verifier-checked target.
+ */
+const buildRequest = (ephPub: string, now = Date.now()): AscRequest =>
+ createRequest({
+ ephPub,
+ executor: { executorId: 'lobehub-test', executorName: 'LobeHub' },
+ identity,
+ kind: 'password',
+ label: 'sudo-password',
+ now,
+ purpose: { systemObserved: 'sudo: lobehub-agent sendMessage' },
+ requester: { runId: 'op-1', source: 'tool' },
+ target: {
+ argvDisplay: 'lobehub-agent sendMessage',
+ argvHash: hashArgv(['lobehub-agent', 'sendMessage']),
+ exePath: '/usr/bin/sudo',
+ kind: 'sudo',
+ verification: 'verified',
+ },
+ ttlSec: 600,
+ });
+
+const codeOf = async (fn: () => Promise<unknown>) => {
+ try {
+ await fn();
+ return null;
+ } catch (error) {
+ if (isAscError(error)) return error.code;
+ throw error;
+ }
+};
+
+describe('persisted recipient', () => {
+ it('opens an envelope sealed by the reference client after a round trip through storage', async () => {
+ const key = await generatePersistableRecipientKey();
+ // What storage holds is plain strings — simulate the round trip.
+ const stored = structuredClone(key);
+ const request = buildRequest(key.publicKey);
+
+ const envelope = await sealSecret({ request, secret: utf8Encode('482913') });
+ const plaintext = await openWithPersistedKey({ envelope, key: stored, request });
+
+ expect(utf8Decode(plaintext)).toBe('482913');
+ });
+
+ it('agrees with EphemeralRecipient on what it opens', async () => {
+ const recipient = await EphemeralRecipient.create();
+ const request = buildRequest(recipient.publicKey);
+ const envelope = await sealSecret({ request, secret: utf8Encode('xyz-123') });
+
+ expect(utf8Decode(await recipient.open(request, envelope))).toBe('xyz-123');
+ });
+
+ it('refuses an envelope bound to a different request (AAD binding)', async () => {
+ const key = await generatePersistableRecipientKey();
+ const request = buildRequest(key.publicKey);
+ const envelope = await sealSecret({ request, secret: utf8Encode('482913') });
+
+ // Same key, but the action the human saw changed after sealing.
+ const tampered = {
+ ...request,
+ target: { ...request.target, argvHash: hashArgv(['acc-1', '[email protected]']) },
+ };
+
+ expect(await codeOf(() => openWithPersistedKey({ envelope, key, request: tampered }))).toBe(
+ 'DECRYPT_FAILED',
+ );
+ });
+
+ it('refuses a mismatched request id, a foreign key and an expired request before decrypting', async () => {
+ const key = await generatePersistableRecipientKey();
+ const other = await generatePersistableRecipientKey();
+ const now = Date.now();
+ const request = buildRequest(key.publicKey, now);
+ const envelope = await sealSecret({ request, secret: utf8Encode('482913') });
+
+ expect(
+ await codeOf(() =>
+ openWithPersistedKey({ envelope: { ...envelope, requestId: 'nope' }, key, request }),
+ ),
+ ).toBe('REQUEST_MISMATCH');
+ expect(await codeOf(() => openWithPersistedKey({ envelope, key: other, request }))).toBe(
+ 'REQUEST_MISMATCH',
+ );
+ expect(
+ await codeOf(() => openWithPersistedKey({ envelope, key, now: request.expiresAt, request })),
+ ).toBe('EXPIRED');
+ expect(
+ await codeOf(() =>
+ openWithPersistedKey({ envelope, key, now: request.expiresAt + 1, request }),
+ ),
+ ).toBe('EXPIRED');
+ });
+
+ it('refuses a sender field on a Base envelope and oversized ciphertext', async () => {
+ const key = await generatePersistableRecipientKey();
+ const request = buildRequest(key.publicKey);
+ const envelope = await sealSecret({ request, secret: utf8Encode('482913') });
+
+ expect(
+ await codeOf(() =>
+ openWithPersistedKey({ envelope: { ...envelope, sender: 'x' }, key, request }),
+ ),
+ ).toBe('INVALID_ENVELOPE');
+ expect(
+ await codeOf(() =>
+ openWithPersistedKey({ envelope: { ...envelope, ct: 'A'.repeat(9000) }, key, request }),
+ ),
+ ).toBe('INVALID_ENVELOPE');
+ });
+});
diff --git a/packages/secret-channel/test/redaction-placeholder.test.ts b/packages/secret-channel/test/redaction-placeholder.test.ts
new file mode 100644
index 00000000000..eeff9cf3261
--- /dev/null
+++ b/packages/secret-channel/test/redaction-placeholder.test.ts
@@ -0,0 +1,71 @@
+import { describe, expect, it } from 'vitest';
+
+import { createSecretRedactor, createStreamingRedactor, secretVariants } from '../src';
+
+const expectNoVariant = (out: string, variants: string[]) => {
+ for (const variant of variants) expect(out.includes(variant), `leaked ${variant}`).toBe(false);
+};
+
+describe('placeholder collision', () => {
+ it('keeps the plain §7.4 placeholder when the secret cannot appear in it', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('sudo-password', 'hunter2-TEST');
+
+ expect(redactor.redact('hunter2-TEST')).toBe('«secret:sudo-password»');
+ expect(redactor.redact('my hunter2-TEST here')).toBe('my «secret:sudo-password» here');
+ });
+
+ it('[ASC-L3-09] does not let a secret survive through the `secret` in its placeholder', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('x', 'secret');
+
+ const out = redactor.redact('x secret and secret');
+ expectNoVariant(out, secretVariants('secret'));
+ expect(out).toContain('«');
+ });
+
+ it('[ASC-L3-09] does not let a secret survive through its own label', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('password', 'password');
+
+ expectNoVariant(redactor.redact('password'), secretVariants('password'));
+ });
+
+ it('[ASC-L3-09] covers the streaming redactor too', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('x', 'secret');
+ const stream = createStreamingRedactor(redactor);
+
+ let out = '';
+ for (const char of 'the secret is secret') out += stream.push(char);
+ out += stream.flush();
+
+ expectNoVariant(out, secretVariants('secret'));
+ });
+
+ it('[ASC-L3-09] does not let a placeholder compose a secret with its neighbours', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('boundary', '»abcdef');
+ redactor.add('source', 'WXYZ');
+ const variants = [...secretVariants('»abcdef'), ...secretVariants('WXYZ')];
+
+ // The plain `«secret:source»` would end in `»`, and the `abcdef` that follows it off the end of
+ // the match would complete the registered variant `»abcdef`.
+ expectNoVariant(redactor.redact('WXYZabcdef'), variants);
+
+ const stream = createStreamingRedactor(redactor);
+ let streamed = '';
+ for (const char of 'WXYZabcdef') streamed += stream.push(char);
+ streamed += stream.flush();
+ expectNoVariant(streamed, variants);
+ });
+
+ it('escapes only the placeholders that collide', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('password', 'password');
+ redactor.add('fine', 'hunter2-TEST');
+
+ expect(redactor.redact('hunter2-TEST')).toBe('«secret:fine»');
+ expectNoVariant(redactor.redact('password'), secretVariants('password'));
+ });
+});
diff --git a/packages/secret-channel/test/redaction-stream.test.ts b/packages/secret-channel/test/redaction-stream.test.ts
new file mode 100644
index 00000000000..89f61a524ff
--- /dev/null
+++ b/packages/secret-channel/test/redaction-stream.test.ts
@@ -0,0 +1,112 @@
+import { describe, expect, it } from 'vitest';
+
+import { createSecretRedactor, createStreamingRedactor, secretVariants } from '../src';
+
+describe('streaming redaction', () => {
+ it('keeps a longer variant whole when a shorter one is its prefix', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('short', 'abcd');
+ redactor.add('long', 'abcdef');
+ const stream = createStreamingRedactor(redactor);
+
+ expect(stream.push('abcd')).toBe('');
+ expect(stream.push('ef')).toBe('«secret:long»');
+ expect(stream.flush()).toBe('');
+ });
+
+ it('redacts a secret split across arbitrary chunk boundaries', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('token', 'sk-test-TOKEN');
+ const stream = createStreamingRedactor(redactor);
+
+ let out = '';
+ for (const char of 'x sk-test-TOKEN y') out += stream.push(char);
+ out += stream.flush();
+
+ expect(out).toBe('x «secret:token» y');
+ });
+
+ it('holds a variant back until the stream ends instead of emitting its prefix', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('token', 'sk-test-TOKEN');
+ const stream = createStreamingRedactor(redactor);
+
+ expect(stream.push('sk-test-')).toBe('');
+ expect(stream.push('TOKEN')).toBe('«secret:token»');
+ expect(stream.flush()).toBe('');
+ });
+
+ it('never emits a completed match that overlaps a trailing prefix', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('long', 'abcdef');
+ redactor.add('short', 'efgh');
+ const stream = createStreamingRedactor(redactor);
+
+ // `efg` is a proper prefix of `efgh`, but `abcdef` is already complete at offset 6. Redacting
+ // it whole must not leave `abcd` behind for the next chunk to extend into `abcdefgX`.
+ expect(stream.push('abcdefg')).toBe('«secret:long»g');
+ expect(stream.push('X')).toBe('X');
+ expect(stream.flush()).toBe('');
+ });
+
+ it('redacts a self-overlapping variant as soon as it completes', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('repeat', 'aaaa');
+ const stream = createStreamingRedactor(redactor);
+
+ // `aaa` is a proper prefix of `aaaa`, so it is carried; the fourth `a` completes a match and is
+ // redacted at once, keeping the carry (never the whole stream) bounded.
+ expect(stream.push('aaa')).toBe('');
+ expect(stream.push('a')).toBe('«secret:repeat»');
+ expect(stream.push('a')).toBe('');
+ expect(stream.push('aaa')).toBe('«secret:repeat»');
+ expect(stream.flush()).toBe('');
+ });
+
+ it('matches a whole-buffer redaction for every chunk split', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('long', 'abcdef');
+ redactor.add('short', 'efgh');
+ const text = 'abcdefgh and abcdef and efgh and abcdefgX';
+ const expected = redactor.redact(text);
+
+ for (let split = 0; split <= text.length; split++) {
+ const stream = createStreamingRedactor(redactor);
+ const out =
+ stream.push(text.slice(0, split)) + stream.push(text.slice(split)) + stream.flush();
+ expect(out, `split at ${split}`).toBe(expected);
+ }
+ });
+
+ it('never re-emits a registered variant, whatever the chunking', () => {
+ const values = ['aaaa', 'aaab', 'abab'];
+ const redactor = createSecretRedactor();
+ for (const value of values) redactor.add('s', value);
+ const variants = values.flatMap(secretVariants);
+
+ const expectNoLeak = (out: string, label: string) => {
+ for (const variant of variants)
+ expect(out.includes(variant), `${label} leaked ${variant}`).toBe(false);
+ };
+
+ const text = 'aaabaaaaaab abab aaaa aaab aabababaaa';
+ for (let split = 0; split <= text.length; split++) {
+ const stream = createStreamingRedactor(redactor);
+ expectNoLeak(
+ stream.push(text.slice(0, split)) + stream.push(text.slice(split)) + stream.flush(),
+ `split ${split}`,
+ );
+ }
+
+ let seed = 1;
+ const next = () => (seed = (seed * 48271) % 2147483647);
+ for (let round = 0; round < 200; round++) {
+ const stream = createStreamingRedactor(redactor);
+ let out = '';
+ for (let i = 0, chunks = next() % 50; i < chunks; i++)
+ out += stream.push('ab'[next() % 2] + 'ab'[next() % 2] + 'ab'[next() % 2]);
+ out += stream.flush();
+ expectNoLeak(out, `round ${round}`);
+ }
+ });
+});
diff --git a/packages/secret-channel/test/vectors.test.ts b/packages/secret-channel/test/vectors.test.ts
new file mode 100644
index 00000000000..bd340434e14
--- /dev/null
+++ b/packages/secret-channel/test/vectors.test.ts
@@ -0,0 +1,196 @@
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+import { describe, expect, it } from 'vitest';
+
+import {
+ EphemeralRecipient,
+ createSecretRedactor,
+ encodeFields,
+ encodeRequestAad,
+ formatSecretPlaceholder,
+ fromHex,
+ hashArgv,
+ hashDisplay,
+ clientKeyFromIkm,
+ isAscError,
+ isVerifierChecked,
+ pairedClientsFrom,
+ sanitizeSecretLabel,
+ sealSecret,
+ secretVariants,
+ toHex,
+ unframePlaintext,
+ utf8Decode,
+ verifyRequest,
+} from '../src';
+
+const load = (name: string) =>
+ JSON.parse(readFileSync(join(__dirname, 'vectors', name), 'utf8'));
+
+const codeOf = async (fn: () => unknown) => {
+ try {
+ await fn();
+ return null;
+ } catch (error) {
+ if (isAscError(error)) return error.code;
+ throw error;
+ }
+};
+
+describe('encoding.json', () => {
+ const v = load('encoding.json');
+ it('encodes fields', () => {
+ for (const c of v.encodeFields) expect(toHex(encodeFields(c.fields))).toBe(c.hex);
+ });
+ it('hashes argv', () => {
+ for (const c of v.argvHash) expect(hashArgv(c.argv)).toBe(c.argvHash);
+ });
+});
+
+describe('aad.json / identity.json', () => {
+ const a = load('aad.json');
+ const id = load('identity.json');
+ it('reproduces displayHash and the canonical AAD', () => {
+ expect(hashDisplay(a.request)).toBe(a.displayHash);
+ expect(toHex(encodeRequestAad(a.request))).toBe(a.aadHex);
+ });
+ it('verifies the signature under the pinned fingerprint', () => {
+ expect(() => verifyRequest(a.request, { pinnedFingerprint: id.identityKeyFp })).not.toThrow();
+ expect(a.request.executor.sig).toBe(id.sig);
+ });
+});
+
+describe('hpke.json', () => {
+ const v = load('hpke.json');
+ for (const c of v.cases) {
+ it(`seals deterministically and opens: ${c.name}`, async () => {
+ const recipient = await EphemeralRecipient.create(fromHex(c.ikmR.hex));
+ expect(recipient.publicKey).toBe(c.ephPub);
+ const envelope = await sealSecret({
+ deterministicIkmE: fromHex(c.ikmE.hex),
+ now: c.request.createdAt,
+ request: c.request,
+ secret: fromHex(c.secretHex),
+ });
+ expect(envelope).toEqual(c.envelope);
+ expect(utf8Decode(await recipient.open(c.request, c.envelope, c.openAt))).toBe(c.secretUtf8);
+ });
+ }
+});
+
+describe('negative.json', () => {
+ const v = load('negative.json');
+ const fresh = () => EphemeralRecipient.create(fromHex(v.ikmR.hex));
+
+ it('rejects every AAD tampering on both sides', async () => {
+ for (const c of v.aadTampering) {
+ expect(await codeOf(() => verifyRequest(c.tamperedRequest)), c.name).toBe(c.expectedVerifyError);
+ const r = await fresh();
+ expect(await codeOf(() => r.open(c.tamperedRequest, v.baseEnvelope, v.openAt)), c.name).toBe(c.expectedOpenError);
+ expect(c.expectedOpenError).not.toBeNull();
+ }
+ });
+
+ it('rejects envelope tampering', async () => {
+ for (const c of v.envelopeTampering) {
+ const r = await fresh();
+ expect(await codeOf(() => r.open(v.baseRequest, c.envelope, c.openAt)), c.name).toBe(c.expectedOpenError);
+ }
+ });
+
+ it('enforces single use (fail closed)', async () => {
+ const r = await fresh();
+ expect(await codeOf(() => r.open(v.baseRequest, v.envelopeTampering[0].envelope, v.openAt))).toBe('DECRYPT_FAILED');
+ expect(await codeOf(() => r.open(v.baseRequest, v.baseEnvelope, v.openAt))).toBe('REPLAYED');
+ });
+
+ it('checks identity and pinning', async () => {
+ for (const c of v.identity)
+ expect(await codeOf(() => verifyRequest(c.request, { pinnedFingerprint: c.pinnedFingerprint })), c.name).toBe(c.expectedVerifyError);
+ });
+});
+
+describe('framing.json', () => {
+ const v = load('framing.json');
+ it('rejects invalid frames', async () => {
+ for (const c of v.invalid) expect(await codeOf(() => unframePlaintext(fromHex(c.framedHex))), c.name).toBe(c.expectedError);
+ });
+});
+
+describe('sender-auth.json', () => {
+ const v = load('sender-auth.json');
+ const paired = pairedClientsFrom([v.clientKey.publicKey]);
+
+ it('derives the Client key and classifies Requests', async () => {
+ const key = await clientKeyFromIkm(fromHex(v.clientKey.ikmS.hex));
+ expect(key.publicKey).toBe(v.clientKey.publicKey);
+ expect(toHex(key.privateKey)).toBe(v.clientKey.skSHex);
+ for (const c of v.classification)
+ expect(isVerifierChecked(c.kind, c.targetKind, { setsNewSecret: c.setsNewSecret }) ? 'verifier-checked' : 'value-accepting', `${c.kind}/${c.targetKind}`).toBe(c.class);
+ });
+
+ it('seals in Auth mode deterministically and opens only with the paired Client key', async () => {
+ const sender = await clientKeyFromIkm(fromHex(v.clientKey.ikmS.hex));
+ for (const c of v.positive) {
+ const envelope = await sealSecret({ deterministicIkmE: fromHex(c.ikmE.hex), now: c.request.createdAt, request: c.request, secret: new TextEncoder().encode(c.secretUtf8), sender });
+ expect(envelope, c.name).toEqual(c.envelope);
+ const r = await EphemeralRecipient.create(fromHex(c.ikmR.hex));
+ expect(utf8Decode(await r.open(c.request, c.envelope, c.openAt, paired)), c.name).toBe(c.secretUtf8);
+ }
+ });
+
+ it('rejects every Relay-sealed value for a value-accepting Request', async () => {
+ const p0 = v.positive[0];
+ for (const c of v.relayInjection) {
+ const r = await EphemeralRecipient.create(fromHex(p0.ikmR.hex));
+ expect(await codeOf(() => r.open(p0.request, c.envelope, p0.openAt, pairedClientsFrom(c.pairedClients))), c.name).toBe(c.expectedOpenError);
+ expect(c.expectedOpenError).not.toBeNull();
+ expect(r.state !== 'pending', c.name).toBe(c.consumesKey);
+ }
+ });
+
+ it('keeps the documented Base-suite residual for verifier-checked Requests', async () => {
+ const c = v.baseSuiteResidual;
+ const r = await EphemeralRecipient.create(fromHex(c.ikmR.hex));
+ expect(utf8Decode(await r.open(c.request, c.envelope, c.openAt))).toBe(v.relayValueUtf8);
+ });
+});
+
+describe('redaction.json', () => {
+ const v = load('redaction.json');
+
+ it('sanitizes labels into placeholders', () => {
+ for (const c of v.placeholders) {
+ expect(sanitizeSecretLabel(c.label)).toBe(c.sanitized);
+ expect(formatSecretPlaceholder(c.label)).toBe(c.placeholder);
+ }
+ });
+
+ it('registers exactly the representations secretVariants() reports', () => {
+ for (const c of v.variants) {
+ const redactor = createSecretRedactor();
+ redactor.add('test', c.value);
+ expect(redactor.size, JSON.stringify(c.value)).toBe(secretVariants(c.value).length);
+ }
+ });
+
+ it('registers every encoded variant of a secret for redaction', () => {
+ for (const c of v.variants) {
+ const redactor = createSecretRedactor();
+ redactor.add('test', c.value);
+ for (const variant of c.variants) {
+ expect(redactor.redact(`out ${variant} end`), `${JSON.stringify(c.value)} → ${variant}`).toBe(
+ 'out «secret:test» end',
+ );
+ }
+ }
+ });
+
+ it('still registers the encodings of a secret shorter than the minimum length', () => {
+ const redactor = createSecretRedactor();
+ redactor.add('short', 'abc');
+
+ expect(redactor.redact('YWJj and 616263')).toBe('«secret:short» and «secret:short»');
+ });
+});
diff --git a/packages/secret-channel/test/vectors/aad.json b/packages/secret-channel/test/vectors/aad.json
new file mode 100644
index 00000000000..1552930d556
--- /dev/null
+++ b/packages/secret-channel/test/vectors/aad.json
@@ -0,0 +1,119 @@
+{
+ "description": "Canonical AAD (spec §6.4): encodeFields of 14 fields in fixed order. displayHash (spec §6.4.3) = base64url(SHA-256(encodeFields([argvDisplay, promptText or \"\", verification, systemObserved, executorName, label]))). purpose.agentClaim is intentionally NOT bound.",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "magic": "asc/v1/aad",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "displayHashPreimageHex": "0000000600000029696e7374616c6c6572202d706b67206578616d706c652d544553542e706b67202d746172676574202f0000000950617373776f72643a0000000876657269666965640000002f7375646f3a20696e7374616c6c6572202d706b67206578616d706c652d544553542e706b67202d746172676574202f0000000b54657374204c6170746f700000000d7375646f2d70617373776f7264",
+ "displayHash": "tPyUmVaDjGe3wiGPJoxn-EivemiYsgDU6i9Nh_6y9JE",
+ "fields": [
+ {
+ "index": 0,
+ "name": "magic",
+ "value": "asc/v1/aad"
+ },
+ {
+ "index": 1,
+ "name": "v",
+ "value": "1"
+ },
+ {
+ "index": 2,
+ "name": "suite",
+ "value": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM"
+ },
+ {
+ "index": 3,
+ "name": "requestId",
+ "value": "AAECAwQFBgcICQoLDA0ODw"
+ },
+ {
+ "index": 4,
+ "name": "runId",
+ "value": "run-TEST-0001"
+ },
+ {
+ "index": 5,
+ "name": "executorId",
+ "value": "exec-TEST-0001"
+ },
+ {
+ "index": 6,
+ "name": "identityKeyFp",
+ "value": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo"
+ },
+ {
+ "index": 7,
+ "name": "ephPub",
+ "value": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ"
+ },
+ {
+ "index": 8,
+ "name": "targetKind",
+ "value": "sudo"
+ },
+ {
+ "index": 9,
+ "name": "exePath",
+ "value": "/usr/bin/sudo"
+ },
+ {
+ "index": 10,
+ "name": "argvHash",
+ "value": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ"
+ },
+ {
+ "index": 11,
+ "name": "kind",
+ "value": "password"
+ },
+ {
+ "index": 12,
+ "name": "displayHash",
+ "value": "tPyUmVaDjGe3wiGPJoxn-EivemiYsgDU6i9Nh_6y9JE"
+ },
+ {
+ "index": 13,
+ "name": "expiresAt",
+ "value": "1790000300000"
+ }
+ ],
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "aadSha256Hex": "b10530b9fba231c08947946865c5e392a4264a9cc6193f707b4934d2e3fcdeab",
+ "promptTextAbsent": {
+ "note": "target.promptText absent encodes as the empty string",
+ "displayHash": "8grwvzsgPxHZT8tpacD8v9orvPrPo7LPIP9pIpkVEJI",
+ "equalsEmptyString": true
+ }
+}
diff --git a/packages/secret-channel/test/vectors/encoding.json b/packages/secret-channel/test/vectors/encoding.json
new file mode 100644
index 00000000000..604ecd6f451
--- /dev/null
+++ b/packages/secret-channel/test/vectors/encoding.json
@@ -0,0 +1,103 @@
+{
+ "description": "ASC length-prefixed field encoding (spec §6.4.0) and argvHash (spec §6.4.2). encodeFields(f) = u32be(n) || for each field: u32be(len(UTF-8(field))) || UTF-8(field).",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "encodeFields": [
+ {
+ "fields": [],
+ "hex": "00000000"
+ },
+ {
+ "fields": [
+ ""
+ ],
+ "hex": "0000000100000000"
+ },
+ {
+ "fields": [
+ "a"
+ ],
+ "hex": "000000010000000161"
+ },
+ {
+ "fields": [
+ "a",
+ "b"
+ ],
+ "hex": "0000000200000001610000000162"
+ },
+ {
+ "fields": [
+ "a b"
+ ],
+ "hex": "0000000100000003612062"
+ },
+ {
+ "fields": [
+ "ab",
+ ""
+ ],
+ "hex": "0000000200000002616200000000"
+ },
+ {
+ "fields": [
+ "",
+ "ab"
+ ],
+ "hex": "0000000200000000000000026162"
+ },
+ {
+ "fields": [
+ "pässwörd",
+ "密码"
+ ],
+ "hex": "000000020000000a70c3a4737377c3b6726400000006e5af86e7a081"
+ }
+ ],
+ "argvHash": [
+ {
+ "argv": [
+ "/usr/bin/sudo",
+ "-A",
+ "-k",
+ "installer",
+ "-pkg",
+ "example-TEST.pkg",
+ "-target",
+ "/"
+ ],
+ "note": "reference sudo argv",
+ "preimageHex": "000000080000000d2f7573722f62696e2f7375646f000000022d41000000022d6b00000009696e7374616c6c6572000000042d706b67000000106578616d706c652d544553542e706b67000000072d746172676574000000012f",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ"
+ },
+ {
+ "argv": [
+ "echo",
+ "a b"
+ ],
+ "note": "one argument containing a space",
+ "preimageHex": "00000002000000046563686f00000003612062",
+ "argvHash": "fTSmhUppJUAAJRcZEj6HwBr6Z4gqYGwqupxlz7yI9_U"
+ },
+ {
+ "argv": [
+ "echo",
+ "a",
+ "b"
+ ],
+ "note": "two arguments; MUST differ from the previous case",
+ "preimageHex": "00000003000000046563686f00000001610000000162",
+ "argvHash": "1Q_bLVDSz5zv4yxHH4jbCXRtjS4ZBL3SfJuiwWJMpYo"
+ },
+ {
+ "argv": [
+ "git",
+ "push",
+ "origin",
+ "main"
+ ],
+ "note": "git",
+ "preimageHex": "00000004000000036769740000000470757368000000066f726967696e000000046d61696e",
+ "argvHash": "3DxLZ-MPrB9OleIj1aQ9iqSQAnk5HepWkVnDXKnVbdA"
+ }
+ ]
+}
diff --git a/packages/secret-channel/test/vectors/framing.json b/packages/secret-channel/test/vectors/framing.json
new file mode 100644
index 00000000000..3917701fb2a
--- /dev/null
+++ b/packages/secret-channel/test/vectors/framing.json
@@ -0,0 +1,88 @@
+{
+ "description": "Plaintext framing (spec §6.6): 0x01 || u16be(len) || secret || 0x00 padding to a multiple of 256 bytes; 1 <= len <= 4093.",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "valid": [
+ {
+ "secretLength": 1,
+ "secretHex": "54",
+ "framedLength": 256,
+ "framedHeaderHex": "010001"
+ },
+ {
+ "secretLength": 4,
+ "secretHex": "54545454",
+ "framedLength": 256,
+ "framedHeaderHex": "010004"
+ },
+ {
+ "secretLength": 253,
+ "secretHex": "54545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedLength": 256,
+ "framedHeaderHex": "0100fd"
+ },
+ {
+ "secretLength": 254,
+ "secretHex": "5454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedLength": 512,
+ "framedHeaderHex": "0100fe"
+ },
+ {
+ "secretLength": 509,
+ "secretHex": "5454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedLength": 512,
+ "framedHeaderHex": "0101fd"
+ },
+ {
+ "secretLength": 510,
+ "secretHex": "545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedLength": 768,
+ "framedHeaderHex": "0101fe"
+ },
+ {
+ "secretLength": 4093,
+ "secretHex": "54545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedLength": 4096,
+ "framedHeaderHex": "010ffd"
+ }
+ ],
+ "tooLarge": {
+ "secretLength": 4094,
+ "expectedError": "SECRET_TOO_LARGE"
+ },
+ "empty": {
+ "secretLength": 0,
+ "expectedError": "INVALID_REQUEST"
+ },
+ "invalid": [
+ {
+ "name": "unsupported-frame-version",
+ "note": "first byte is not 0x01",
+ "framedHex": "02000454455354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "expectedError": "UNSUPPORTED_VERSION"
+ },
+ {
+ "name": "non-zero-padding",
+ "note": "padding byte is not zero",
+ "framedHex": "01000454455354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+ "expectedError": "INVALID_ENVELOPE"
+ },
+ {
+ "name": "zero-length",
+ "note": "declared length 0",
+ "framedHex": "01000054455354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "expectedError": "INVALID_ENVELOPE"
+ },
+ {
+ "name": "length-overflows-frame",
+ "note": "declared length 256 > 253 available bytes",
+ "framedHex": "01010054455354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "expectedError": "INVALID_ENVELOPE"
+ },
+ {
+ "name": "not-block-multiple",
+ "note": "255 bytes is not a multiple of 256",
+ "framedHex": "010004544553540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "expectedError": "INVALID_ENVELOPE"
+ }
+ ]
+}
diff --git a/packages/secret-channel/test/vectors/hpke.json b/packages/secret-channel/test/vectors/hpke.json
new file mode 100644
index 00000000000..93abf489be0
--- /dev/null
+++ b/packages/secret-channel/test/vectors/hpke.json
@@ -0,0 +1,262 @@
+{
+ "description": "HPKE (RFC 9180) Base mode seal/open (spec §6.1, §6.6, §6.8). Recipient key = DeriveKeyPair(ikmR); sender ephemeral key = DeriveKeyPair(ikmE) as in RFC 9180 Appendix A. info = UTF-8(hpkeInfo); aad = canonical AAD of the case request; pt = framed plaintext. Deterministic ikm is for vectors only: real implementations MUST draw keys from a CSPRNG.",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "suiteIds": {
+ "mode": 0,
+ "kem": 32,
+ "kdf": 1,
+ "aead": 2
+ },
+ "hpkeInfo": "asc/v1/hpke-info",
+ "cases": [
+ {
+ "name": "ascii",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmR #1\"))",
+ "hex": "b72ee6e87e3db2399fb0552d66a1b8a76f254504afec39fa0dafaa3dea6a2e72"
+ },
+ "skRHex": "e7d03bfed0f98a691fd21d2ae61163718a6d084809f55ebc4f1d0aacf6010a2d",
+ "pkRHex": "1bf6e0639fad4570cb95beead75be119eda39491c645e0c1d01f4d30d268c624",
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmE #1\"))",
+ "hex": "9a764e92e329a72505c51f35b115938843477c92842f3f0116a98a611913c753"
+ },
+ "secretUtf8": "correct-horse-battery-staple-TEST-ONLY",
+ "secretHex": "636f72726563742d686f7273652d626174746572792d737461706c652d544553542d4f4e4c59",
+ "framedPlaintextHex": "010026636f72726563742d686f7273652d626174746572792d737461706c652d544553542d4f4e4c590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "infoHex": "6173632f76312f68706b652d696e666f",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "encHex": "cf18d42dd212b4c0c8bc22ed701fb58bb4be0ca9bdf3deb55891b4011fb84b6e",
+ "ctHex": "a3f347d3132dba6293275f0085ae9b0ab13d1f02686a448588ed536bb4fb4591244c6e5357d858499795660241a31f42752750455dbc437436ab337abf08edd32d93296e7b60b33cea0e880d67a00342b2ca4122afb51a1a62ba0cdb2e750ed2da64337ac931f1e9f20a7bb520db6cb9c59a14e9873ddb8fbeaf37793b0896ee60e2de7d027b91c6f307725a45f144a949b6940cf2c15610589b61bbf7dc54674c5ba50907c169c8f84e449467068a9c8ea0b2e5895ab008034516932f4fd58a8bc9f877af3bcf0b404e8636830d4eab7e9b29c283563afe24af5cdde15c4ec435b0131a52a5aa2aeed97a579088bc97e40ee6f7f3c6c1cab6c520644a3dca835c1846bbf6f85ed2e8657a7d4342a0ae",
+ "openAt": 1790000001000
+ },
+ {
+ "name": "non-ascii",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmR #2\"))",
+ "hex": "49e83db87986b165ff656cb9696f729ca08b0529c8e3e5e0c9b202eb1bf64921"
+ },
+ "skRHex": "08b6a342636210a5cd0f91c91301fbecb4f4ee0ea3cd647c00e1c09118620135",
+ "pkRHex": "4805d12cc20abe884303facb912722f1e16748523f22b43858be52122f61f00b",
+ "ephPub": "SAXRLMIKvohDA_rLkSci8eFnSFI_IrQ4WL5SEi9h8As",
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmE #2\"))",
+ "hex": "62416b9e6c18ff44e9051d58c18fce36158d9bb4e07eebc8a330e46c83da87f8"
+ },
+ "secretUtf8": "pässwörd-TEST-密码-🔑",
+ "secretHex": "70c3a4737377c3b672642d544553542de5af86e7a0812df09f9491",
+ "framedPlaintextHex": "01001b70c3a4737377c3b672642d544553542de5af86e7a0812df09f949100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "infoHex": "6173632f76312f68706b652d696e666f",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "SAXRLMIKvohDA_rLkSci8eFnSFI_IrQ4WL5SEi9h8As",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "tRozOXYLFHl-kiKI-DJ6-pMFuDtQJV48sZx9b_BRzWLxJWsialUQ56GgN8cHk1Y_yUwQlk_RwRXevaHnoez0Dg"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b534158524c4d494b766f6844415f724c6b5363693865466e5346495f49725134574c355345693968384173000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "envelope": {
+ "ct": "XfJ8-K4Q3AtzAZoin8_X859P-lDb3Ka-_yeSCM-z2vld1CfhUzeVstL8IkVK-eTslWPHN0HGVLqEmHaEIG2d0iAWc4NdEX5fp0nfaVW5qyKDa47i5PmrKlgoVJWPp_4MSjTo7l33PKC0oWfiEMP0z4YHyyB7rImnN0LYENRNlB7KL4su2KK1Tvcw0YEf7IxEat2llYYTTN1bPdRuEuKjHm2I-AV8RdqESXGQDlEHi0t6lMVPLVIRzWDGy82dWezCyf2CkXfJ4W_ZRk4-ZXNZYq9xPxRbYvaf0fnSstZYHvndhtlOwiSXuiTqg4xRynVAyQPtX10DITVc7va1Gp45fEPdqOiJDY_dObNBXHeoLD8",
+ "enc": "SwrBZwqAy_9j9o6j7AjHMok55Q0fuVtgrEq7oO6CHX4",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "encHex": "4b0ac1670a80cbff63f68ea3ec08c7328939e50d1fb95b60ac4abba0ee821d7e",
+ "ctHex": "5df27cf8ae10dc0b73019a229fcfd7f39f4ffa50dbdca6beff279208cfb3daf95dd427e1533795b2d2fc22454af9e4ec9563c73741c654ba84987684206d9dd2201673835d117e5fa749df6955b9ab22836b8ee2e4f9ab2a582854958fa7fe0c4a34e8ee5df73ca0b4a167e210c3f4cf8607cb207bac89a73742d810d44d941eca2f8b2ed8a2b54ef730d1811fec8c446adda59586134cdd5b3dd46e12e2a31e6d88f8057c45da844971900e51078b4b7a94c54f2d5211cd60c6cbcd9d59ecc2c9fd829177c9e16fd9464e3e65735962af713f145b62f69fd1f9d2b2d6581ef9dd86d94ec22497ba24ea838c51ca7540c903ed5f5d0321355ceef6b51a9e397c43dda8e8890d8fdd39b3415c77a82c3f",
+ "openAt": 1790000001000
+ },
+ {
+ "name": "one-block-max",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmR #3\"))",
+ "hex": "9739cacece0a43a999b28b1ea9e174be7c91c4a826a89d5a28e7ecde07ac7e30"
+ },
+ "skRHex": "7212287194da4de6f8989232f0399ed92388be0019bc448f6fb3ef47a088919d",
+ "pkRHex": "05c94b983479c09cfbc1a341d31b7df8ca11ca2cecc7b8038f809d44797c090c",
+ "ephPub": "BclLmDR5wJz7waNB0xt9-MoRyizsx7gDj4CdRHl8CQw",
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmE #3\"))",
+ "hex": "c488f081f678accd2e70ea2559d2b06d84677d89d6c515db0968c3802096ace9"
+ },
+ "secretUtf8": "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT",
+ "secretHex": "54545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedPlaintextHex": "0100fd54545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "infoHex": "6173632f76312f68706b652d696e666f",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "BclLmDR5wJz7waNB0xt9-MoRyizsx7gDj4CdRHl8CQw",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "tfyoX1iLEG7gpuJ7LgSYzrx85xlP7EcvPz_hydpTH3MDbm-CkPEloEYjykJPZB-XRyzTgMs12ZgJS0e9FNkJCg"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b42636c4c6d445235774a7a3777614e42307874392d4d6f5279697a73783767446a34436452486c38435177000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "envelope": {
+ "ct": "6Zn3IRPgwxmYrNc0ATRH68iLM4CLompV3UekBCS2yJpPbi0g1gth6rX_czfGAzYdJZk7tl3sXmI9lxNn3nB9wHpeYZwHVpZzMGtbKBXda4WXdkTPjBTn62UTW7MFsOYSbucSSTWrFuKrtcCp_V7WIg-CTySMAo6lfeR76W1Kinoh2FCFZaM5vWy9tiXlkfvTQ4qL26moa1bucow9Ra_CZQ_Vr5TXI7tjYY_Xl6qYOEugJKks6H7ctFiQ2BRbDGBsiYjhNCxldg5VktXMnSt9HPSiuys1wxNJYytQn3Bph69hiYn7eod9IxMeC3VOxe_spZWI1f544Qe0KZuHG87vStgfz8rouNMNMF76AVJNaoU",
+ "enc": "4KeW9sI1KRCyGlMXVW1K49zS1p0fp5y_jvoxva6-8yQ",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "encHex": "e0a796f6c2352910b21a5317556d4ae3dcd2d69d1fa79cbf8efa31bdaebef324",
+ "ctHex": "e999f72113e0c31998acd734013447ebc88b33808ba26a55dd47a40424b6c89a4f6e2d20d60b61eab5ff7337c603361d25993bb65dec5e623d971367de707dc07a5e619c07569673306b5b2815dd6b85977644cf8c14e7eb65135bb305b0e6126ee7124935ab16e2abb5c0a9fd5ed6220f824f248c028ea57de47be96d4a8a7a21d8508565a339bd6cbdb625e591fbd3438a8bdba9a86b56ee728c3d45afc2650fd5af94d723bb63618fd797aa98384ba024a92ce87edcb45890d8145b0c606c8988e1342c65760e5592d5cc9d2b7d1cf4a2bb2b35c31349632b509f706987af618989fb7a877d23131e0b754ec5efeca59588d5fe78e107b4299b871bceef4ad81fcfcae8b8d30d305efa01524d6a85",
+ "openAt": 1790000001000
+ },
+ {
+ "name": "two-blocks-min",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmR #4\"))",
+ "hex": "b839521e67699770ba25d905d2115f0d662a61562528e2142fa05126e4aa09ab"
+ },
+ "skRHex": "74d7d5328dc6f25969731efa14c2715adb5bdcc4e7a281bdd81b28d4c0ab3514",
+ "pkRHex": "d2ce85279f93ca27c6ba33c9b8d0d4eff2f7b4187c0036671deb22b9d8a4346d",
+ "ephPub": "0s6FJ5-TyifGujPJuNDU7_L3tBh8ADZnHesiudikNG0",
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmE #4\"))",
+ "hex": "e9ae53ad99b30691865d99c9b833c806ac283e140145960a192cc90e23091254"
+ },
+ "secretUtf8": "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT",
+ "secretHex": "5454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454",
+ "framedPlaintextHex": "0100fe5454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "infoHex": "6173632f76312f68706b652d696e666f",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "0s6FJ5-TyifGujPJuNDU7_L3tBh8ADZnHesiudikNG0",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "6ISbFfSRPZRsc1ZRXL2MMh7UTk4l96aV2_xZGSeY6SrdoQGDIg2-limbyLIh5S211zkzBuwGyOJL08AUm3NhCQ"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b307336464a352d5479696647756a504a754e4455375f4c337442683841445a6e486573697564696b4e4730000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "envelope": {
+ "ct": "DqXn8kLBfsgc75VAEzcMj_p4BDNfHvsEj7ifqdmKdGTyk3ot2LWVfTCK-gyedhtBSkBWUxdmaiKIRnPOAtYt7HEochqPa7juNlh_oblVCWI6dNzUCCjv8cUPI0vlAw49YtZQKxms2yP6HnIJG7vCnl5sEy6Sd2lgO9hdBBxq6W25Oe3F6uzTn5JVoZqQzReLHsWl-NwEm7BMAcndNXLK2ktVwIbu5-3j1QxtvO4Yid70PK633l0LliJY7ItylmtbJgMsG30vmMX73yLenepSBoyMYcCHpd56-9Vb7oq1lNlM_SI0VTHjLfAH6XNRXOkSb-DIAJZk9tfTawyj-sX98xRCU6q21kTkH1lfqVnqqeicy2hczvHPq7Ikc3JotRfpyzR34IRNjNB_t3z6ESWLd8KKKS9fGRnQkJM6kn_-dJNxVIJ-T7xU91HTd3Gj8IQHnMJVi0F9_9KFZh7DE4ldQwSocf8VJaJ614KN1Hg84VqdODfo8r4H9tVF5pqiii_Xr3zY0MtdMeo5GzvhLP0cvFiFKIa94JkCxQHkHFCteho9JK92dATD5o2aSVILuxCgyBB_5aOFM1Bm-nO3wBcxTiUl2QgD_86MBDIGrWoWmhs-8cibLph_P4EtOoPBMNOYRd07atyxrunEP-nSutdZAT50wewHPBvqZVt6UlgbHrpXzd2zdvpoZy-2zRNZ7oFb",
+ "enc": "TReu8gxRRHr2_X9e6dfgY82YG9dCf6kt9aCXJzGxWmM",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "encHex": "4d17aef20c51447af6fd7f5ee9d7e063cd981bd7427fa92df5a0972731b15a63",
+ "ctHex": "0ea5e7f242c17ec81cef954013370c8ffa7804335f1efb048fb89fa9d98a7464f2937a2dd8b5957d308afa0c9e761b414a40565317666a22884673ce02d62dec7128721a8f6bb8ee36587fa1b95509623a74dcd40828eff1c50f234be5030e3d62d6502b19acdb23fa1e72091bbbc29e5e6c132e927769603bd85d041c6ae96db939edc5eaecd39f9255a19a90cd178b1ec5a5f8dc049bb04c01c9dd3572cada4b55c086eee7ede3d50c6dbcee1889def43caeb7de5d0b962258ec8b72966b5b26032c1b7d2f98c5fbdf22de9dea52068c8c61c087a5de7afbd55bee8ab594d94cfd22345531e32df007e973515ce9126fe0c8009664f6d7d36b0ca3fac5fdf3144253aab6d644e41f595fa959eaa9e89ccb685ccef1cfabb224737268b517e9cb3477e0844d8cd07fb77cfa11258b77c28a292f5f1919d090933a927ffe74937154827e4fbc54f751d37771a3f084079cc2558b417dffd285661ec313895d4304a871ff1525a27ad7828dd4783ce15a9d3837e8f2be07f6d545e69aa28a2fd7af7cd8d0cb5d31ea391b3be12cfd1cbc58852886bde09902c501e41c50ad7a1a3d24af767404c3e68d9a49520bbb10a0c8107fe5a385335066fa73b7c017314e2525d90803ffce8c043206ad6a169a1b3ef1c89b2e987f3f812d3a83c130d39845dd3b6adcb1aee9c43fe9d2bad759013e74c1ec073c1bea655b7a52581b1eba57cdddb376fa68672fb6cd1359ee815b",
+ "openAt": 1790000001000
+ }
+ ]
+}
diff --git a/packages/secret-channel/test/vectors/identity.json b/packages/secret-channel/test/vectors/identity.json
new file mode 100644
index 00000000000..237a18e666f
--- /dev/null
+++ b/packages/secret-channel/test/vectors/identity.json
@@ -0,0 +1,17 @@
+{
+ "description": "Executor long-term Ed25519 identity (RFC 8032), fingerprint and request signature (spec §6.2, §6.3, §6.5). The signed message is UTF-8(signatureContext) || AAD, where AAD is the canonical AAD of aad.json.",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "signatureContext": "asc/v1/request-sig",
+ "identitySeed": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: executor identity seed #1\"))",
+ "hex": "3ad4dada076f1a5c36ecfba6e2c138822831c98305e36bff71a7fb381afd0d16"
+ },
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "identityPublicKeyHex": "7d29d793e4d9fc3841e73c878c23b5d31108d8b01c7e0bd49a13416a5fb9d10c",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "displayFingerprint": "89D6-BE86-C969-039B-655D",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "signatureMessageHex": "6173632f76312f726571756573742d7369670000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA",
+ "sigHex": "a3d79427934020d0c806f42cc3383c0017b38b5a1af1ccacbf77dc3b7b5f2ba3c2a3b1d1f6e8996b4bd65164815b964b3013e703d4dd3c0aec534058a7ffea08"
+}
diff --git a/packages/secret-channel/test/vectors/negative.json b/packages/secret-channel/test/vectors/negative.json
new file mode 100644
index 00000000000..3e06db1a815
--- /dev/null
+++ b/packages/secret-channel/test/vectors/negative.json
@@ -0,0 +1,1128 @@
+{
+ "description": "Negative cases (spec §6.4–§6.8, §8). Unless stated otherwise every case uses baseRequest/baseEnvelope; the recipient is DeriveKeyPair(ikmR) and is freshly created for each case. expectedOpenError is the error code a conforming Executor returns; expectedVerifyError is what a conforming Client returns before sealing (null = accepted).",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmR #1\"))",
+ "hex": "b72ee6e87e3db2399fb0552d66a1b8a76f254504afec39fa0dafaa3dea6a2e72"
+ },
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: ikmE #1\"))",
+ "hex": "9a764e92e329a72505c51f35b115938843477c92842f3f0116a98a611913c753"
+ },
+ "baseRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "baseAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "baseEnvelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "positiveControl": {
+ "expectedOpenError": null,
+ "expectedVerifyError": null
+ },
+ "aadTampering": [
+ {
+ "name": "tamper-id",
+ "aadField": "requestId",
+ "path": "id",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "Dw4NDAsKCQgHBgUEAwIBAA",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d000000164477344e4441734b43516748426755454177494241410000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "REQUEST_MISMATCH"
+ },
+ {
+ "name": "tamper-requester.runId",
+ "aadField": "runId",
+ "path": "requester.runId",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0002",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030320000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-executor.executorId",
+ "aadField": "executorId",
+ "path": "executor.executorId",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0002",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303032000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-executor.identityKeyFp",
+ "aadField": "identityKeyFp",
+ "path": "executor.identityKeyFp",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:7ck_dFykt_qbHuMVdW9Aop46djIZuJEZZ4zCcvQf7t8",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a37636b5f6446796b745f716248754d56645739416f703436646a495a754a455a5a347a43637651663774380000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "FINGERPRINT_MISMATCH",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-executor.ephPub",
+ "aadField": "ephPub",
+ "path": "executor.ephPub",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "wUbZyHX_H0xMInf_rkQBhIo5q4kSd_7_s-gB-dpfMZ8",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b7755625a7948585f4830784d496e665f726b514268496f3571346b53645f375f732d67422d6470664d5a38000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "REQUEST_MISMATCH"
+ },
+ {
+ "name": "tamper-target.kind",
+ "aadField": "targetKind",
+ "path": "target.kind",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "git",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000036769740000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-target.exePath",
+ "aadField": "exePath",
+ "path": "target.exePath",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/tmp/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f000000092f746d702f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-target.argvHash",
+ "aadField": "argvHash",
+ "path": "target.argvHash",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "MioxswbAoz3KHALtqnlue1OdZEOd4mvskjox62olxkY",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b4d696f78737762416f7a334b48414c74716e6c7565314f645a454f64346d76736b6a6f7836326f6c786b590000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-kind",
+ "aadField": "kind",
+ "path": "kind",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "token",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f6678565100000005746f6b656e0000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-target.argvDisplay",
+ "aadField": "displayHash",
+ "path": "target.argvDisplay",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "true",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b582d4263304e55765a4e68796f6b35337042514279364939716d4a336b7235366d6b764678592d62665a730000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-target.promptText",
+ "aadField": "displayHash",
+ "path": "target.promptText",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Passphrase:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b2d4e59624975614a75653938434378393871424a2d5f795262396361446a31443278494d50426d4f4434410000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-target.verification",
+ "aadField": "displayHash",
+ "path": "target.verification",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "unverified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b7a7a5739787a50437764395a346a793834716b62516c39766142665f7a4a412d49314349425f44626e6d590000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-purpose.systemObserved",
+ "aadField": "displayHash",
+ "path": "purpose.systemObserved",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: true"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b6a6b4f647358584934594e4e4f4e74484d445846724b3164556a57676b6f4a584a6c7055456c38346972670000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-executor.executorName",
+ "aadField": "displayHash",
+ "path": "executor.executorName",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Other Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b67786d757630505538746d667472514754524575486b647934777059626f6e326f6f6a536a6977636559410000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-label",
+ "aadField": "displayHash",
+ "path": "label",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "ssh-passphrase",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b76465a6845737a6a6e4f4c70522d7a4861565665674e78624455537331537233595730493662437a544a4d0000000d31373930303030333030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "tamper-expiresAt",
+ "aadField": "expiresAt",
+ "path": "expiresAt",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000900000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "tamperedAadHex": "0000000e0000000a6173632f76312f61616400000001310000003044484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d0000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b475f626759352d745258444c6c623771313176684765326a6c4a4847526544423042394e4d4e4a6f786951000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030393030303030",
+ "expectedVerifyError": "BAD_SIGNATURE",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "DECRYPT_FAILED"
+ }
+ ],
+ "unboundField": {
+ "name": "agentClaim-is-unbound",
+ "path": "purpose.agentClaim",
+ "tamperedRequest": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Totally different explanation",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "expectedVerifyError": null,
+ "expectedOpenError": null
+ },
+ "envelopeTampering": [
+ {
+ "name": "ct-bit-flip-first",
+ "note": "first ciphertext byte flipped",
+ "envelope": {
+ "ct": "ovNH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "ct-bit-flip-tag",
+ "note": "last byte of the AEAD tag flipped",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK8",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "ct-truncated",
+ "note": "ciphertext truncated by 16 bytes",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kgw",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "enc-substituted",
+ "note": "enc replaced by another valid X25519 public key",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "DECRYPT_FAILED"
+ },
+ {
+ "name": "suite-downgrade",
+ "note": "suite label changed",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-128-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "UNSUPPORTED_VERSION"
+ },
+ {
+ "name": "version-changed",
+ "note": "v = 2",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 2
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "UNSUPPORTED_VERSION"
+ },
+ {
+ "name": "request-id-mismatch",
+ "note": "envelope names a different request; key is NOT consumed",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAAAAAAAAAAAAAAAAAAAAA",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "REQUEST_MISMATCH"
+ },
+ {
+ "name": "oversized-ct",
+ "note": "ct longer than 8192 base64url chars",
+ "envelope": {
+ "ct": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "INVALID_ENVELOPE"
+ },
+ {
+ "name": "expired",
+ "note": "opened 1 ms after expiresAt",
+ "envelope": {
+ "ct": "o_NH0xMtumKTJ18Aha6bCrE9HwJoakSFiO1Ta7T7RZEkTG5TV9hYSZeVZgJBox9CdSdQRV28Q3Q2qzN6vwjt0y2TKW57YLM86g6IDWegA0KyykEir7UaGmK6DNsudQ7S2mQzeskx8enyCnu1INtsucWaFOmHPduPvq83eTsIlu5g4t59AnuRxvMHclpF8USpSbaUDPLBVhBYm2G799xUZ0xbpQkHwWnI-E5ElGcGipyOoLLliVqwCANFFpMvT9WKi8n4d687zwtAToY2gw1Oq36bKcKDVjr-JK9c3eFcTsQ1sBMaUqWqKu7ZeleQiLyX5A7m9_PGwcq2xSBkSj3Kg1wYRrv2-F7S6GV6fUNCoK4",
+ "enc": "zxjULdIStMDIvCLtcB-1i7S-DKm98961WJG0AR-4S24",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000300001,
+ "expectedOpenError": "EXPIRED"
+ }
+ ],
+ "wrongRecipient": {
+ "name": "wrong-recipient-key",
+ "note": "the reference envelope opened with a different X25519 private key (DeriveKeyPair(wrongIkmR))",
+ "wrongIkmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: wrong recipient ikmR\"))",
+ "hex": "bbe2192a10a0ad01550b8e39ff6820118673a79a0d686daa52910419a1cc74b8"
+ },
+ "wrongPkRHex": "9e10204b61f87e86ef5868658292e33e2ccc02b49dd1669c236191cbc1d0ff4c",
+ "rawAeadOpenMustFail": true,
+ "expectedOpenError": "REQUEST_MISMATCH"
+ },
+ "singleUse": [
+ {
+ "name": "replay-same-envelope",
+ "note": "open succeeds once, second open of the same envelope",
+ "expectedOpenError": "REPLAYED"
+ },
+ {
+ "name": "garbage-then-valid",
+ "note": "a tampered envelope reaches decryption first, then the genuine envelope",
+ "expectedFirstError": "DECRYPT_FAILED",
+ "expectedOpenError": "REPLAYED"
+ },
+ {
+ "name": "mismatch-does-not-consume",
+ "note": "an envelope for another request is refused without consuming the key; the genuine envelope still opens",
+ "expectedFirstError": "REQUEST_MISMATCH",
+ "expectedOpenError": null
+ },
+ {
+ "name": "destroyed-before-use",
+ "note": "request denied/cancelled; key destroyed",
+ "expectedOpenError": "REPLAYED"
+ }
+ ],
+ "identity": [
+ {
+ "name": "relay-substitutes-identity-and-resigns",
+ "note": "relay swaps in its own identity key and re-signs; Client has the genuine fingerprint pinned",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:7ck_dFykt_qbHuMVdW9Aop46djIZuJEZZ4zCcvQf7t8",
+ "identityPublicKey": "gNQqRJ_tNciSpy39YsFOhUP28wdARJy3M3836yX1YTU",
+ "sig": "kfy10xXr_xtQE3GzAHRz8qKOquSQ-5-Kzxm121SC34E2Erg4hiZyv3r-pmdUcuatgXZQ90q_AlSG3TMzp5X_Cg"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "pinnedFingerprint": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "expectedVerifyError": "FINGERPRINT_MISMATCH"
+ },
+ {
+ "name": "relay-substitutes-identity-first-contact",
+ "note": "same as above but no pin yet (TOFU first contact): verification passes, which is the documented TOFU limitation; the Host MUST show the fingerprint for comparison",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:7ck_dFykt_qbHuMVdW9Aop46djIZuJEZZ4zCcvQf7t8",
+ "identityPublicKey": "gNQqRJ_tNciSpy39YsFOhUP28wdARJy3M3836yX1YTU",
+ "sig": "kfy10xXr_xtQE3GzAHRz8qKOquSQ-5-Kzxm121SC34E2Erg4hiZyv3r-pmdUcuatgXZQ90q_AlSG3TMzp5X_Cg"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "expectedVerifyError": null
+ },
+ {
+ "name": "fingerprint-inconsistent-with-key",
+ "note": "identityKeyFp does not hash identityPublicKey",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:7ck_dFykt_qbHuMVdW9Aop46djIZuJEZZ4zCcvQf7t8",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "expectedVerifyError": "FINGERPRINT_MISMATCH"
+ },
+ {
+ "name": "signature-corrupted",
+ "note": "one bit of sig flipped",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "oteUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "pinnedFingerprint": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "expectedVerifyError": "BAD_SIGNATURE"
+ },
+ {
+ "name": "genuine-request-pinned",
+ "note": "positive control",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "G_bgY5-tRXDLlb7q11vhGe2jlJHGReDB0B9NMNJoxiQ",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "o9eUJ5NAINDIBvQswzg8ABezi1oa8cysv3fcO3tfK6PCo7HR9uiZa0vWUWSBW5ZLMBPnA9TdPArsU0BYp__qCA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "pinnedFingerprint": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "expectedVerifyError": null
+ }
+ ],
+ "clientSide": [
+ {
+ "name": "seal-at-expiry",
+ "note": "Client refuses to seal when now >= expiresAt",
+ "now": 1790000300000,
+ "expectedSealError": "EXPIRED"
+ }
+ ]
+}
diff --git a/packages/secret-channel/test/vectors/redaction.json b/packages/secret-channel/test/vectors/redaction.json
new file mode 100644
index 00000000000..aff422ceb31
--- /dev/null
+++ b/packages/secret-channel/test/vectors/redaction.json
@@ -0,0 +1,70 @@
+{
+ "description": "Output redaction placeholder and known-value variants (spec §7.4). Placeholder = \"«secret:\" || sanitize(label) || \"»\".",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "placeholders": [
+ {
+ "label": "sudo-password",
+ "sanitized": "sudo-password",
+ "placeholder": "«secret:sudo-password»"
+ },
+ {
+ "label": "ssh passphrase",
+ "sanitized": "ssh-passphrase",
+ "placeholder": "«secret:ssh-passphrase»"
+ },
+ {
+ "label": "git/token",
+ "sanitized": "git-token",
+ "placeholder": "«secret:git-token»"
+ },
+ {
+ "label": "../../etc",
+ "sanitized": "..-..-etc",
+ "placeholder": "«secret:..-..-etc»"
+ },
+ {
+ "label": "",
+ "sanitized": "secret",
+ "placeholder": "«secret:secret»"
+ },
+ {
+ "label": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+ "sanitized": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+ "placeholder": "«secret:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx»"
+ },
+ {
+ "label": "file-TOKEN",
+ "sanitized": "file-TOKEN",
+ "placeholder": "«secret:file-TOKEN»"
+ }
+ ],
+ "variants": [
+ {
+ "value": "hunter2-TEST",
+ "variants": [
+ "hunter2-TEST",
+ "aHVudGVyMi1URVNU",
+ "68756e746572322d54455354",
+ "68756E746572322D54455354"
+ ]
+ },
+ {
+ "value": "p@ss w/rd+TEST",
+ "variants": [
+ "p@ss w/rd+TEST",
+ "p%40ss%20w%2Frd%2BTEST",
+ "cEBzcyB3L3JkK1RFU1Q",
+ "cEBzcyB3L3JkK1RFU1Q=",
+ "7040737320772f72642b54455354",
+ "7040737320772F72642B54455354"
+ ]
+ },
+ {
+ "value": "abc",
+ "variants": [
+ "YWJj",
+ "616263"
+ ]
+ }
+ ]
+}
diff --git a/packages/secret-channel/test/vectors/sender-auth.json b/packages/secret-channel/test/vectors/sender-auth.json
new file mode 100644
index 00000000000..c7231d41222
--- /dev/null
+++ b/packages/secret-channel/test/vectors/sender-auth.json
@@ -0,0 +1,630 @@
+{
+ "description": "Sender authentication (spec §6.10, [ASC-L2-33]..[ASC-L2-40], [ASC-EXT-07]). Value-accepting Requests use the Auth suite: HPKE mode_auth (RFC 9180 §5.1.3) with the paired Client key as sender key. Client key = DeriveKeyPair(ikmS); recipient key = DeriveKeyPair(ikmR); sender ephemeral key = DeriveKeyPair(ikmE). AAD field 2 is the Request's suite label. relayInjection cases are Envelopes a malicious Relay can build from public data only; expectedOpenError is what a conforming Executor that has pairedClients returns, consumesKey says whether the single-use key is consumed (checked by opening the genuine Envelope afterwards). Deterministic ikm is for vectors only.",
+ "generator": "spec/test-vectors/generate.ts (packages/asc-core reference implementation)",
+ "suiteAuth": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "suiteBase": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "suiteIds": {
+ "mode": 2,
+ "kem": 32,
+ "kdf": 1,
+ "aead": 2
+ },
+ "hpkeInfo": "asc/v1/hpke-info",
+ "clientKey": {
+ "ikmS": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: client key ikmS #1\"))",
+ "hex": "1b88fd7d23edf16fbfa0ef1f54a70879e349dd48c00d301b7dd23bccc039e557"
+ },
+ "skSHex": "cba0c513b668e2668bdfd86612de5b3f1b11252bafa57be5f7526d7d1dfa56ea",
+ "pkSHex": "3dd931609688b359bb419bf7eabfab66e54499bf8cbcaf336860af89a3aebd52",
+ "publicKey": "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI",
+ "clientKeyFp": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk",
+ "displayFingerprint": "4DD4-4174-90C2-BF9A-335F"
+ },
+ "relayClientKey": {
+ "ikmS": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: relay-held client key ikmS\"))",
+ "hex": "490e51d7ae9a4b352a1fd37bebf551ba83e268598c0b323b86b90f7b24212cce"
+ },
+ "skSHex": "90f4dc3c13bb2e5de6e46ff4f053ee80bc4626952e2a451276a9c7063a6437f1",
+ "pkSHex": "8be95e73c264185be07cee9bb61e42b0867f5597583365fe04c26d96f80dc277",
+ "publicKey": "i-lec8JkGFvgfO6bth5CsIZ_VZdYM2X-BMJtlvgNwnc",
+ "clientKeyFp": "SHA256:E7KVhOim_PjHu3_upZSZIEOBmCyR7m1Bi-pSy5CGKYI",
+ "displayFingerprint": "13B2-9584-E8A6-FCF8-C7BB"
+ },
+ "relayValueUtf8": "relay-chosen-token-TEST-ONLY",
+ "classification": [
+ {
+ "kind": "password",
+ "targetKind": "sudo",
+ "class": "verifier-checked",
+ "suite": "Base permitted; Auth SHOULD once a Client is paired"
+ },
+ {
+ "kind": "passphrase",
+ "targetKind": "ssh",
+ "class": "verifier-checked",
+ "suite": "Base permitted; Auth SHOULD once a Client is paired"
+ },
+ {
+ "kind": "otp",
+ "targetKind": "ssh",
+ "class": "verifier-checked",
+ "suite": "Base permitted; Auth SHOULD once a Client is paired"
+ },
+ {
+ "kind": "password",
+ "targetKind": "ssh",
+ "class": "verifier-checked",
+ "suite": "Base permitted; Auth SHOULD once a Client is paired"
+ },
+ {
+ "kind": "passphrase",
+ "targetKind": "ssh",
+ "setsNewSecret": true,
+ "note": "the Sink sets a new secret (e.g. ssh-keygen asking for a new passphrase)",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "password",
+ "targetKind": "git",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "token",
+ "targetKind": "git",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "token",
+ "targetKind": "env-run",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "token",
+ "targetKind": "mcp-url",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "approval",
+ "targetKind": "sudo",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "otp",
+ "targetKind": "oauth",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "password",
+ "targetKind": "pty-prompt",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "x-unknown",
+ "targetKind": "sudo",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ },
+ {
+ "kind": "password",
+ "targetKind": "x-unknown",
+ "class": "value-accepting",
+ "suite": "Auth REQUIRED"
+ }
+ ],
+ "positive": [
+ {
+ "name": "value-accepting-token",
+ "verifierChecked": false,
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: sender-auth ikmR #1\"))",
+ "hex": "daa89dddf952ac001acdf26c114e2814d354639cce2bccbc534d1d4ef2a1804f"
+ },
+ "pkRHex": "d1d3b51d75581b551b472537c694c88d5ceacca646bcfc4d31097ae47c954f31",
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: sender-auth ikmE #1\"))",
+ "hex": "6a5f5b82408979b01ae36915c977f4ff51ad6c96e9012502416e7a7d7b92b391"
+ },
+ "secretUtf8": "token-TEST-ONLY-not-a-real-credential",
+ "framedPlaintextHex": "010025746f6b656e2d544553542d4f4e4c592d6e6f742d612d7265616c2d63726564656e7469616c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "0dO1HXVYG1UbRyU3xpTIjVzqzKZGvPxNMQl65HyVTzE",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "8JJN__ZOP6ffsSXlOa1VRxMzGc-fn-pWkMv2Y2sjW0-OgDYJnd5UbSZXo-q9x5te1oC181ajhFJ8xLNZiAg7Aw"
+ },
+ "expiresAt": 1790000300000,
+ "id": "ICEiIyQlJicoKSorLC0uLw",
+ "kind": "token",
+ "label": "git-token",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Push the release branch (agent claim, unverified)",
+ "systemObserved": "git at /usr/bin/git, not verifiable"
+ },
+ "requester": {
+ "runId": "run-TEST-0002",
+ "source": "askpass"
+ },
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "target": {
+ "argvDisplay": "git push https://example.test/org/repo.git main",
+ "argvHash": "-fzGOGdGnxqOUIj2fa1dH_p-GbgHNkjCO0ixMJi4j9s",
+ "exePath": "/usr/bin/git",
+ "kind": "git",
+ "promptText": "Password for 'https://[email protected]':",
+ "verification": "unverified"
+ },
+ "v": 1
+ },
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003a44484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d2f6d6f64655f6175746800000016494345694979516c4a69636f4b536f724c4330754c770000000d72756e2d544553542d303030320000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b30644f31485856594731556252795533787054496a567a717a4b5a477650784e4d516c3635487956547a45000000036769740000000c2f7573722f62696e2f6769740000002b2d667a474f4764476e78714f55496a3266613164485f702d476267484e6b6a434f3069784d4a69346a397300000005746f6b656e0000002b334e334a78357a6766487453756e4161634f62474e6e794d7532354f78515469766c304b757a64425642340000000d31373930303030333030303030",
+ "envelope": {
+ "ct": "nKMg1m4a58l1lvAzCUphKGjIPRgWcUX_SsIIZa8cNxMTH4iEcRRk4WgbYmgKC7CvoO3zLZlaALFaW_3-0dqzqV0CukdVXFLnZS2bMp28vXXjPL4ZfjA2si-nQcI4BGSzoiUHCGlKKYHZWpGVdactD01odZiyVHoyLe56xL_nTe53_7t7tZ1V-kIciygB9otVtlhijAgoztnvbukTdU6Z17DSgZBN3tXyoQ8DZbsjJZ74I13StSI8Iiqedk-ZFgnh6o6rSkWjzWJx4hGSIqhDXMCnDnLFb9HmWFqH23xYhAhi6Q8mSCIjwipt8xByLmeUueb_FFsokNvqE3s_p_5r5qPH-RcPsvN0UJvtacLpCfE",
+ "enc": "FJ69T60lb6Qfe0tNkXDH3J2ei7LKSF9VuxER7i0puBA",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "sender": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "encHex": "149ebd4fad256fa41f7b4b4d9170c7dc9d9e8bb2ca485f55bb1111ee2d29b810",
+ "ctHex": "9ca320d66e1ae7c97596f033094a612868c83d18167145ff4ac20865af1c3713131f8884711464e1681b62680a0bb0afa0edf32d995a00b15a5bfdfed1dab3a95d02ba47555c52e7652d9b329dbcbd75e33cbe197e3036b22fa741c2380464b3a2250708694a2981d95a919575a72d0f4d687598b2547a322dee7ac4bfe74dee77ffbb7bb59d55fa421c8b2801f68b55b658628c0828ced9ef6ee913754e99d7b0d281904dded5f2a10f0365bb23259ef8235dd2b5223c222a9e764f991609e1ea8eab4a45a3cd6271e2119222a8435cc0a70e72c56fd1e6585a87db7c58840862e90f26482223c22a6df310722e6794b9e6ff145b2890dbea137b3fa7fe6be6a3c7f9170fb2f374509bed69c2e909f1",
+ "openAt": 1790000001000,
+ "expectedOpenError": null
+ },
+ {
+ "name": "verifier-checked-sudo-auth",
+ "verifierChecked": true,
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: sender-auth ikmR #2\"))",
+ "hex": "190f1240daf5e30248ad01ce337ceb060d3e63039721412847dcc7726fa1138a"
+ },
+ "pkRHex": "5dec36026b16aefe163c5aaa553b77b65a36f179a40b8f433b8fa75a0213bd2b",
+ "ikmE": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: sender-auth ikmE #2\"))",
+ "hex": "b61b5c936fe16b25a8a432fe35cb02ae76713b7c5fb3e4eed0ef364ac3d3959f"
+ },
+ "secretUtf8": "correct-horse-battery-staple-TEST-ONLY",
+ "framedPlaintextHex": "010026636f72726563742d686f7273652d626174746572792d737461706c652d544553542d4f4e4c590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "Xew2AmsWrv4WPFqqVTt3tlo28XmkC49DO4-nWgITvSs",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "g4R_IxUq5VVZStYbak5QiySDjDiG3JEJNtxH9uKFN-NlpVi_sYEll8e3vnMVRjM1NB-7P-pPBB9cLc9il4WHDA"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "aadHex": "0000000e0000000a6173632f76312f61616400000001310000003a44484b454d2d5832353531392d484b44462d5348413235362f484b44462d5348413235362f4145532d3235362d47434d2f6d6f64655f617574680000001641414543417751464267634943516f4c4441304f44770000000d72756e2d544553542d303030310000000e657865632d544553542d30303031000000325348413235363a6964612d68736c704135746c5857744a4a68753139325a545053734c623042455044547450714b6e41526f0000002b58657732416d7357727634575046717156547433746c6f3238586d6b433439444f342d6e57674954765373000000047375646f0000000d2f7573722f62696e2f7375646f0000002b3830787446334931516b43622d5f4c386a446330797a4635415a4e564f77636856586a744c455f667856510000000870617373776f72640000002b745079556d5661446a476533776947504a6f786e2d456976656d6959736744553669394e685f3679394a450000000d31373930303030333030303030",
+ "envelope": {
+ "ct": "UwU4c7s9OhHiQgqsh-Uavj3QapCQHIVej-GZn3Z_ihKuKeZVGMdECEWrlJuMd-7AZV__AGar7H_atd_UF9VY59hdcSKToZi_w3lvY9cotdY1ddENQHjVMZ8dI4C3GYNPSejvHKpzoxLT3FUjJuzHXA3Ev2IQwtrrjRik4AF56GizswkDqWrev8gBYPGsPGBHhLtLpyBrxUR7WU4SlvxUnLo0btSfijDJPaFJvqOseCekx6R_frAQjoY9Vn4oiVjfYgortOrAvJ-KjASJXS9a5O0tcHIna6v9H8xfRhFhflQ1io3UgU460ES-YBP0h9FNlNKqCDpeuH-HADiRYIGG__qhFNSp386-iaiveKmg1T8",
+ "enc": "U5IWsC3OJWLhtrfy2DnXUDfuhSpb8FtP36z2BDjAfQc",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "sender": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "encHex": "539216b02dce2562e1b6b7f2d839d75037ee852a5bf05b4fdfacf60438c07d07",
+ "ctHex": "53053873bb3d3a11e2420aac87e51abe3dd06a90901c855e8fe1999f767f8a12ae29e65518c7440845ab949b8c77eec0655fff0066abec7fdab5dfd417d558e7d85d712293a198bfc3796f63d728b5d63575d10d4078d5319f1d2380b719834f49e8ef1caa73a312d3dc552326ecc75c0dc4bf6210c2daeb8d18a4e00179e868b3b30903a96adebfc80160f1ac3c604784bb4ba7206bc5447b594e1296fc549cba346ed49f8a30c93da149bea3ac7827a4c7a47f7eb0108e863d567e288958df620a2bb4eac0bc9f8a8c04895d2f5ae4ed2d7072276babfd1fcc5f4611617e54358a8dd4814e3ad044be6013f487d14d94d2aa083a5eb87f87003891608186fffaa114d4a9dfcebe89a8af78a9a0d53f",
+ "openAt": 1790000001000,
+ "expectedOpenError": null
+ }
+ ],
+ "relayInjection": [
+ {
+ "name": "relay-self-sealed-base-mode",
+ "note": "The draft-00 attack: the Relay seals its own value with HPKE Base mode to ephPub under the Base-suite AAD and submits a Base Envelope. Under draft-00 an Executor would accept it (see baseSuiteResidual). An Auth-suite Request refuses it before consuming the key.",
+ "envelope": {
+ "ct": "PBGKy0LWN4SuupIDwEAwkBF7fX64JzdAnEpaTpsU51wVCChnuGaG_DJD8EhYRsC0ovJj9HnPsYUOADn1P307ZOkWDRkAYvGtG4YO6I3QEJItGPsHqrhx1-pokt9It582_aftyQ4albvwGRaYMcKUqm6VHpFK8sFa58CYzB0MQGD4__AmuR4T4w-F5tUfFCjpEh8AOg9gjbfSWFUdaJZEw7UkoDbmOvIIEnbEYXCtJxu9JAms0VjXnZuRP5blAsPMr3cOkhfJKLsBhl7TXnPjDTkNrhd8hZSeCLJaZOqnGAywNrCNwlV_G8A7KH_RpjparwntoM0WuiIPVYSOhYw7Cseyg_T8C5M_ffx6vhXA40w",
+ "enc": "kW8UFQfL9muUqRgtcgA9CWJWJnLRmQCaifdRXLMyhG0",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "SENDER_AUTH_REQUIRED",
+ "consumesKey": false,
+ "genuineEnvelopeAfterwards": null,
+ "rawBaseOpenUnderBaseAad": "relay-chosen-token-TEST-ONLY",
+ "rawAuthOpenWithPairedClient": null
+ },
+ {
+ "name": "relay-self-sealed-base-mode-auth-aad",
+ "note": "Relay seals in Base mode but under the Auth-suite AAD, Envelope labelled Base: refused before consumption.",
+ "envelope": {
+ "ct": "Q0XDreCw2se8U5CGB9cl1cfo4egozwliy3CKtOYg48Rsp-ZmJoXck6Ru4Xh-HYFCjdOuc26nczE7M3UgcRHGsK_CJEIyxTHw0_0uzwd3InZjuYxGERL4xwwwdjfqUq_jL6ugfJ1g3QV1-WpDau7Jsas8unxqYBzOIsmmDoy0c_NVmwi59y1Qx9D80T1QrsjLWCi5qgnvF6HvhKHQgxBkwTzNYhnmslMMKjYmta_xWgVyTVXd2gASU0Ls07O2Z5Q3G7CfsPVBoIyYCktnrHdWsXlFlGNYppsLEUWt9aONAEHPmJpvDTDbHOi4UX1w60IvdI7yBLhB8CRopqvTspL3X4inqR_EkBtz0ntbu3Ae9fY",
+ "enc": "jcVExdFapsSfwUFpVEd1_G1KePCjzBp6tk_1HRN5dE0",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "SENDER_AUTH_REQUIRED",
+ "consumesKey": false,
+ "genuineEnvelopeAfterwards": null,
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": null
+ },
+ {
+ "name": "relay-base-ciphertext-claims-paired-sender",
+ "note": "Relay seals in Base mode but labels the Envelope Auth and names the paired Client: AuthDecap with the paired pkS fails.",
+ "envelope": {
+ "ct": "Q0XDreCw2se8U5CGB9cl1cfo4egozwliy3CKtOYg48Rsp-ZmJoXck6Ru4Xh-HYFCjdOuc26nczE7M3UgcRHGsK_CJEIyxTHw0_0uzwd3InZjuYxGERL4xwwwdjfqUq_jL6ugfJ1g3QV1-WpDau7Jsas8unxqYBzOIsmmDoy0c_NVmwi59y1Qx9D80T1QrsjLWCi5qgnvF6HvhKHQgxBkwTzNYhnmslMMKjYmta_xWgVyTVXd2gASU0Ls07O2Z5Q3G7CfsPVBoIyYCktnrHdWsXlFlGNYppsLEUWt9aONAEHPmJpvDTDbHOi4UX1w60IvdI7yBLhB8CRopqvTspL3X4inqR_EkBtz0ntbu3Ae9fY",
+ "enc": "jcVExdFapsSfwUFpVEd1_G1KePCjzBp6tk_1HRN5dE0",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "sender": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "DECRYPT_FAILED",
+ "consumesKey": true,
+ "genuineEnvelopeAfterwards": "REPLAYED",
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": null
+ },
+ {
+ "name": "relay-self-sealed-own-client-key",
+ "note": "Relay seals in Auth mode with a Client key of its own and names it: not paired, refused before consumption.",
+ "envelope": {
+ "ct": "ARi8eNdelVCIBJW2OSI0MRu3vyFvKWKhcVxf7v8yI0hY7_EyAwS3ypLBB6vRruFRG8JtqLtC2Dsxj38EZbxlAshJ1bBS4HdnB2IPK3JpQ-CUdcawZxfYfDTfAoRW9n74_MXMagF9ToHNTPHytvcYUYDj6f3KOw9cQpHQ6QixfxGtvvrXtF6YwV1Rn1AtS_nz1JvwB4zDhwjh35gVdwW2WNiTp5V0Dsq577od37Dgn3YmVaq2s4OujW72vYRtdcX_OOmj8M90aZ_2FH38HlAGVMmQz5DtnlmfxCPJDMv4ghRUk5N-BjgMCGW0bXUKRukmKXgGGf7qbtTnXyhuAzeGbFOU1q5hbA0XU63FqYSIXTA",
+ "enc": "2eLB9S3b03AtC98kxalJu8vJS5HJj1JcFccJuCOf-BQ",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "sender": "SHA256:E7KVhOim_PjHu3_upZSZIEOBmCyR7m1Bi-pSy5CGKYI",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "UNKNOWN_SENDER",
+ "consumesKey": false,
+ "genuineEnvelopeAfterwards": null,
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": null
+ },
+ {
+ "name": "relay-own-client-key-claims-paired-sender",
+ "note": "Relay seals in Auth mode with its own key but names the paired Client: AuthDecap uses the paired pkS and fails.",
+ "envelope": {
+ "ct": "ARi8eNdelVCIBJW2OSI0MRu3vyFvKWKhcVxf7v8yI0hY7_EyAwS3ypLBB6vRruFRG8JtqLtC2Dsxj38EZbxlAshJ1bBS4HdnB2IPK3JpQ-CUdcawZxfYfDTfAoRW9n74_MXMagF9ToHNTPHytvcYUYDj6f3KOw9cQpHQ6QixfxGtvvrXtF6YwV1Rn1AtS_nz1JvwB4zDhwjh35gVdwW2WNiTp5V0Dsq577od37Dgn3YmVaq2s4OujW72vYRtdcX_OOmj8M90aZ_2FH38HlAGVMmQz5DtnlmfxCPJDMv4ghRUk5N-BjgMCGW0bXUKRukmKXgGGf7qbtTnXyhuAzeGbFOU1q5hbA0XU63FqYSIXTA",
+ "enc": "2eLB9S3b03AtC98kxalJu8vJS5HJj1JcFccJuCOf-BQ",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "sender": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "DECRYPT_FAILED",
+ "consumesKey": true,
+ "genuineEnvelopeAfterwards": "REPLAYED",
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": null
+ },
+ {
+ "name": "relay-strips-sender",
+ "note": "The genuine Auth Envelope with `sender` removed.",
+ "envelope": {
+ "ct": "nKMg1m4a58l1lvAzCUphKGjIPRgWcUX_SsIIZa8cNxMTH4iEcRRk4WgbYmgKC7CvoO3zLZlaALFaW_3-0dqzqV0CukdVXFLnZS2bMp28vXXjPL4ZfjA2si-nQcI4BGSzoiUHCGlKKYHZWpGVdactD01odZiyVHoyLe56xL_nTe53_7t7tZ1V-kIciygB9otVtlhijAgoztnvbukTdU6Z17DSgZBN3tXyoQ8DZbsjJZ74I13StSI8Iiqedk-ZFgnh6o6rSkWjzWJx4hGSIqhDXMCnDnLFb9HmWFqH23xYhAhi6Q8mSCIjwipt8xByLmeUueb_FFsokNvqE3s_p_5r5qPH-RcPsvN0UJvtacLpCfE",
+ "enc": "FJ69T60lb6Qfe0tNkXDH3J2ei7LKSF9VuxER7i0puBA",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "SENDER_AUTH_REQUIRED",
+ "consumesKey": false,
+ "genuineEnvelopeAfterwards": null,
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": "token-TEST-ONLY-not-a-real-credential"
+ },
+ {
+ "name": "relay-malformed-sender",
+ "note": "`sender` is not a clientKeyFp: it names no paired Client.",
+ "envelope": {
+ "ct": "nKMg1m4a58l1lvAzCUphKGjIPRgWcUX_SsIIZa8cNxMTH4iEcRRk4WgbYmgKC7CvoO3zLZlaALFaW_3-0dqzqV0CukdVXFLnZS2bMp28vXXjPL4ZfjA2si-nQcI4BGSzoiUHCGlKKYHZWpGVdactD01odZiyVHoyLe56xL_nTe53_7t7tZ1V-kIciygB9otVtlhijAgoztnvbukTdU6Z17DSgZBN3tXyoQ8DZbsjJZ74I13StSI8Iiqedk-ZFgnh6o6rSkWjzWJx4hGSIqhDXMCnDnLFb9HmWFqH23xYhAhi6Q8mSCIjwipt8xByLmeUueb_FFsokNvqE3s_p_5r5qPH-RcPsvN0UJvtacLpCfE",
+ "enc": "FJ69T60lb6Qfe0tNkXDH3J2ei7LKSF9VuxER7i0puBA",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "sender": "not-a-fingerprint",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "pairedClients": [
+ "PdkxYJaIs1m7QZv36r-rZuVEmb-MvK8zaGCviaOuvVI"
+ ],
+ "expectedOpenError": "UNKNOWN_SENDER",
+ "consumesKey": false,
+ "genuineEnvelopeAfterwards": null,
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": "token-TEST-ONLY-not-a-real-credential"
+ },
+ {
+ "name": "client-key-removed",
+ "note": "The genuine Envelope after the Human removed the Client key on the Executor device (paired set empty).",
+ "envelope": {
+ "ct": "nKMg1m4a58l1lvAzCUphKGjIPRgWcUX_SsIIZa8cNxMTH4iEcRRk4WgbYmgKC7CvoO3zLZlaALFaW_3-0dqzqV0CukdVXFLnZS2bMp28vXXjPL4ZfjA2si-nQcI4BGSzoiUHCGlKKYHZWpGVdactD01odZiyVHoyLe56xL_nTe53_7t7tZ1V-kIciygB9otVtlhijAgoztnvbukTdU6Z17DSgZBN3tXyoQ8DZbsjJZ74I13StSI8Iiqedk-ZFgnh6o6rSkWjzWJx4hGSIqhDXMCnDnLFb9HmWFqH23xYhAhi6Q8mSCIjwipt8xByLmeUueb_FFsokNvqE3s_p_5r5qPH-RcPsvN0UJvtacLpCfE",
+ "enc": "FJ69T60lb6Qfe0tNkXDH3J2ei7LKSF9VuxER7i0puBA",
+ "requestId": "ICEiIyQlJicoKSorLC0uLw",
+ "sender": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "v": 1
+ },
+ "pairedClients": [],
+ "expectedOpenError": "UNKNOWN_SENDER",
+ "consumesKey": false,
+ "genuineEnvelopeAfterwards": null,
+ "rawBaseOpenUnderBaseAad": null,
+ "rawAuthOpenWithPairedClient": "token-TEST-ONLY-not-a-real-credential"
+ }
+ ],
+ "clientSide": [
+ {
+ "name": "client-without-key",
+ "note": "an Auth-suite Request and a Client that holds no Client key: refuses to seal (no Base fallback, [ASC-EXT-07])",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "0dO1HXVYG1UbRyU3xpTIjVzqzKZGvPxNMQl65HyVTzE",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "8JJN__ZOP6ffsSXlOa1VRxMzGc-fn-pWkMv2Y2sjW0-OgDYJnd5UbSZXo-q9x5te1oC181ajhFJ8xLNZiAg7Aw"
+ },
+ "expiresAt": 1790000300000,
+ "id": "ICEiIyQlJicoKSorLC0uLw",
+ "kind": "token",
+ "label": "git-token",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Push the release branch (agent claim, unverified)",
+ "systemObserved": "git at /usr/bin/git, not verifiable"
+ },
+ "requester": {
+ "runId": "run-TEST-0002",
+ "source": "askpass"
+ },
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_auth",
+ "target": {
+ "argvDisplay": "git push https://example.test/org/repo.git main",
+ "argvHash": "-fzGOGdGnxqOUIj2fa1dH_p-GbgHNkjCO0ixMJi4j9s",
+ "exePath": "/usr/bin/git",
+ "kind": "git",
+ "promptText": "Password for 'https://[email protected]':",
+ "verification": "unverified"
+ },
+ "v": 1
+ },
+ "withSender": false,
+ "expectedSealError": "SENDER_AUTH_REQUIRED"
+ },
+ {
+ "name": "relay-strips-suite-member",
+ "note": "the Relay removes `suite` so that a Client would seal in Base mode: AAD field 2 changes, the signature fails",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "0dO1HXVYG1UbRyU3xpTIjVzqzKZGvPxNMQl65HyVTzE",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "8JJN__ZOP6ffsSXlOa1VRxMzGc-fn-pWkMv2Y2sjW0-OgDYJnd5UbSZXo-q9x5te1oC181ajhFJ8xLNZiAg7Aw"
+ },
+ "expiresAt": 1790000300000,
+ "id": "ICEiIyQlJicoKSorLC0uLw",
+ "kind": "token",
+ "label": "git-token",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Push the release branch (agent claim, unverified)",
+ "systemObserved": "git at /usr/bin/git, not verifiable"
+ },
+ "requester": {
+ "runId": "run-TEST-0002",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "git push https://example.test/org/repo.git main",
+ "argvHash": "-fzGOGdGnxqOUIj2fa1dH_p-GbgHNkjCO0ixMJi4j9s",
+ "exePath": "/usr/bin/git",
+ "kind": "git",
+ "promptText": "Password for 'https://[email protected]':",
+ "verification": "unverified"
+ },
+ "v": 1
+ },
+ "withSender": true,
+ "expectedSealError": "BAD_SIGNATURE"
+ },
+ {
+ "name": "unknown-suite",
+ "note": "a suite label the Client does not implement",
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "0dO1HXVYG1UbRyU3xpTIjVzqzKZGvPxNMQl65HyVTzE",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "8JJN__ZOP6ffsSXlOa1VRxMzGc-fn-pWkMv2Y2sjW0-OgDYJnd5UbSZXo-q9x5te1oC181ajhFJ8xLNZiAg7Aw"
+ },
+ "expiresAt": 1790000300000,
+ "id": "ICEiIyQlJicoKSorLC0uLw",
+ "kind": "token",
+ "label": "git-token",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Push the release branch (agent claim, unverified)",
+ "systemObserved": "git at /usr/bin/git, not verifiable"
+ },
+ "requester": {
+ "runId": "run-TEST-0002",
+ "source": "askpass"
+ },
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM/mode_psk",
+ "target": {
+ "argvDisplay": "git push https://example.test/org/repo.git main",
+ "argvHash": "-fzGOGdGnxqOUIj2fa1dH_p-GbgHNkjCO0ixMJi4j9s",
+ "exePath": "/usr/bin/git",
+ "kind": "git",
+ "promptText": "Password for 'https://[email protected]':",
+ "verification": "unverified"
+ },
+ "v": 1
+ },
+ "withSender": true,
+ "expectedSealError": "UNSUPPORTED_VERSION"
+ }
+ ],
+ "baseEnvelopeWithSender": {
+ "name": "base-envelope-with-sender",
+ "note": "a Base-suite Request and an Envelope carrying `sender` ([ASC-L2-40])",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: sender-auth base ikmR\"))",
+ "hex": "a12dae9ab39b8d7d19d71f2da4d0c8c3a1ed4cc4c50792a76dbd2dc917033786"
+ },
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "PFdvWw2DLt6rx32dEdzwWfaP6VFnC5G_1sNwYYtSxEg",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "WJhHAJzOk1WteTOD5krfJCXU3wEk1luq8hPU8IdCH8Yopequa83zxKfalXDIsBcDQPOnyptEfZ1QyrBcZtFqAw"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "envelope": {
+ "ct": "FX80mfUdiE-P-QMHnwGU4tmAVLx4-lUNOVAJmyZRr_Khzi_uvYwQYeS2TOh67k9qOHHc1532N5sOZQtHCYbwDrg927nmlPLawzJKdNjLwI7ibZbLOnchxrUfUh7II6tvI0OOLQsrIHDhYMsxlsSQniDr6QiXX8mvtPHhuU6QDyLVBVdHojklmxD6W1gkbpKK1QbKWn0M8GuboXnaEd3SxKOs4MPCtnaymCW7k8IivqmCpZn_ET17N9VHpgpN8wSqNA3MoTG_QEEIOm4ooDFNJnWZrmZ16lrd46vt53-vyJQC4jhb6KWZkVWBABKgbBD_12WhGCi49ZCj6pxnJWr6FFfRW9aj6oWzW-LCQAKQYsU",
+ "enc": "8qB6Ebk59OnIGY00Cz8rC1q0fZfF-cADYhF9E5tybzs",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1,
+ "sender": "SHA256:TdRBdJDCv5ozX90YTqWSgfzhw3a53p_u7w9-2y6kKAk"
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": "INVALID_ENVELOPE"
+ },
+ "baseSuiteResidual": {
+ "name": "verifier-checked-base-suite-accepts-relay-value",
+ "note": "Documented residual (spec §10.3 L14): a verifier-checked Request in the Base suite (no Client paired) opens a Relay-sealed value. The Sink (sudo) then rejects it as a wrong password, the same outcome as the denial of service a Relay can always cause. This is why value-accepting Requests MUST use the Auth suite.",
+ "ikmR": {
+ "derivation": "SHA-256(UTF-8(\"ASC test vector: sender-auth base ikmR\"))",
+ "hex": "a12dae9ab39b8d7d19d71f2da4d0c8c3a1ed4cc4c50792a76dbd2dc917033786"
+ },
+ "request": {
+ "createdAt": 1790000000000,
+ "executor": {
+ "ephPub": "PFdvWw2DLt6rx32dEdzwWfaP6VFnC5G_1sNwYYtSxEg",
+ "executorId": "exec-TEST-0001",
+ "executorName": "Test Laptop",
+ "identityKeyFp": "SHA256:ida-hslpA5tlXWtJJhu192ZTPSsLb0BEPDTtPqKnARo",
+ "identityPublicKey": "fSnXk-TZ_DhB5zyHjCO10xEI2LAcfgvUmhNBal-50Qw",
+ "sig": "WJhHAJzOk1WteTOD5krfJCXU3wEk1luq8hPU8IdCH8Yopequa83zxKfalXDIsBcDQPOnyptEfZ1QyrBcZtFqAw"
+ },
+ "expiresAt": 1790000300000,
+ "id": "AAECAwQFBgcICQoLDA0ODw",
+ "kind": "password",
+ "label": "sudo-password",
+ "persistence": "once",
+ "purpose": {
+ "agentClaim": "Install the example package (agent claim, unverified)",
+ "systemObserved": "sudo: installer -pkg example-TEST.pkg -target /"
+ },
+ "requester": {
+ "runId": "run-TEST-0001",
+ "source": "askpass"
+ },
+ "target": {
+ "argvDisplay": "installer -pkg example-TEST.pkg -target /",
+ "argvHash": "80xtF3I1QkCb-_L8jDc0yzF5AZNVOwchVXjtLE_fxVQ",
+ "exePath": "/usr/bin/sudo",
+ "kind": "sudo",
+ "promptText": "Password:",
+ "verification": "verified"
+ },
+ "v": 1
+ },
+ "envelope": {
+ "ct": "Vl6XbepI7ma9nkGWIlJ3RjKxKOl8EK9Pzg6Mc9Dw33mUQC6X0kPJztqmZePuzWwCtmShBJi2cT2bGzDyM3Ds8FHS1aufMjXqEKjEQver0y7MYpIvu8dQyN1WS0Gf-uh_RATzgFlJqN9TdpYTaEC2BWURIr4R8r5lDSAXzUv3g29e6Z_6pz07uZ-oCHQM7MRbt2Uq5G1wi9uM5u-nAHSLl-0GXRR0ujhMt0o9jGoPtWOpO0jhQw7vXZck6NPeMRDfjZQpz-OnGbgV1TcIYMZjGrv_L4twzPhR6uGy1E_q5m9SbIr6hwTB26ol2PbNxcYKBB3rVyP6XxjJri8MRFbaokXROWM7A4Oj7Tcspzse61E",
+ "enc": "shH3GCfs4ASe8Y_Y1-3CFVyNkzuW6estKevha2_uq0g",
+ "requestId": "AAECAwQFBgcICQoLDA0ODw",
+ "suite": "DHKEM-X25519-HKDF-SHA256/HKDF-SHA256/AES-256-GCM",
+ "v": 1
+ },
+ "openAt": 1790000001000,
+ "expectedOpenError": null,
+ "openedValueUtf8": "relay-chosen-token-TEST-ONLY"
+ }
+}
diff --git a/packages/secret-channel/tsconfig.json b/packages/secret-channel/tsconfig.json
new file mode 100644
index 00000000000..d2cd483b8b3
--- /dev/null
+++ b/packages/secret-channel/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "outDir": "./dist",
+
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "lib": ["ES2022"],
+ "types": ["node"]
+ },
+ "exclude": ["node_modules", "dist"],
+ "include": ["src/**/*", "test/**/*"]
+}
diff --git a/packages/secret-channel/vitest.config.mts b/packages/secret-channel/vitest.config.mts
new file mode 100644
index 00000000000..e7babce62ab
--- /dev/null
+++ b/packages/secret-channel/vitest.config.mts
@@ -0,0 +1,8 @@
+import { defineConfig } from 'vitest/config';
+
+export default defineConfig({
+ test: {
+ environment: 'node',
+ include: ['test/**/*.test.ts', 'src/**/*.test.ts'],
+ },
+});