@bitspark/archon-sdk 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,49 @@
1
+ import { type Signer, type SigningRequest } from "./signer.js";
2
+ /** The RFC 8032 context every enrollment proof is made in. */
3
+ export declare const ENROLL_DOMAIN = "archon-enroll/1";
4
+ /** The first byte of every enrollment binding. */
5
+ export declare const ENROLL_VERSION = 1;
6
+ /** The longest purpose, in bytes. */
7
+ export declare const ENROLL_MAX_PURPOSE_SIZE = 255;
8
+ /** The longest transaction id, in bytes. */
9
+ export declare const ENROLL_MAX_TRANSACTION_SIZE = 255;
10
+ /** The intent digest's length: a SHA-256. */
11
+ export declare const ENROLL_DIGEST_SIZE = 32;
12
+ /** A pending enrollment as the service recorded it. */
13
+ export interface EnrollRequest {
14
+ /** The server's fresh entropy, at least the possession scheme's 16 bytes. */
15
+ nonce: Uint8Array;
16
+ /** The pending transaction's id, 1..=255 bytes, opaque. */
17
+ transaction: Uint8Array;
18
+ /** "add-key", "rotate", "recover", …: 1..=255 bytes of UTF-8, no control characters. */
19
+ purpose: string;
20
+ /** The public key being enrolled, exactly PUBLIC_KEY_SIZE bytes. */
21
+ newKey: Uint8Array;
22
+ /** SHA-256 of the service's immutable intent bytes, exactly ENROLL_DIGEST_SIZE bytes. */
23
+ intentDigest: Uint8Array;
24
+ }
25
+ /**
26
+ * The bytes an enrollment proof is bound to, for `req` at `audience`. Throws on a purpose that
27
+ * is empty, over 255 bytes, not UTF-8 or carrying a control character (U+0000–U+001F, U+007F);
28
+ * an audience that is empty, not UTF-8 or carrying a control character; a transaction id that
29
+ * is empty or over 255 bytes; a new key or intent digest of the wrong size; or a binding that
30
+ * would not fit the possession scheme's u16 field.
31
+ */
32
+ export declare function enrollBinding(audience: string, req: EnrollRequest): Uint8Array;
33
+ /**
34
+ * The enrollment proof: possession by the key behind `seed` — which must be `req.newKey` — in
35
+ * ENROLL_DOMAIN, over `req.nonce` and `enrollBinding(audience, req)`. Throws for what the binding
36
+ * throws, for a short nonce, for a seed of the wrong size, and for a seed that is not the new
37
+ * key: only the key being enrolled can prove it holds itself.
38
+ */
39
+ export declare function proveEnroll(seed: Uint8Array, audience: string, req: EnrollRequest): Uint8Array;
40
+ /** Whether `signature` is the enrollment proof by `req.newKey` for `req` at `audience`. Total. */
41
+ export declare function verifyEnroll(audience: string, req: EnrollRequest, signature: Uint8Array): boolean;
42
+ /**
43
+ * The signing request the enrollment proof needs (ADR 0009 §4). Pure. The expected key is
44
+ * `req.newKey`, so only that key's signer can complete it — `proveEnroll`'s refusal of any other
45
+ * seed, carried into the request itself. Complete it with `completePossession`.
46
+ */
47
+ export declare function prepareEnroll(audience: string, req: EnrollRequest): SigningRequest;
48
+ /** `proveEnroll` through a signer instead of a seed. A signer for any other key is refused. */
49
+ export declare function proveEnrollWith(signer: Signer, audience: string, req: EnrollRequest, signal?: AbortSignal): Promise<Uint8Array>;
@@ -0,0 +1,140 @@
1
+ // Key enrollment — THIS NEW KEY BELONGS TO THIS ACCOUNT (ADR 0010 §7; docs/request.md §6,
2
+ // version 1, fixed by ADR 0010's status note of 4 October 2026).
3
+ //
4
+ // Login has a person approve a browser key. Enrollment is a different statement: a NEW key
5
+ // proves its own possession, while a separate authority — a session, or a bootstrap credential
6
+ // — says whose key it becomes. That authority lives in the service's pending transaction
7
+ // record, never in this proof: the service creates the record only after validating the
8
+ // authority, and the verifier rebuilds the binding from that record and its configured
9
+ // audience. A completion request names the transaction and carries the proof, nothing more.
10
+ //
11
+ // The proof is the possession scheme with the server's fresh nonce, in ENROLL_DOMAIN, over
12
+ //
13
+ // version ‖ u16be(len purpose) ‖ purpose ‖ u16be(len audience) ‖ audience
14
+ // ‖ u16be(len transaction) ‖ transaction ‖ new_key[32] ‖ intent_digest[32]
15
+ //
16
+ // The intent digest is the service's SHA-256 of its immutable enrollment intent; archon binds
17
+ // the 32 bytes and never reads what they digest. Enrollment shows that an account and a key are
18
+ // associated — not that the key is non-exportable, lives on one device, or is used by one
19
+ // process.
20
+ import { getPublicKey, PUBLIC_KEY_SIZE, SEED_SIZE } from "@bitspark/archon";
21
+ import { completePossession, MAX_FIELD_SIZE as POSSESSION_MAX_FIELD_SIZE, preparePossession, provePossession, verifyPossession, } from "./possession.js";
22
+ import { signWith } from "./signer.js";
23
+ /** The RFC 8032 context every enrollment proof is made in. */
24
+ export const ENROLL_DOMAIN = "archon-enroll/1";
25
+ /** The first byte of every enrollment binding. */
26
+ export const ENROLL_VERSION = 0x01;
27
+ /** The longest purpose, in bytes. */
28
+ export const ENROLL_MAX_PURPOSE_SIZE = 255;
29
+ /** The longest transaction id, in bytes. */
30
+ export const ENROLL_MAX_TRANSACTION_SIZE = 255;
31
+ /** The intent digest's length: a SHA-256. */
32
+ export const ENROLL_DIGEST_SIZE = 32;
33
+ const utf8 = new TextEncoder();
34
+ /**
35
+ * The bytes an enrollment proof is bound to, for `req` at `audience`. Throws on a purpose that
36
+ * is empty, over 255 bytes, not UTF-8 or carrying a control character (U+0000–U+001F, U+007F);
37
+ * an audience that is empty, not UTF-8 or carrying a control character; a transaction id that
38
+ * is empty or over 255 bytes; a new key or intent digest of the wrong size; or a binding that
39
+ * would not fit the possession scheme's u16 field.
40
+ */
41
+ export function enrollBinding(audience, req) {
42
+ const purpose = checkText("purpose", req.purpose);
43
+ if (purpose.length > ENROLL_MAX_PURPOSE_SIZE) {
44
+ throw new Error(`enroll: purpose is ${purpose.length} bytes, want 1..=${ENROLL_MAX_PURPOSE_SIZE}`);
45
+ }
46
+ const aud = checkText("audience", audience);
47
+ if (req.transaction.length === 0 || req.transaction.length > ENROLL_MAX_TRANSACTION_SIZE) {
48
+ throw new Error(`enroll: transaction is ${req.transaction.length} bytes, want 1..=${ENROLL_MAX_TRANSACTION_SIZE}`);
49
+ }
50
+ if (req.newKey.length !== PUBLIC_KEY_SIZE) {
51
+ throw new Error(`enroll: new key is ${req.newKey.length} bytes, want ${PUBLIC_KEY_SIZE}`);
52
+ }
53
+ if (req.intentDigest.length !== ENROLL_DIGEST_SIZE) {
54
+ throw new Error(`enroll: intent digest is ${req.intentDigest.length} bytes, want ${ENROLL_DIGEST_SIZE}`);
55
+ }
56
+ const size = 1 + 2 + purpose.length + 2 + aud.length + 2 + req.transaction.length + PUBLIC_KEY_SIZE + ENROLL_DIGEST_SIZE;
57
+ if (size > POSSESSION_MAX_FIELD_SIZE) {
58
+ throw new Error(`enroll: binding is ${size} bytes, over the possession scheme's ${POSSESSION_MAX_FIELD_SIZE}`);
59
+ }
60
+ const out = new Uint8Array(size);
61
+ let at = 0;
62
+ out[at++] = ENROLL_VERSION;
63
+ at = putField(out, at, purpose);
64
+ at = putField(out, at, aud);
65
+ at = putField(out, at, req.transaction);
66
+ out.set(req.newKey, at);
67
+ at += PUBLIC_KEY_SIZE;
68
+ out.set(req.intentDigest, at);
69
+ return out;
70
+ }
71
+ /**
72
+ * The enrollment proof: possession by the key behind `seed` — which must be `req.newKey` — in
73
+ * ENROLL_DOMAIN, over `req.nonce` and `enrollBinding(audience, req)`. Throws for what the binding
74
+ * throws, for a short nonce, for a seed of the wrong size, and for a seed that is not the new
75
+ * key: only the key being enrolled can prove it holds itself.
76
+ */
77
+ export function proveEnroll(seed, audience, req) {
78
+ if (seed.length !== SEED_SIZE)
79
+ throw new Error(`enroll: seed is ${seed.length} bytes, want ${SEED_SIZE}`);
80
+ const pub = getPublicKey(seed);
81
+ if (pub.length !== req.newKey.length || !pub.every((b, i) => b === req.newKey[i])) {
82
+ throw new Error("enroll: seed is not the new key the request names");
83
+ }
84
+ return provePossession(seed, ENROLL_DOMAIN, req.nonce, enrollBinding(audience, req));
85
+ }
86
+ /** Whether `signature` is the enrollment proof by `req.newKey` for `req` at `audience`. Total. */
87
+ export function verifyEnroll(audience, req, signature) {
88
+ let binding;
89
+ try {
90
+ binding = enrollBinding(audience, req);
91
+ }
92
+ catch {
93
+ return false;
94
+ }
95
+ return verifyPossession(req.newKey, ENROLL_DOMAIN, req.nonce, binding, signature);
96
+ }
97
+ /**
98
+ * The signing request the enrollment proof needs (ADR 0009 §4). Pure. The expected key is
99
+ * `req.newKey`, so only that key's signer can complete it — `proveEnroll`'s refusal of any other
100
+ * seed, carried into the request itself. Complete it with `completePossession`.
101
+ */
102
+ export function prepareEnroll(audience, req) {
103
+ return preparePossession(req.newKey, ENROLL_DOMAIN, req.nonce, enrollBinding(audience, req));
104
+ }
105
+ /** `proveEnroll` through a signer instead of a seed. A signer for any other key is refused. */
106
+ export async function proveEnrollWith(signer, audience, req, signal) {
107
+ const request = prepareEnroll(audience, req);
108
+ return completePossession(request, await signWith(signer, request, signal));
109
+ }
110
+ /** Throws unless `s` is non-empty, well-formed UTF-8 (no lone surrogate) with no control
111
+ * character; returns its UTF-8 bytes. */
112
+ function checkText(what, s) {
113
+ if (!isWellFormed(s))
114
+ throw new Error(`enroll: ${what} is not well-formed UTF-16 (a lone surrogate is not UTF-8)`);
115
+ for (const ch of s) {
116
+ const cp = ch.codePointAt(0);
117
+ if (cp < 0x20 || cp === 0x7f) {
118
+ throw new Error(`enroll: ${what} carries a control character U+${cp.toString(16).toUpperCase().padStart(4, "0")}`);
119
+ }
120
+ }
121
+ const bytes = utf8.encode(s);
122
+ if (bytes.length === 0 || bytes.length > POSSESSION_MAX_FIELD_SIZE) {
123
+ throw new Error(`enroll: ${what} is ${bytes.length} bytes, want 1..=${POSSESSION_MAX_FIELD_SIZE}`);
124
+ }
125
+ return bytes;
126
+ }
127
+ function isWellFormed(s) {
128
+ const native = s.isWellFormed;
129
+ if (typeof native === "function")
130
+ return native.call(s);
131
+ return !/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/.test(s);
132
+ }
133
+ /** Writes u16be(len field) ‖ field at `at`; returns the new offset. */
134
+ function putField(out, at, field) {
135
+ out[at++] = (field.length >> 8) & 0xff;
136
+ out[at++] = field.length & 0xff;
137
+ out.set(field, at);
138
+ return at + field.length;
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,CAAC,EAAE,CAAC,CAAC;QACrH,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,yBAAyB,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,OAAO,KAAK,CAAC,MAAM,oBAAoB,yBAAyB,EAAE,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,CAAS;IAC7B,MAAM,MAAM,GAAI,CAAiD,CAAC,YAAY,CAAC;IAC/E,IAAI,OAAO,MAAM,KAAK,UAAU;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,wEAAwE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED,uEAAuE;AACvE,SAAS,QAAQ,CAAC,GAAe,EAAE,EAAU,EAAE,KAAiB;IAC9D,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACvC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnB,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;AAC3B,CAAC"}
@@ -3,3 +3,5 @@ export * from "./possession.js";
3
3
  export * from "./envelope.js";
4
4
  export * from "./login.js";
5
5
  export * from "./login-audience.js";
6
+ export * from "./enroll.js";
7
+ export * from "./request.js";
package/dist/src/index.js CHANGED
@@ -21,4 +21,6 @@ export * from "./possession.js";
21
21
  export * from "./envelope.js";
22
22
  export * from "./login.js";
23
23
  export * from "./login-audience.js";
24
+ export * from "./enroll.js";
25
+ export * from "./request.js";
24
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,uFAAuF;AACvF,wEAAwE;AACxE,EAAE;AACF,qFAAqF;AACrF,kEAAkE;AAClE,gFAAgF;AAChF,EAAE;AACF,6FAA6F;AAC7F,8FAA8F;AAC9F,wBAAwB;AACxB,EAAE;AACF,+EAA+E;AAC/E,yFAAyF;AACzF,sFAAsF;AACtF,uFAAuF;AACvF,+CAA+C;AAC/C,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,uFAAuF;AACvF,wEAAwE;AACxE,EAAE;AACF,qFAAqF;AACrF,kEAAkE;AAClE,gFAAgF;AAChF,EAAE;AACF,6FAA6F;AAC7F,8FAA8F;AAC9F,wBAAwB;AACxB,EAAE;AACF,+EAA+E;AAC/E,yFAAyF;AACzF,sFAAsF;AACtF,uFAAuF;AACvF,+CAA+C;AAC/C,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { type Signer, type SigningRequest } from "./signer.js";
2
+ /** The RFC 8032 context every request signature is made in. */
3
+ export declare const REQUEST_DOMAIN = "archon-request/1";
4
+ /** The `tag` signature parameter; a verifier accepts only this. */
5
+ export declare const REQUEST_TAG = "archon-request/1";
6
+ /** The one dictionary member in Signature-Input and Signature. */
7
+ export declare const REQUEST_LABEL = "archon";
8
+ /** The nonce's least and greatest size, in bytes. */
9
+ export declare const REQUEST_MIN_NONCE_SIZE = 16;
10
+ export declare const REQUEST_MAX_NONCE_SIZE = 64;
11
+ /** The longest request-target, and the longest covered value, in bytes. */
12
+ export declare const REQUEST_MAX_TARGET_SIZE = 8192;
13
+ export declare const REQUEST_MAX_VALUE_SIZE = 8192;
14
+ /** The largest integer the profile spells: 15 digits. */
15
+ export declare const REQUEST_MAX_INT = 999999999999999;
16
+ /** What a client signs. `declared` holds the product-declared headers the request carries, in
17
+ * the product's declared order, names in lowercase. */
18
+ export interface RequestToSign {
19
+ method: string;
20
+ audience: string;
21
+ requestTarget: string;
22
+ body: Uint8Array;
23
+ contentType?: string | undefined;
24
+ declared: ReadonlyArray<readonly [string, string]>;
25
+ created: number;
26
+ expires: number;
27
+ nonce: Uint8Array;
28
+ }
29
+ /** The four headers archon adds to a request, named in lowercase. */
30
+ export interface RequestHeaders {
31
+ "archon-audience": string;
32
+ "content-digest": string;
33
+ "signature-input": string;
34
+ signature: string;
35
+ }
36
+ /** A request prepared for a signer: the base it will sign, and the signing request. */
37
+ export interface PreparedRequest {
38
+ base: string;
39
+ signing: SigningRequest;
40
+ headers: Omit<RequestHeaders, "signature">;
41
+ }
42
+ /** What a verifier is configured with. */
43
+ export interface RequestPolicy {
44
+ audience: string;
45
+ declared: readonly string[];
46
+ /** W: the longest acceptable `expires − created`, in seconds. */
47
+ maxLifetime: number;
48
+ /** δ: the clock tolerance, in seconds. */
49
+ skew: number;
50
+ }
51
+ /** A request as the server received it: the method, the raw request-target, every header field
52
+ * in the order received (names in any case), and the body after transfer framing. */
53
+ export interface ReceivedRequest {
54
+ method: string;
55
+ requestTarget: string;
56
+ headers: ReadonlyArray<readonly [string, string]>;
57
+ body: Uint8Array;
58
+ }
59
+ /** A proof that checked out under the policy at `now`. Not yet replay-checked. */
60
+ export interface VerifiedRequest {
61
+ principal: Uint8Array;
62
+ keyText: string;
63
+ created: number;
64
+ expires: number;
65
+ nonce: Uint8Array;
66
+ method: string;
67
+ targetUri: string;
68
+ /** Every covered field, in coverage order, with the value that was verified. */
69
+ covered: Array<[string, string]>;
70
+ contentDigest: Uint8Array;
71
+ }
72
+ /** The origin of an audience, or a throw: docs/request.md §3.1. */
73
+ export declare function requestOrigin(audience: string): string;
74
+ /** The RFC 9421 signature base: one `"<name>": <value>` line per covered component, then
75
+ * `"@signature-params": <inner list>` with no trailing line feed (docs/request.md §4). */
76
+ export declare function requestSignatureBase(components: ReadonlyArray<readonly [string, string]>, innerList: string): string;
77
+ /** The base and headers for `input`, for a signer whose key is `publicKey`. Pure; throws on any
78
+ * value outside docs/request.md §3.1. */
79
+ export declare function prepareRequest(publicKey: Uint8Array, input: RequestToSign): PreparedRequest;
80
+ /** The headers, from a signature over a prepared request: checked against it first. Pure. */
81
+ export declare function completeRequest(prepared: PreparedRequest, signature: Uint8Array): RequestHeaders;
82
+ /** Sign `input` with the key behind `seed`: the base, and the four headers to send. */
83
+ export declare function signRequest(seed: Uint8Array, input: RequestToSign): {
84
+ base: string;
85
+ headers: RequestHeaders;
86
+ };
87
+ /** `signRequest` through a signer instead of a seed. */
88
+ export declare function signRequestWith(signer: Signer, input: RequestToSign, signal?: AbortSignal): Promise<RequestHeaders>;
89
+ /**
90
+ * Verify `received` under `policy` at `now` (seconds since the epoch): docs/request.md §7 steps
91
+ * 1–7. Throws on any refusal; returns what was verified. It does not check replay: a server
92
+ * adapter must insert (REQUEST_TAG, audience, principal, nonce) into its replay store before the
93
+ * request reaches an application.
94
+ */
95
+ export declare function verifyRequest(policy: RequestPolicy, now: number, received: ReceivedRequest): VerifiedRequest;
@@ -0,0 +1,305 @@
1
+ // Request authentication — THIS KEY MADE THIS HTTP REQUEST (ADR 0010 §2–§6; docs/request.md
2
+ // §3–§5 and §7, version 1, fixed by ADR 0010's status note of 4 October 2026).
3
+ //
4
+ // archon's RFC 9421 application profile: the client signs the RFC 9421 signature base directly,
5
+ // in domain REQUEST_DOMAIN, with archon's construction (Ed25519ph with the domain as the RFC 8032
6
+ // context), and `alg` is never sent — the registered `ed25519` is pure Ed25519. The coverage is
7
+ // fixed: the method, the full target URI, the configured audience as a CHECKED ECHO, a SHA-256
8
+ // Content-Digest, Content-Type if present, and every product-declared header the request carries.
9
+ //
10
+ // This file is the sdk's part (ADR 0010 §1): the transcript, the strict parsing, the coverage
11
+ // rule and pure verification. Time is an argument, as everywhere in this package. What it does
12
+ // NOT do is remember: one-use enforcement (the replay store) and the HTTP extraction belong to the
13
+ // server adapters, so a VerifiedRequest is a proof that checked out, not yet a request that may
14
+ // reach an application.
15
+ import { sha256 } from "@noble/hashes/sha2.js";
16
+ import { decodeKey, encodeKey, getPublicKey, signInDomain, verifyInDomain, PUBLIC_KEY_SIZE } from "@bitspark/archon";
17
+ import { checkSignature, signWith } from "./signer.js";
18
+ /** The RFC 8032 context every request signature is made in. */
19
+ export const REQUEST_DOMAIN = "archon-request/1";
20
+ /** The `tag` signature parameter; a verifier accepts only this. */
21
+ export const REQUEST_TAG = "archon-request/1";
22
+ /** The one dictionary member in Signature-Input and Signature. */
23
+ export const REQUEST_LABEL = "archon";
24
+ /** The nonce's least and greatest size, in bytes. */
25
+ export const REQUEST_MIN_NONCE_SIZE = 16;
26
+ export const REQUEST_MAX_NONCE_SIZE = 64;
27
+ /** The longest request-target, and the longest covered value, in bytes. */
28
+ export const REQUEST_MAX_TARGET_SIZE = 8192;
29
+ export const REQUEST_MAX_VALUE_SIZE = 8192;
30
+ /** The largest integer the profile spells: 15 digits. */
31
+ export const REQUEST_MAX_INT = 999_999_999_999_999;
32
+ const utf8 = new TextEncoder();
33
+ const TCHAR = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
34
+ const VISIBLE = /^[\x21-\x7e]+$/;
35
+ const RESERVED = new Set(["archon-audience", "content-digest", "content-type", "signature-input", "signature"]);
36
+ /** The origin of an audience, or a throw: docs/request.md §3.1. */
37
+ export function requestOrigin(audience) {
38
+ if (!VISIBLE.test(audience))
39
+ throw new Error("request: the audience is not visible ASCII");
40
+ const m = /^(https?:\/\/)([^/]*)(\/.*)?$/.exec(audience);
41
+ if (m === null)
42
+ throw new Error("request: the audience is not an http or https URL");
43
+ const authority = m[2];
44
+ if (authority === "" || authority.includes("@"))
45
+ throw new Error("request: the audience's authority is empty or carries userinfo");
46
+ if (/[?#]/.test(audience))
47
+ throw new Error("request: the audience carries a query or a fragment");
48
+ if (audience.endsWith("/"))
49
+ throw new Error("request: the audience ends in /");
50
+ return m[1] + authority;
51
+ }
52
+ function checkMethod(method) {
53
+ if (!TCHAR.test(method))
54
+ throw new Error("request: the method is not a token");
55
+ }
56
+ function checkTarget(target) {
57
+ if (target.length === 0 || target.length > REQUEST_MAX_TARGET_SIZE)
58
+ throw new Error("request: the request-target's length");
59
+ if (!target.startsWith("/") || !VISIBLE.test(target) || target.includes("#")) {
60
+ throw new Error("request: the request-target is not origin form");
61
+ }
62
+ }
63
+ /** A covered value, trimmed of leading and trailing SP and HTAB, or a throw. */
64
+ function coveredValue(value) {
65
+ const v = value.replace(/^[ \t]+|[ \t]+$/g, "");
66
+ if (v.length === 0 || v.length > REQUEST_MAX_VALUE_SIZE || !/^[\t\x20-\x7e]+$/.test(v)) {
67
+ throw new Error("request: a covered value is empty, too long, or not visible ASCII, SP and HTAB");
68
+ }
69
+ return v;
70
+ }
71
+ function checkDeclaredName(name) {
72
+ if (!/^[a-z0-9-]+$/.test(name) || RESERVED.has(name))
73
+ throw new Error(`request: ${JSON.stringify(name)} cannot be a declared header`);
74
+ }
75
+ function checkInt(n, what) {
76
+ if (!Number.isInteger(n) || n < 0 || n > REQUEST_MAX_INT)
77
+ throw new Error(`request: ${what} is not an integer in 0..=${REQUEST_MAX_INT}`);
78
+ }
79
+ function checkNonce(nonce) {
80
+ if (nonce.length < REQUEST_MIN_NONCE_SIZE || nonce.length > REQUEST_MAX_NONCE_SIZE) {
81
+ throw new Error(`request: the nonce is ${nonce.length} bytes, want ${REQUEST_MIN_NONCE_SIZE}..=${REQUEST_MAX_NONCE_SIZE}`);
82
+ }
83
+ }
84
+ /** The RFC 9421 signature base: one `"<name>": <value>` line per covered component, then
85
+ * `"@signature-params": <inner list>` with no trailing line feed (docs/request.md §4). */
86
+ export function requestSignatureBase(components, innerList) {
87
+ return components.map(([n, v]) => `"${n}": ${v}\n`).join("") + `"@signature-params": ${innerList}`;
88
+ }
89
+ function contentDigestHeader(body) {
90
+ return `sha-256=:${b64Encode(sha256(body), B64, true)}:`;
91
+ }
92
+ /** The base and headers for `input`, for a signer whose key is `publicKey`. Pure; throws on any
93
+ * value outside docs/request.md §3.1. */
94
+ export function prepareRequest(publicKey, input) {
95
+ if (publicKey.length !== PUBLIC_KEY_SIZE)
96
+ throw new Error("request: the public key is not 32 bytes");
97
+ checkMethod(input.method);
98
+ const origin = requestOrigin(input.audience);
99
+ checkTarget(input.requestTarget);
100
+ checkInt(input.created, "created");
101
+ checkInt(input.expires, "expires");
102
+ if (input.created >= input.expires)
103
+ throw new Error("request: created must be before expires");
104
+ checkNonce(input.nonce);
105
+ const digest = contentDigestHeader(input.body);
106
+ const components = [
107
+ ["@method", input.method],
108
+ ["@target-uri", origin + input.requestTarget],
109
+ ["archon-audience", input.audience],
110
+ ["content-digest", digest],
111
+ ];
112
+ if (input.contentType !== undefined)
113
+ components.push(["content-type", coveredValue(input.contentType)]);
114
+ const seen = new Set();
115
+ for (const [name, value] of input.declared) {
116
+ checkDeclaredName(name);
117
+ if (seen.has(name))
118
+ throw new Error(`request: ${name} is declared twice`);
119
+ seen.add(name);
120
+ components.push([name, coveredValue(value)]);
121
+ }
122
+ const keyText = encodeKey(publicKey);
123
+ const inner = `(${components.map(([n]) => `"${n}"`).join(" ")});created=${input.created};expires=${input.expires}` +
124
+ `;nonce="${b64Encode(input.nonce, B64URL, false)}";keyid="${keyText}";tag="${REQUEST_TAG}"`;
125
+ const base = requestSignatureBase(components, inner);
126
+ return {
127
+ base,
128
+ signing: { expectedPublicKey: publicKey, scheme: { kind: "ed25519ph-context", domain: REQUEST_DOMAIN }, message: utf8.encode(base) },
129
+ headers: { "archon-audience": input.audience, "content-digest": digest, "signature-input": `${REQUEST_LABEL}=${inner}` },
130
+ };
131
+ }
132
+ /** The headers, from a signature over a prepared request: checked against it first. Pure. */
133
+ export function completeRequest(prepared, signature) {
134
+ checkSignature(prepared.signing, signature);
135
+ return { ...prepared.headers, signature: `${REQUEST_LABEL}=:${b64Encode(signature, B64, true)}:` };
136
+ }
137
+ /** Sign `input` with the key behind `seed`: the base, and the four headers to send. */
138
+ export function signRequest(seed, input) {
139
+ const prepared = prepareRequest(getPublicKey(seed), input);
140
+ const signature = signInDomain(seed, REQUEST_DOMAIN, prepared.signing.message);
141
+ return { base: prepared.base, headers: completeRequest(prepared, signature) };
142
+ }
143
+ /** `signRequest` through a signer instead of a seed. */
144
+ export async function signRequestWith(signer, input, signal) {
145
+ const prepared = prepareRequest(signer.publicKey, input);
146
+ return completeRequest(prepared, await signWith(signer, prepared.signing, signal));
147
+ }
148
+ const SIGNATURE_INPUT = /^archon=\(("[^"]*"(?: "[^"]*")*)\);created=(0|[1-9][0-9]{0,14});expires=(0|[1-9][0-9]{0,14});nonce="([A-Za-z0-9_-]+)";keyid="([^"\\]*)";tag="archon-request\/1"$/;
149
+ const SIGNATURE = /^archon=:([A-Za-z0-9+/=]+):$/;
150
+ const CONTENT_DIGEST = /^sha-256=:([A-Za-z0-9+/=]+):$/;
151
+ /**
152
+ * Verify `received` under `policy` at `now` (seconds since the epoch): docs/request.md §7 steps
153
+ * 1–7. Throws on any refusal; returns what was verified. It does not check replay: a server
154
+ * adapter must insert (REQUEST_TAG, audience, principal, nonce) into its replay store before the
155
+ * request reaches an application.
156
+ */
157
+ export function verifyRequest(policy, now, received) {
158
+ const origin = requestOrigin(policy.audience);
159
+ const declared = new Set();
160
+ for (const d of policy.declared) {
161
+ checkDeclaredName(d);
162
+ if (declared.has(d))
163
+ throw new Error(`request: ${d} is declared twice`);
164
+ declared.add(d);
165
+ }
166
+ checkInt(policy.maxLifetime, "max_lifetime");
167
+ if (policy.maxLifetime < 1)
168
+ throw new Error("request: max_lifetime must be at least 1");
169
+ checkInt(policy.skew, "skew");
170
+ checkInt(now, "now");
171
+ const fields = new Map();
172
+ for (const [name, value] of received.headers) {
173
+ // ASCII case folding only: HTTP field names are tokens, and Unicode folding would turn
174
+ // U+212A KELVIN SIGN into `k` — a different header in a lane that folds ASCII only.
175
+ const key = name.replace(/[A-Z]/g, (ch) => ch.toLowerCase());
176
+ const list = fields.get(key) ?? [];
177
+ list.push(value.replace(/^[ \t]+|[ \t]+$/g, ""));
178
+ fields.set(key, list);
179
+ }
180
+ const once = (name) => {
181
+ const list = fields.get(name);
182
+ if (list === undefined || list.length !== 1)
183
+ throw new Error(`request: ${name} must appear exactly once`);
184
+ return list[0];
185
+ };
186
+ // 1. The two proof fields parse, in their one spelling.
187
+ const si = SIGNATURE_INPUT.exec(once("signature-input"));
188
+ if (si === null)
189
+ throw new Error("request: Signature-Input is not the profile's spelling");
190
+ const sigText = SIGNATURE.exec(once("signature"));
191
+ if (sigText === null)
192
+ throw new Error("request: Signature is not the profile's spelling");
193
+ const signature = b64Decode(sigText[1], B64, true);
194
+ if (signature.length !== 64)
195
+ throw new Error("request: the signature is not 64 bytes");
196
+ const names = si[1].split(" ").map((q) => q.slice(1, -1));
197
+ const created = Number(si[2]);
198
+ const expires = Number(si[3]);
199
+ const nonce = b64Decode(si[4], B64URL, false);
200
+ checkNonce(nonce);
201
+ // 2. keyid is a canonical principal (the tag was matched by the grammar).
202
+ const keyText = si[5];
203
+ let principal;
204
+ try {
205
+ principal = decodeKey(keyText);
206
+ }
207
+ catch {
208
+ throw new Error("request: keyid is not a principal");
209
+ }
210
+ if (encodeKey(principal) !== keyText)
211
+ throw new Error("request: keyid is not the canonical key text");
212
+ // 3. The coverage is exactly §3.1's, for what this request carries.
213
+ const expected = ["@method", "@target-uri", "archon-audience", "content-digest"];
214
+ if (fields.has("content-type"))
215
+ expected.push("content-type");
216
+ for (const d of policy.declared)
217
+ if (fields.has(d))
218
+ expected.push(d);
219
+ if (names.length !== expected.length || names.some((n, i) => n !== expected[i])) {
220
+ throw new Error("request: the coverage is not the profile's for this request");
221
+ }
222
+ checkMethod(received.method);
223
+ checkTarget(received.requestTarget);
224
+ const components = [];
225
+ for (const n of names) {
226
+ if (n === "@method")
227
+ components.push([n, received.method]);
228
+ else if (n === "@target-uri")
229
+ components.push([n, origin + received.requestTarget]);
230
+ else
231
+ components.push([n, coveredValue(once(n))]);
232
+ }
233
+ // 4. The audience echo is the configured audience, byte for byte.
234
+ if (once("archon-audience") !== policy.audience)
235
+ throw new Error("request: Archon-Audience is not the configured audience");
236
+ // 5. The digest is the received content's.
237
+ const cd = CONTENT_DIGEST.exec(once("content-digest"));
238
+ if (cd === null)
239
+ throw new Error("request: Content-Digest is not the profile's spelling");
240
+ const contentDigest = b64Decode(cd[1], B64, true);
241
+ const actual = sha256(received.body);
242
+ if (contentDigest.length !== actual.length || contentDigest.some((b, i) => b !== actual[i])) {
243
+ throw new Error("request: Content-Digest does not match the content");
244
+ }
245
+ // 6. Freshness: 0 < e − c ≤ W and c − δ ≤ now < e + δ.
246
+ if (!(created < expires && expires - created <= policy.maxLifetime))
247
+ throw new Error("request: the lifetime is out of bounds");
248
+ if (!(created - policy.skew <= now && now < expires + policy.skew))
249
+ throw new Error("request: not fresh at now");
250
+ // 7. The signature, over the base built from what was received and configured.
251
+ const base = requestSignatureBase(components, si[0].slice(REQUEST_LABEL.length + 1));
252
+ if (!verifyInDomain(principal, REQUEST_DOMAIN, utf8.encode(base), signature))
253
+ throw new Error("request: the signature does not verify");
254
+ return {
255
+ principal,
256
+ keyText,
257
+ created,
258
+ expires,
259
+ nonce,
260
+ method: received.method,
261
+ targetUri: origin + received.requestTarget,
262
+ covered: components.filter(([n]) => !n.startsWith("@")),
263
+ contentDigest,
264
+ };
265
+ }
266
+ // ---------------------------------------------------------------------------------------------
267
+ // base64, both alphabets, accepted only in their one canonical spelling (docs/request.md §3.1):
268
+ // decoding and re-encoding must give back the same text.
269
+ // ---------------------------------------------------------------------------------------------
270
+ const B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
271
+ const B64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
272
+ function b64Encode(bytes, alphabet, pad) {
273
+ let out = "";
274
+ for (let i = 0; i < bytes.length; i += 3) {
275
+ const n = (bytes[i] << 16) | ((bytes[i + 1] ?? 0) << 8) | (bytes[i + 2] ?? 0);
276
+ const chars = Math.min(4, Math.ceil(((bytes.length - i) * 8) / 6));
277
+ for (let j = 0; j < chars; j++)
278
+ out += alphabet[(n >> (18 - 6 * j)) & 63];
279
+ if (pad)
280
+ out += "=".repeat(4 - chars);
281
+ }
282
+ return out;
283
+ }
284
+ function b64Decode(text, alphabet, pad) {
285
+ const body = pad ? text.replace(/=+$/, "") : text;
286
+ const bytes = [];
287
+ let acc = 0;
288
+ let bits = 0;
289
+ for (const ch of body) {
290
+ const v = alphabet.indexOf(ch);
291
+ if (v < 0)
292
+ throw new Error("request: not base64");
293
+ acc = (acc << 6) | v;
294
+ bits += 6;
295
+ if (bits >= 8) {
296
+ bits -= 8;
297
+ bytes.push((acc >> bits) & 0xff);
298
+ }
299
+ }
300
+ const out = new Uint8Array(bytes);
301
+ if (b64Encode(out, alphabet, pad) !== text)
302
+ throw new Error("request: not the canonical base64 spelling");
303
+ return out;
304
+ }
305
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,+EAA+E;AAC/E,EAAE;AACF,gGAAgG;AAChG,kGAAkG;AAClG,gGAAgG;AAChG,+FAA+F;AAC/F,kGAAkG;AAClG,EAAE;AACF,8FAA8F;AAC9F,+FAA+F;AAC/F,mGAAmG;AACnG,gGAAgG;AAChG,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ACD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC1G,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitspark/archon-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "archon-sdk: proof of possession and the signed envelope, one layer above the identity floor. Deterministic given its inputs; no RNG, no clock, no socket.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -22,7 +22,8 @@
22
22
  "test": "tsc -p tsconfig.json && node --test dist/test/*.test.js"
23
23
  },
24
24
  "dependencies": {
25
- "@bitspark/archon": "^0.9.0"
25
+ "@bitspark/archon": "^0.10.0",
26
+ "@noble/hashes": "^2.2.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/node": "^26",