@ziffer-io/verify 0.1.1 → 0.2.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.
- package/dist/cbor.d.ts +87 -0
- package/dist/cbor.d.ts.map +1 -0
- package/dist/cbor.js +326 -0
- package/dist/cbor.js.map +1 -0
- package/dist/clauses.d.ts +70 -0
- package/dist/clauses.d.ts.map +1 -1
- package/dist/clauses.js +77 -0
- package/dist/clauses.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/quorum.d.ts +245 -0
- package/dist/quorum.d.ts.map +1 -0
- package/dist/quorum.js +566 -0
- package/dist/quorum.js.map +1 -0
- package/dist/sig.d.ts +57 -0
- package/dist/sig.d.ts.map +1 -0
- package/dist/sig.js +127 -0
- package/dist/sig.js.map +1 -0
- package/dist/testkeys.d.ts +33 -0
- package/dist/testkeys.d.ts.map +1 -1
- package/dist/testkeys.js +100 -0
- package/dist/testkeys.js.map +1 -1
- package/dist/verify.d.ts +44 -20
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +55 -146
- package/dist/verify.js.map +1 -1
- package/dist/webauthn.d.ts +148 -0
- package/dist/webauthn.d.ts.map +1 -0
- package/dist/webauthn.js +414 -0
- package/dist/webauthn.js.map +1 -0
- package/dist/wire.d.ts +44 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +90 -0
- package/dist/wire.js.map +1 -0
- package/package.json +2 -2
package/dist/cbor.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AT-8a canonical CBOR (RFC 8949 §4.2) -- the ONE primitive this package did
|
|
3
|
+
* not already have, added for §8.6c and for nothing else.
|
|
4
|
+
*
|
|
5
|
+
* # Why a new module rather than a reused one
|
|
6
|
+
*
|
|
7
|
+
* `canon.ts` is the canonical JSON encoding, and it is the right preimage for
|
|
8
|
+
* every hash this verifier takes: the engine's `attestation_id` and AB-1 entry
|
|
9
|
+
* digest are `sha256:` over `acp_executor.canon` / `receipt.rs::canon`, both
|
|
10
|
+
* JSON, and this package reproduces those bytes. What CBOR is needed for is
|
|
11
|
+
* narrower and unavoidable: HM-3 says a human attester's assertion is canonical
|
|
12
|
+
* CBOR of `{authenticator_data, client_data_json, signature}`, and HM-1 says the
|
|
13
|
+
* credential's `public_key` is a COSE_Key, which is CBOR by RFC 9052. Those two
|
|
14
|
+
* byte strings arrive from the wire and must be DECODED; no JSON encoder can
|
|
15
|
+
* read them. So this is a decoder for two fixed shapes, not a general codec.
|
|
16
|
+
*
|
|
17
|
+
* The engine's twins are `crates/acp-crypto/src/cbor.rs` and
|
|
18
|
+
* `reference/src/acp_crypto.py`'s `_enc` / `_dec` / `decode_canonical`, and the
|
|
19
|
+
* rule this file takes from them verbatim is the last one:
|
|
20
|
+
*
|
|
21
|
+
* # Canonicity is proved by RE-ENCODING, not by a list of sub-rules
|
|
22
|
+
*
|
|
23
|
+
* {@link decodeCanonical} parses, re-encodes what it parsed, and refuses the
|
|
24
|
+
* input unless the two byte strings are identical. That single comparison
|
|
25
|
+
* carries every §4.2 requirement at once -- shortest-form arguments, definite
|
|
26
|
+
* lengths, map keys sorted by their ENCODED bytes, no duplicate keys -- and it
|
|
27
|
+
* cannot drift from the encoder the way a hand-written checklist of those rules
|
|
28
|
+
* can. The decoder still refuses the coarse violations itself (indefinite
|
|
29
|
+
* lengths, non-shortest arguments, reserved additional information) because a
|
|
30
|
+
* decoder that accepted them would have to invent a canonical form to compare
|
|
31
|
+
* against, and inventing one is normalising.
|
|
32
|
+
*
|
|
33
|
+
* Refused, never normalised (AT-8a): the AB-1 entry digest is taken over the
|
|
34
|
+
* bytes that arrived, so a second encoding of one assertion is a second digest
|
|
35
|
+
* for one human decision, and accepting both would put two receipt identities
|
|
36
|
+
* behind one approval -- the Z4 encoding split, reached through the assertion.
|
|
37
|
+
*
|
|
38
|
+
* # Floats and tags are absent on purpose
|
|
39
|
+
*
|
|
40
|
+
* Neither is encodable, so neither is decodable: a float has several
|
|
41
|
+
* representations of one value and no deterministic ordering story (WE-1), and
|
|
42
|
+
* a tag is a type this verifier has no shape for. They refuse as
|
|
43
|
+
* {@link CborError} rather than being skipped, because a decoder that silently
|
|
44
|
+
* ignores what it does not understand is a parser an attacker can steer.
|
|
45
|
+
*/
|
|
46
|
+
/** The input is not canonical CBOR, or is not CBOR at all. */
|
|
47
|
+
export declare class CborError extends Error {
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What this decoder can produce. Deliberately NOT a general CBOR value type:
|
|
52
|
+
* a map key is an integer (COSE labels, RFC 9052 §7) or text (HM-3's three
|
|
53
|
+
* fields), and nothing here needs more.
|
|
54
|
+
*/
|
|
55
|
+
export type Cbor = boolean | null | bigint | Uint8Array | string | Cbor[] | CborMap;
|
|
56
|
+
/**
|
|
57
|
+
* A CBOR map, kept as ordered entries rather than a JS object.
|
|
58
|
+
*
|
|
59
|
+
* An object would key everything by string and collapse the integer label `1`
|
|
60
|
+
* and the text key `"1"` into one entry -- two distinct CBOR values, and in
|
|
61
|
+
* COSE_Key the integer form is the only legal one. The order is the order the
|
|
62
|
+
* bytes carried, which the re-encode check has already proved canonical.
|
|
63
|
+
*/
|
|
64
|
+
export interface CborMap {
|
|
65
|
+
readonly entries: readonly (readonly [Cbor, Cbor])[];
|
|
66
|
+
}
|
|
67
|
+
/** Whether a decoded value is a map -- the narrowing the callers need. */
|
|
68
|
+
export declare function cborIsMap(v: Cbor): v is CborMap;
|
|
69
|
+
/** A map's keys, in the (canonical) order the bytes carried. */
|
|
70
|
+
export declare function cborKeys(m: CborMap): Cbor[];
|
|
71
|
+
/** The value at an integer label, or undefined. COSE_Key's accessor. */
|
|
72
|
+
export declare function cborGetInt(m: CborMap, label: bigint): Cbor | undefined;
|
|
73
|
+
/** The value at a text key, or undefined. The assertion map's accessor. */
|
|
74
|
+
export declare function cborGetText(m: CborMap, key: string): Cbor | undefined;
|
|
75
|
+
/** A decoded value as bytes, or null if it is not a byte string. */
|
|
76
|
+
export declare function cborAsBytes(v: Cbor | undefined): Uint8Array | null;
|
|
77
|
+
/** The canonical CBOR bytes of a value. Used by {@link decodeCanonical}'s proof. */
|
|
78
|
+
export declare function cborEncode(value: Cbor): Uint8Array;
|
|
79
|
+
/**
|
|
80
|
+
* AT-8a: parse AND prove canonicity. Any input that is not byte-identical to
|
|
81
|
+
* the canonical encoding of what it decodes to is REFUSED, never normalised.
|
|
82
|
+
*
|
|
83
|
+
* The engine's `decode_canonical` in one sentence, and the same sentence is the
|
|
84
|
+
* whole specification of this function.
|
|
85
|
+
*/
|
|
86
|
+
export declare function decodeCanonical(buf: Uint8Array): Cbor;
|
|
87
|
+
//# sourceMappingURL=cbor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,8DAA8D;AAC9D,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;CACtD;AAMD,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,CAE3C;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAGtE;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAGrE;AAED,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI,CAElE;AAsHD,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,UAAU,CAIlD;AA0FD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAQrD"}
|
package/dist/cbor.js
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AT-8a canonical CBOR (RFC 8949 §4.2) -- the ONE primitive this package did
|
|
3
|
+
* not already have, added for §8.6c and for nothing else.
|
|
4
|
+
*
|
|
5
|
+
* # Why a new module rather than a reused one
|
|
6
|
+
*
|
|
7
|
+
* `canon.ts` is the canonical JSON encoding, and it is the right preimage for
|
|
8
|
+
* every hash this verifier takes: the engine's `attestation_id` and AB-1 entry
|
|
9
|
+
* digest are `sha256:` over `acp_executor.canon` / `receipt.rs::canon`, both
|
|
10
|
+
* JSON, and this package reproduces those bytes. What CBOR is needed for is
|
|
11
|
+
* narrower and unavoidable: HM-3 says a human attester's assertion is canonical
|
|
12
|
+
* CBOR of `{authenticator_data, client_data_json, signature}`, and HM-1 says the
|
|
13
|
+
* credential's `public_key` is a COSE_Key, which is CBOR by RFC 9052. Those two
|
|
14
|
+
* byte strings arrive from the wire and must be DECODED; no JSON encoder can
|
|
15
|
+
* read them. So this is a decoder for two fixed shapes, not a general codec.
|
|
16
|
+
*
|
|
17
|
+
* The engine's twins are `crates/acp-crypto/src/cbor.rs` and
|
|
18
|
+
* `reference/src/acp_crypto.py`'s `_enc` / `_dec` / `decode_canonical`, and the
|
|
19
|
+
* rule this file takes from them verbatim is the last one:
|
|
20
|
+
*
|
|
21
|
+
* # Canonicity is proved by RE-ENCODING, not by a list of sub-rules
|
|
22
|
+
*
|
|
23
|
+
* {@link decodeCanonical} parses, re-encodes what it parsed, and refuses the
|
|
24
|
+
* input unless the two byte strings are identical. That single comparison
|
|
25
|
+
* carries every §4.2 requirement at once -- shortest-form arguments, definite
|
|
26
|
+
* lengths, map keys sorted by their ENCODED bytes, no duplicate keys -- and it
|
|
27
|
+
* cannot drift from the encoder the way a hand-written checklist of those rules
|
|
28
|
+
* can. The decoder still refuses the coarse violations itself (indefinite
|
|
29
|
+
* lengths, non-shortest arguments, reserved additional information) because a
|
|
30
|
+
* decoder that accepted them would have to invent a canonical form to compare
|
|
31
|
+
* against, and inventing one is normalising.
|
|
32
|
+
*
|
|
33
|
+
* Refused, never normalised (AT-8a): the AB-1 entry digest is taken over the
|
|
34
|
+
* bytes that arrived, so a second encoding of one assertion is a second digest
|
|
35
|
+
* for one human decision, and accepting both would put two receipt identities
|
|
36
|
+
* behind one approval -- the Z4 encoding split, reached through the assertion.
|
|
37
|
+
*
|
|
38
|
+
* # Floats and tags are absent on purpose
|
|
39
|
+
*
|
|
40
|
+
* Neither is encodable, so neither is decodable: a float has several
|
|
41
|
+
* representations of one value and no deterministic ordering story (WE-1), and
|
|
42
|
+
* a tag is a type this verifier has no shape for. They refuse as
|
|
43
|
+
* {@link CborError} rather than being skipped, because a decoder that silently
|
|
44
|
+
* ignores what it does not understand is a parser an attacker can steer.
|
|
45
|
+
*/
|
|
46
|
+
/** The input is not canonical CBOR, or is not CBOR at all. */
|
|
47
|
+
export class CborError extends Error {
|
|
48
|
+
constructor(message) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.name = 'CborError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function isCborMap(v) {
|
|
54
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v) && !(v instanceof Uint8Array);
|
|
55
|
+
}
|
|
56
|
+
/** Whether a decoded value is a map -- the narrowing the callers need. */
|
|
57
|
+
export function cborIsMap(v) {
|
|
58
|
+
return isCborMap(v);
|
|
59
|
+
}
|
|
60
|
+
/** A map's keys, in the (canonical) order the bytes carried. */
|
|
61
|
+
export function cborKeys(m) {
|
|
62
|
+
return m.entries.map(([k]) => k);
|
|
63
|
+
}
|
|
64
|
+
/** The value at an integer label, or undefined. COSE_Key's accessor. */
|
|
65
|
+
export function cborGetInt(m, label) {
|
|
66
|
+
for (const [k, v] of m.entries)
|
|
67
|
+
if (typeof k === 'bigint' && k === label)
|
|
68
|
+
return v;
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
/** The value at a text key, or undefined. The assertion map's accessor. */
|
|
72
|
+
export function cborGetText(m, key) {
|
|
73
|
+
for (const [k, v] of m.entries)
|
|
74
|
+
if (typeof k === 'string' && k === key)
|
|
75
|
+
return v;
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
/** A decoded value as bytes, or null if it is not a byte string. */
|
|
79
|
+
export function cborAsBytes(v) {
|
|
80
|
+
return v instanceof Uint8Array ? v : null;
|
|
81
|
+
}
|
|
82
|
+
const MAJOR_UINT = 0;
|
|
83
|
+
const MAJOR_NINT = 1;
|
|
84
|
+
const MAJOR_BYTES = 2;
|
|
85
|
+
const MAJOR_TEXT = 3;
|
|
86
|
+
const MAJOR_ARRAY = 4;
|
|
87
|
+
const MAJOR_MAP = 5;
|
|
88
|
+
const MAJOR_SIMPLE = 7;
|
|
89
|
+
/**
|
|
90
|
+
* RFC 8949 §4.2.1: the argument MUST use the shortest form that holds it.
|
|
91
|
+
*
|
|
92
|
+
* `bigint` throughout rather than `number`, because a CBOR argument is a full
|
|
93
|
+
* 64-bit unsigned integer and `number` loses digits past 2^53-1 -- the same
|
|
94
|
+
* defect `canon.ts` refuses on the JSON side, and here it would mean re-encoding
|
|
95
|
+
* a length to different bytes than arrived and calling the input non-canonical
|
|
96
|
+
* for the decoder's own reason.
|
|
97
|
+
*/
|
|
98
|
+
function encodeHead(major, value, out) {
|
|
99
|
+
const head = major << 5;
|
|
100
|
+
if (value < 24n) {
|
|
101
|
+
out.push(head | Number(value));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let width;
|
|
105
|
+
if (value < 0x100n) {
|
|
106
|
+
out.push(head | 24);
|
|
107
|
+
width = 1;
|
|
108
|
+
}
|
|
109
|
+
else if (value < 0x10000n) {
|
|
110
|
+
out.push(head | 25);
|
|
111
|
+
width = 2;
|
|
112
|
+
}
|
|
113
|
+
else if (value < 0x100000000n) {
|
|
114
|
+
out.push(head | 26);
|
|
115
|
+
width = 4;
|
|
116
|
+
}
|
|
117
|
+
else if (value < 0x10000000000000000n) {
|
|
118
|
+
out.push(head | 27);
|
|
119
|
+
width = 8;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new CborError('integer exceeds the 64-bit CBOR argument');
|
|
123
|
+
}
|
|
124
|
+
for (let i = width - 1; i >= 0; i -= 1) {
|
|
125
|
+
out.push(Number((value >> BigInt(i * 8)) & 0xffn));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function encodeInto(value, out) {
|
|
129
|
+
if (value === true) {
|
|
130
|
+
out.push(0xf5);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (value === false) {
|
|
134
|
+
out.push(0xf4);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (value === null) {
|
|
138
|
+
out.push(0xf6);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (typeof value === 'bigint') {
|
|
142
|
+
if (value >= 0n)
|
|
143
|
+
encodeHead(MAJOR_UINT, value, out);
|
|
144
|
+
else
|
|
145
|
+
encodeHead(MAJOR_NINT, -value - 1n, out);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (value instanceof Uint8Array) {
|
|
149
|
+
encodeHead(MAJOR_BYTES, BigInt(value.length), out);
|
|
150
|
+
for (const b of value)
|
|
151
|
+
out.push(b);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (typeof value === 'string') {
|
|
155
|
+
const bytes = new TextEncoder().encode(value);
|
|
156
|
+
encodeHead(MAJOR_TEXT, BigInt(bytes.length), out);
|
|
157
|
+
for (const b of bytes)
|
|
158
|
+
out.push(b);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(value)) {
|
|
162
|
+
encodeHead(MAJOR_ARRAY, BigInt(value.length), out);
|
|
163
|
+
for (const item of value)
|
|
164
|
+
encodeInto(item, out);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (isCborMap(value)) {
|
|
168
|
+
// §4.2.1: keys sorted by their ENCODED bytes, bytewise lexicographic.
|
|
169
|
+
// Sorting by the decoded value would put the integer label -2 and the text
|
|
170
|
+
// key "x" in an order that depends on the comparison chosen rather than on
|
|
171
|
+
// the bytes, and the encoded order is the one the rule names.
|
|
172
|
+
const keyed = value.entries.map(([k, v]) => {
|
|
173
|
+
const kb = [];
|
|
174
|
+
encodeInto(k, kb);
|
|
175
|
+
return { kb, v };
|
|
176
|
+
});
|
|
177
|
+
keyed.sort((a, b) => compareBytes(a.kb, b.kb));
|
|
178
|
+
for (let i = 1; i < keyed.length; i += 1) {
|
|
179
|
+
const prev = keyed[i - 1];
|
|
180
|
+
const cur = keyed[i];
|
|
181
|
+
if (prev === undefined || cur === undefined)
|
|
182
|
+
continue; // unreachable; index in range
|
|
183
|
+
if (compareBytes(prev.kb, cur.kb) === 0)
|
|
184
|
+
throw new CborError('duplicate map key');
|
|
185
|
+
}
|
|
186
|
+
encodeHead(MAJOR_MAP, BigInt(keyed.length), out);
|
|
187
|
+
for (const { kb, v } of keyed) {
|
|
188
|
+
for (const b of kb)
|
|
189
|
+
out.push(b);
|
|
190
|
+
encodeInto(v, out);
|
|
191
|
+
}
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
throw new CborError('value is not canonically encodable');
|
|
195
|
+
}
|
|
196
|
+
function compareBytes(a, b) {
|
|
197
|
+
const n = Math.min(a.length, b.length);
|
|
198
|
+
for (let i = 0; i < n; i += 1) {
|
|
199
|
+
const x = a[i];
|
|
200
|
+
const y = b[i];
|
|
201
|
+
if (x === undefined || y === undefined)
|
|
202
|
+
continue; // unreachable; index in range
|
|
203
|
+
if (x !== y)
|
|
204
|
+
return x - y;
|
|
205
|
+
}
|
|
206
|
+
return a.length - b.length;
|
|
207
|
+
}
|
|
208
|
+
/** The canonical CBOR bytes of a value. Used by {@link decodeCanonical}'s proof. */
|
|
209
|
+
export function cborEncode(value) {
|
|
210
|
+
const out = [];
|
|
211
|
+
encodeInto(value, out);
|
|
212
|
+
return Uint8Array.from(out);
|
|
213
|
+
}
|
|
214
|
+
function decodeAt(buf, start) {
|
|
215
|
+
if (start >= buf.length)
|
|
216
|
+
throw new CborError('truncated');
|
|
217
|
+
const ib = buf[start];
|
|
218
|
+
if (ib === undefined)
|
|
219
|
+
throw new CborError('truncated'); // unreachable; bound checked
|
|
220
|
+
const major = ib >> 5;
|
|
221
|
+
const ai = ib & 0x1f;
|
|
222
|
+
let i = start + 1;
|
|
223
|
+
let value;
|
|
224
|
+
if (ai < 24) {
|
|
225
|
+
value = BigInt(ai);
|
|
226
|
+
}
|
|
227
|
+
else if (ai <= 27) {
|
|
228
|
+
const width = 1 << (ai - 24);
|
|
229
|
+
if (i + width > buf.length)
|
|
230
|
+
throw new CborError('truncated argument');
|
|
231
|
+
value = 0n;
|
|
232
|
+
for (let k = 0; k < width; k += 1) {
|
|
233
|
+
const b = buf[i + k];
|
|
234
|
+
if (b === undefined)
|
|
235
|
+
throw new CborError('truncated argument'); // unreachable
|
|
236
|
+
value = (value << 8n) | BigInt(b);
|
|
237
|
+
}
|
|
238
|
+
i += width;
|
|
239
|
+
// Shortest form (§4.2.1). Refused here as well as by the re-encode proof,
|
|
240
|
+
// because the value that re-encodes shorter would otherwise be decoded
|
|
241
|
+
// first and any shape check above would run on attacker-chosen bytes.
|
|
242
|
+
const floor = ai === 24 ? 24n : 1n << BigInt((width / 2) * 8);
|
|
243
|
+
if (value < floor)
|
|
244
|
+
throw new CborError('non-shortest argument');
|
|
245
|
+
}
|
|
246
|
+
else if (ai === 31) {
|
|
247
|
+
throw new CborError('indefinite length forbidden in canonical CBOR');
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
throw new CborError(`reserved additional information ${ai}`);
|
|
251
|
+
}
|
|
252
|
+
switch (major) {
|
|
253
|
+
case MAJOR_UINT:
|
|
254
|
+
return { value, next: i };
|
|
255
|
+
case MAJOR_NINT:
|
|
256
|
+
return { value: -value - 1n, next: i };
|
|
257
|
+
case MAJOR_BYTES:
|
|
258
|
+
case MAJOR_TEXT: {
|
|
259
|
+
const len = Number(value);
|
|
260
|
+
if (!Number.isSafeInteger(len) || i + len > buf.length) {
|
|
261
|
+
throw new CborError('truncated string');
|
|
262
|
+
}
|
|
263
|
+
const slice = buf.subarray(i, i + len);
|
|
264
|
+
if (major === MAJOR_BYTES)
|
|
265
|
+
return { value: Uint8Array.from(slice), next: i + len };
|
|
266
|
+
// fatal: true -- invalid UTF-8 is a refusal, not a run of U+FFFD. A
|
|
267
|
+
// replacement character would make two distinct byte strings decode to
|
|
268
|
+
// one text value, which the re-encode proof would then report as
|
|
269
|
+
// non-canonical for the wrong reason.
|
|
270
|
+
return { value: new TextDecoder('utf-8', { fatal: true }).decode(slice), next: i + len };
|
|
271
|
+
}
|
|
272
|
+
case MAJOR_ARRAY: {
|
|
273
|
+
const n = Number(value);
|
|
274
|
+
if (!Number.isSafeInteger(n) || n > buf.length - i)
|
|
275
|
+
throw new CborError('truncated array');
|
|
276
|
+
const items = [];
|
|
277
|
+
for (let k = 0; k < n; k += 1) {
|
|
278
|
+
const d = decodeAt(buf, i);
|
|
279
|
+
items.push(d.value);
|
|
280
|
+
i = d.next;
|
|
281
|
+
}
|
|
282
|
+
return { value: items, next: i };
|
|
283
|
+
}
|
|
284
|
+
case MAJOR_MAP: {
|
|
285
|
+
const n = Number(value);
|
|
286
|
+
if (!Number.isSafeInteger(n) || n > buf.length - i)
|
|
287
|
+
throw new CborError('truncated map');
|
|
288
|
+
const entries = [];
|
|
289
|
+
for (let k = 0; k < n; k += 1) {
|
|
290
|
+
const key = decodeAt(buf, i);
|
|
291
|
+
const val = decodeAt(buf, key.next);
|
|
292
|
+
entries.push([key.value, val.value]);
|
|
293
|
+
i = val.next;
|
|
294
|
+
}
|
|
295
|
+
return { value: { entries }, next: i };
|
|
296
|
+
}
|
|
297
|
+
case MAJOR_SIMPLE:
|
|
298
|
+
if (value === 20n)
|
|
299
|
+
return { value: false, next: i };
|
|
300
|
+
if (value === 21n)
|
|
301
|
+
return { value: true, next: i };
|
|
302
|
+
if (value === 22n)
|
|
303
|
+
return { value: null, next: i };
|
|
304
|
+
throw new CborError('float or unsupported simple value');
|
|
305
|
+
default:
|
|
306
|
+
throw new CborError(`unsupported major type ${major}`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* AT-8a: parse AND prove canonicity. Any input that is not byte-identical to
|
|
311
|
+
* the canonical encoding of what it decodes to is REFUSED, never normalised.
|
|
312
|
+
*
|
|
313
|
+
* The engine's `decode_canonical` in one sentence, and the same sentence is the
|
|
314
|
+
* whole specification of this function.
|
|
315
|
+
*/
|
|
316
|
+
export function decodeCanonical(buf) {
|
|
317
|
+
const { value, next } = decodeAt(buf, 0);
|
|
318
|
+
if (next !== buf.length)
|
|
319
|
+
throw new CborError('trailing bytes');
|
|
320
|
+
const re = cborEncode(value);
|
|
321
|
+
if (re.length !== buf.length || !re.every((b, i) => b === buf[i])) {
|
|
322
|
+
throw new CborError('input is not the canonical encoding of its value');
|
|
323
|
+
}
|
|
324
|
+
return value;
|
|
325
|
+
}
|
|
326
|
+
//# sourceMappingURL=cbor.js.map
|
package/dist/cbor.js.map
ADDED
|
@@ -0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M,UAAU,eAAe,CAAC,GAAe;IAC7C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACzC,IAAI,IAAI,KAAK,GAAG,CAAC,MAAM;QAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC/D,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,EAAE,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/clauses.d.ts
CHANGED
|
@@ -50,4 +50,74 @@ export declare const CLAUSE_WIRE_TYPE = "WE-4";
|
|
|
50
50
|
* refusal carries the field's (ACP-88/ACP-89).
|
|
51
51
|
*/
|
|
52
52
|
export declare const CLAUSE_RECEIPT_NONCE_SIZE = "L-17";
|
|
53
|
+
/** Rust `quorum::CLAUSE_NO_ATTESTATIONS` -- INV-1-HIGH, a receipt commits to
|
|
54
|
+
* attestations and none arrived. */
|
|
55
|
+
export declare const CLAUSE_NO_ATTESTATIONS = "INV-1-HIGH";
|
|
56
|
+
/** Rust `quorum::CLAUSE_NO_OBJECT` -- AT-8, an entry carrying no Attestation
|
|
57
|
+
* Object (the pre-v1.3.3 form, where only the id travelled). */
|
|
58
|
+
export declare const CLAUSE_NO_OBJECT = "AT-8";
|
|
59
|
+
/** Rust `quorum::CLAUSE_OBJECT_SCHEMA` -- AT-8b, the object's field set is not
|
|
60
|
+
* exactly AT-1's. CLOSED: an unknown field is refused, a missing one never
|
|
61
|
+
* defaulted (Z4). */
|
|
62
|
+
export declare const CLAUSE_OBJECT_SCHEMA = "AT-8b";
|
|
63
|
+
/** Rust `quorum::CLAUSE_NONCE_SIZE` -- AT-1, `att_nonce` is well-formed but is
|
|
64
|
+
* not 128-bit. The ATTESTATION nonce's own size clause, never L-17 (which sizes
|
|
65
|
+
* the receipt's): one number, two clauses, and the refusal carries the field's. */
|
|
66
|
+
export declare const CLAUSE_ATT_NONCE_SIZE = "AT-1";
|
|
67
|
+
/** Rust `quorum::CLAUSE_ATTESTATION_SUITE` -- CR-4. An UNKNOWN suite refuses
|
|
68
|
+
* here under CR-4 and not CR-1, matching `Bundle.suite_ok`, which returns False
|
|
69
|
+
* for a name it does not know; the receipt path spells the same condition CR-1
|
|
70
|
+
* and the differential compares names, so the reference wins. */
|
|
71
|
+
export declare const CLAUSE_ATTESTATION_SUITE = "CR-4";
|
|
72
|
+
/** Rust `quorum::CLAUSE_ATTESTER_SIG` -- §9.3 step 7b(i). */
|
|
73
|
+
export declare const CLAUSE_ATTESTER_SIG = "9.3-7b-i";
|
|
74
|
+
/** Rust `quorum::CLAUSE_BINDING` -- §9.3 step 7b(ii), the object binds a
|
|
75
|
+
* DIFFERENT proposal. This is Y1: a genuine quorum raised for P1 attached to a
|
|
76
|
+
* receipt for P2. */
|
|
77
|
+
export declare const CLAUSE_BINDING = "9.3-7b-ii";
|
|
78
|
+
/** Rust `quorum::CLAUSE_POLICY_BASIS` -- §9.3 step 7b(iii), policy basis or
|
|
79
|
+
* object freshness. */
|
|
80
|
+
export declare const CLAUSE_POLICY_BASIS = "9.3-7b-iii";
|
|
81
|
+
/** Rust `quorum::CLAUSE_OPERATOR_DISAGREE` -- §9.3 step 7b(iii-a), the objects
|
|
82
|
+
* disagree on who the operator is (Y4). */
|
|
83
|
+
export declare const CLAUSE_OPERATOR_DISAGREE = "9.3-7b-iii-a";
|
|
84
|
+
/** Rust `quorum::CLAUSE_CONSENT` -- AT-9's SECOND requirement: an attester
|
|
85
|
+
* signed for a quorum other than the bundle's. A CONSENT check, not a threshold
|
|
86
|
+
* one; deleting it cannot lower a quorum. */
|
|
87
|
+
export declare const CLAUSE_CONSENT = "AT-9";
|
|
88
|
+
/** Rust `quorum::CLAUSE_DERIVED_ID` -- Y1b, a transmitted `attestation_id`
|
|
89
|
+
* differing from the derived one. */
|
|
90
|
+
export declare const CLAUSE_DERIVED_ID = "Y1b";
|
|
91
|
+
/** Rust `quorum::CLAUSE_MEMBERSHIP` -- AB-1, the entry digest binding: entry
|
|
92
|
+
* schema, digest-list type, or membership. */
|
|
93
|
+
export declare const CLAUSE_MEMBERSHIP = "AB-1";
|
|
94
|
+
/** Rust `quorum::CLAUSE_DIGEST_ORDER` -- AB-2, `attestation_digests` is not in
|
|
95
|
+
* the one canonical ordering. */
|
|
96
|
+
export declare const CLAUSE_DIGEST_ORDER = "AB-2";
|
|
97
|
+
/** Rust `quorum::CLAUSE_DIGEST_DUP` -- AB-3, a repeated digest. */
|
|
98
|
+
export declare const CLAUSE_DIGEST_DUP = "AB-3";
|
|
99
|
+
/** Rust `quorum::CLAUSE_CARDINALITY` -- AB-4, entry count and signed digest
|
|
100
|
+
* count disagree. Fewer is withholding, more is injection. */
|
|
101
|
+
export declare const CLAUSE_CARDINALITY = "AB-4";
|
|
102
|
+
/** Rust `quorum::CLAUSE_ASSURANCE` -- AT-10, an identity enrolled below the
|
|
103
|
+
* registry's assurance floor. */
|
|
104
|
+
export declare const CLAUSE_ASSURANCE = "AT-10";
|
|
105
|
+
/** Rust `quorum::CLAUSE_QUORUM` -- AT-3, fewer distinct approvals than the
|
|
106
|
+
* threshold recomputed from the bundle. */
|
|
107
|
+
export declare const CLAUSE_QUORUM = "AT-3";
|
|
108
|
+
/** Rust `quorum::CLAUSE_OPERATOR_SELF` -- AT-2, the operator counted toward
|
|
109
|
+
* their own quorum. */
|
|
110
|
+
export declare const CLAUSE_OPERATOR_SELF = "AT-2";
|
|
111
|
+
/** Rust `quorum::CLAUSE_WEBAUTHN_ALG` -- HM-3. The object's declared `alg` and
|
|
112
|
+
* the registry's disagree about what KIND of key this identity holds. Either
|
|
113
|
+
* side alone decides nothing; the DISAGREEMENT is the refusal, raised before a
|
|
114
|
+
* byte of the assertion is parsed. */
|
|
115
|
+
export declare const CLAUSE_WEBAUTHN_ALG = "WebauthnAlgMismatch";
|
|
116
|
+
/** Rust `quorum::CLAUSE_WEBAUTHN_COUNTER` -- HM-4 (f). A regression is a CLONED
|
|
117
|
+
* AUTHENTICATOR, not a retry. */
|
|
118
|
+
export declare const CLAUSE_WEBAUTHN_COUNTER = "WebauthnCounter";
|
|
119
|
+
/** Rust `quorum::CLAUSE_MALFORMED` -- the entry's `sig`, the assertion or the
|
|
120
|
+
* credential is not the shape §8.6c declares. Not a statement about a
|
|
121
|
+
* signature. */
|
|
122
|
+
export declare const CLAUSE_MALFORMED = "Malformed";
|
|
53
123
|
//# sourceMappingURL=clauses.d.ts.map
|
package/dist/clauses.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clauses.d.ts","sourceRoot":"","sources":["../src/clauses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,sFAAsF;AACtF,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB,SAAS,CAAC;AACvC,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C,oGAAoG;AACpG,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,6FAA6F;AAC7F,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,oGAAoG;AACpG,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,4EAA4E;AAC5E,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,qGAAqG;AACrG,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,6FAA6F;AAC7F,eAA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,MAAM,mBAAmB,eAAe,CAAC;AAChD;2CAC2C;AAC3C,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD;;6CAE6C;AAC7C,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC;qCACqC;AACrC,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AACvC;8CAC8C;AAC9C,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC;iCACiC;AACjC,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAC1C,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC;8DAC8D;AAC9D,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC;iCACiC;AACjC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC;2CAC2C;AAC3C,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC;uBACuB;AACvB,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C;;;sCAGsC;AACtC,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD;iCACiC;AACjC,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AACzD;;gBAEgB;AAChB,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
|
package/dist/clauses.js
CHANGED
|
@@ -50,4 +50,81 @@ export const CLAUSE_WIRE_TYPE = 'WE-4';
|
|
|
50
50
|
* refusal carries the field's (ACP-88/ACP-89).
|
|
51
51
|
*/
|
|
52
52
|
export const CLAUSE_RECEIPT_NONCE_SIZE = 'L-17';
|
|
53
|
+
// ------------------------------------------------------------------ step 7b
|
|
54
|
+
//
|
|
55
|
+
// The AT-* quorum and §8.6b's AB-*, spelled as `crates/acp-decision/src/quorum.rs`
|
|
56
|
+
// and `reference/src/acp_executor.py` spell them. Several are literals at the
|
|
57
|
+
// refusal site in Rust and named here; the VALUE is the contract either way, and
|
|
58
|
+
// the Rust constant name is kept beside each one so a reader diffing the two
|
|
59
|
+
// files sees one table rather than two vocabularies.
|
|
60
|
+
/** Rust `quorum::CLAUSE_NO_ATTESTATIONS` -- INV-1-HIGH, a receipt commits to
|
|
61
|
+
* attestations and none arrived. */
|
|
62
|
+
export const CLAUSE_NO_ATTESTATIONS = 'INV-1-HIGH';
|
|
63
|
+
/** Rust `quorum::CLAUSE_NO_OBJECT` -- AT-8, an entry carrying no Attestation
|
|
64
|
+
* Object (the pre-v1.3.3 form, where only the id travelled). */
|
|
65
|
+
export const CLAUSE_NO_OBJECT = 'AT-8';
|
|
66
|
+
/** Rust `quorum::CLAUSE_OBJECT_SCHEMA` -- AT-8b, the object's field set is not
|
|
67
|
+
* exactly AT-1's. CLOSED: an unknown field is refused, a missing one never
|
|
68
|
+
* defaulted (Z4). */
|
|
69
|
+
export const CLAUSE_OBJECT_SCHEMA = 'AT-8b';
|
|
70
|
+
/** Rust `quorum::CLAUSE_NONCE_SIZE` -- AT-1, `att_nonce` is well-formed but is
|
|
71
|
+
* not 128-bit. The ATTESTATION nonce's own size clause, never L-17 (which sizes
|
|
72
|
+
* the receipt's): one number, two clauses, and the refusal carries the field's. */
|
|
73
|
+
export const CLAUSE_ATT_NONCE_SIZE = 'AT-1';
|
|
74
|
+
/** Rust `quorum::CLAUSE_ATTESTATION_SUITE` -- CR-4. An UNKNOWN suite refuses
|
|
75
|
+
* here under CR-4 and not CR-1, matching `Bundle.suite_ok`, which returns False
|
|
76
|
+
* for a name it does not know; the receipt path spells the same condition CR-1
|
|
77
|
+
* and the differential compares names, so the reference wins. */
|
|
78
|
+
export const CLAUSE_ATTESTATION_SUITE = 'CR-4';
|
|
79
|
+
/** Rust `quorum::CLAUSE_ATTESTER_SIG` -- §9.3 step 7b(i). */
|
|
80
|
+
export const CLAUSE_ATTESTER_SIG = '9.3-7b-i';
|
|
81
|
+
/** Rust `quorum::CLAUSE_BINDING` -- §9.3 step 7b(ii), the object binds a
|
|
82
|
+
* DIFFERENT proposal. This is Y1: a genuine quorum raised for P1 attached to a
|
|
83
|
+
* receipt for P2. */
|
|
84
|
+
export const CLAUSE_BINDING = '9.3-7b-ii';
|
|
85
|
+
/** Rust `quorum::CLAUSE_POLICY_BASIS` -- §9.3 step 7b(iii), policy basis or
|
|
86
|
+
* object freshness. */
|
|
87
|
+
export const CLAUSE_POLICY_BASIS = '9.3-7b-iii';
|
|
88
|
+
/** Rust `quorum::CLAUSE_OPERATOR_DISAGREE` -- §9.3 step 7b(iii-a), the objects
|
|
89
|
+
* disagree on who the operator is (Y4). */
|
|
90
|
+
export const CLAUSE_OPERATOR_DISAGREE = '9.3-7b-iii-a';
|
|
91
|
+
/** Rust `quorum::CLAUSE_CONSENT` -- AT-9's SECOND requirement: an attester
|
|
92
|
+
* signed for a quorum other than the bundle's. A CONSENT check, not a threshold
|
|
93
|
+
* one; deleting it cannot lower a quorum. */
|
|
94
|
+
export const CLAUSE_CONSENT = 'AT-9';
|
|
95
|
+
/** Rust `quorum::CLAUSE_DERIVED_ID` -- Y1b, a transmitted `attestation_id`
|
|
96
|
+
* differing from the derived one. */
|
|
97
|
+
export const CLAUSE_DERIVED_ID = 'Y1b';
|
|
98
|
+
/** Rust `quorum::CLAUSE_MEMBERSHIP` -- AB-1, the entry digest binding: entry
|
|
99
|
+
* schema, digest-list type, or membership. */
|
|
100
|
+
export const CLAUSE_MEMBERSHIP = 'AB-1';
|
|
101
|
+
/** Rust `quorum::CLAUSE_DIGEST_ORDER` -- AB-2, `attestation_digests` is not in
|
|
102
|
+
* the one canonical ordering. */
|
|
103
|
+
export const CLAUSE_DIGEST_ORDER = 'AB-2';
|
|
104
|
+
/** Rust `quorum::CLAUSE_DIGEST_DUP` -- AB-3, a repeated digest. */
|
|
105
|
+
export const CLAUSE_DIGEST_DUP = 'AB-3';
|
|
106
|
+
/** Rust `quorum::CLAUSE_CARDINALITY` -- AB-4, entry count and signed digest
|
|
107
|
+
* count disagree. Fewer is withholding, more is injection. */
|
|
108
|
+
export const CLAUSE_CARDINALITY = 'AB-4';
|
|
109
|
+
/** Rust `quorum::CLAUSE_ASSURANCE` -- AT-10, an identity enrolled below the
|
|
110
|
+
* registry's assurance floor. */
|
|
111
|
+
export const CLAUSE_ASSURANCE = 'AT-10';
|
|
112
|
+
/** Rust `quorum::CLAUSE_QUORUM` -- AT-3, fewer distinct approvals than the
|
|
113
|
+
* threshold recomputed from the bundle. */
|
|
114
|
+
export const CLAUSE_QUORUM = 'AT-3';
|
|
115
|
+
/** Rust `quorum::CLAUSE_OPERATOR_SELF` -- AT-2, the operator counted toward
|
|
116
|
+
* their own quorum. */
|
|
117
|
+
export const CLAUSE_OPERATOR_SELF = 'AT-2';
|
|
118
|
+
/** Rust `quorum::CLAUSE_WEBAUTHN_ALG` -- HM-3. The object's declared `alg` and
|
|
119
|
+
* the registry's disagree about what KIND of key this identity holds. Either
|
|
120
|
+
* side alone decides nothing; the DISAGREEMENT is the refusal, raised before a
|
|
121
|
+
* byte of the assertion is parsed. */
|
|
122
|
+
export const CLAUSE_WEBAUTHN_ALG = 'WebauthnAlgMismatch';
|
|
123
|
+
/** Rust `quorum::CLAUSE_WEBAUTHN_COUNTER` -- HM-4 (f). A regression is a CLONED
|
|
124
|
+
* AUTHENTICATOR, not a retry. */
|
|
125
|
+
export const CLAUSE_WEBAUTHN_COUNTER = 'WebauthnCounter';
|
|
126
|
+
/** Rust `quorum::CLAUSE_MALFORMED` -- the entry's `sig`, the assertion or the
|
|
127
|
+
* credential is not the shape §8.6c declares. Not a statement about a
|
|
128
|
+
* signature. */
|
|
129
|
+
export const CLAUSE_MALFORMED = 'Malformed';
|
|
53
130
|
//# sourceMappingURL=clauses.js.map
|
package/dist/clauses.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clauses.js","sourceRoot":"","sources":["../src/clauses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AACrC,8FAA8F;AAC9F,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AACvC,gGAAgG;AAChG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AAM,CAAC;AAC1C,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC;8DAC8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC;iCACiC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC;2CAC2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC;uBACuB;AACvB,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C;;;sCAGsC;AACtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD;iCACiC;AACjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AACzD;;gBAEgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
* client adds no verification logic of its own -- one home per rule).
|
|
7
7
|
*/
|
|
8
8
|
export { canon, compareCodePoints, type Json } from './canon.js';
|
|
9
|
+
export { CborError, cborAsBytes, cborEncode, cborGetInt, cborGetText, cborIsMap, cborKeys, decodeCanonical, type Cbor, type CborMap, } from './cbor.js';
|
|
10
|
+
export { CLAUSE_ASSURANCE, CLAUSE_ATTESTATION_SUITE, CLAUSE_ATTESTER_SIG, CLAUSE_ATT_NONCE_SIZE, CLAUSE_BINDING, CLAUSE_CARDINALITY, CLAUSE_CONSENT, CLAUSE_DERIVED_ID, CLAUSE_DIGEST_DUP, CLAUSE_DIGEST_ORDER, CLAUSE_MALFORMED, CLAUSE_MEMBERSHIP, CLAUSE_NO_ATTESTATIONS, CLAUSE_NO_OBJECT, CLAUSE_OBJECT_SCHEMA, CLAUSE_OPERATOR_DISAGREE, CLAUSE_OPERATOR_SELF, CLAUSE_POLICY_BASIS, CLAUSE_QUORUM, CLAUSE_WEBAUTHN_ALG, CLAUSE_WEBAUTHN_COUNTER, } from './clauses.js';
|
|
11
|
+
export { AT1_FIELDS, attestationId, entryDigest, verifyQuorum, type AttesterCredential, type DecisionBasis, type HybridAttester, type QuorumOutcome, type QuorumPolicy, type WebauthnAttester, } from './quorum.js';
|
|
12
|
+
export { ASSERTION_FIELDS, MALFORMED, REGISTRY_KEY_WEAK, WEBAUTHN_ALGS, WEBAUTHN_AUTHENTICATOR_DATA, WEBAUTHN_CHALLENGE, WEBAUTHN_ORIGIN, WEBAUTHN_PRIMITIVE, WEBAUTHN_SIGNATURE, WEBAUTHN_TYPE, WebauthnRefusal, coseKeyParse, decodeAssertion, verifyWebauthn, webauthnChallenge, type Assertion, type CredentialKey, } from './webauthn.js';
|
|
13
|
+
export { b64Decode } from './wire.js';
|
|
9
14
|
export { CLAUSE_BODY_SIZE, CLAUSE_CANONICAL, CLAUSE_DECISION, CLAUSE_PROPOSAL_BINDING, CLAUSE_RECEIPT_NONCE_SIZE, CLAUSE_SIGNATURE, CLAUSE_SUITE_FLOOR, CLAUSE_TEMPORAL, CLAUSE_UNKNOWN_SUITE, CLAUSE_VALIDITY_WINDOW, CLAUSE_VERSION, CLAUSE_WIRE_TYPE, } from './clauses.js';
|
|
10
15
|
export { ED25519_PK_LEN, ED25519_SIG_LEN, ed25519IsSmallOrder, verifyEd25519Strict, } from './ed25519.js';
|
|
11
16
|
export { parseInstant } from './instant.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,KAAK,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,cAAc,EACd,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACL,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,eAAe,EACf,KAAK,IAAI,EACT,KAAK,OAAO,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,c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AAa,GACnB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
* client adds no verification logic of its own -- one home per rule).
|
|
7
7
|
*/
|
|
8
8
|
export { canon, compareCodePoints } from './canon.js';
|
|
9
|
+
export { CborError, cborAsBytes, cborEncode, cborGetInt, cborGetText, cborIsMap, cborKeys, decodeCanonical, } from './cbor.js';
|
|
10
|
+
export { CLAUSE_ASSURANCE, CLAUSE_ATTESTATION_SUITE, CLAUSE_ATTESTER_SIG, CLAUSE_ATT_NONCE_SIZE, CLAUSE_BINDING, CLAUSE_CARDINALITY, CLAUSE_CONSENT, CLAUSE_DERIVED_ID, CLAUSE_DIGEST_DUP, CLAUSE_DIGEST_ORDER, CLAUSE_MALFORMED, CLAUSE_MEMBERSHIP, CLAUSE_NO_ATTESTATIONS, CLAUSE_NO_OBJECT, CLAUSE_OBJECT_SCHEMA, CLAUSE_OPERATOR_DISAGREE, CLAUSE_OPERATOR_SELF, CLAUSE_POLICY_BASIS, CLAUSE_QUORUM, CLAUSE_WEBAUTHN_ALG, CLAUSE_WEBAUTHN_COUNTER, } from './clauses.js';
|
|
11
|
+
export { AT1_FIELDS, attestationId, entryDigest, verifyQuorum, } from './quorum.js';
|
|
12
|
+
export { ASSERTION_FIELDS, MALFORMED, REGISTRY_KEY_WEAK, WEBAUTHN_ALGS, WEBAUTHN_AUTHENTICATOR_DATA, WEBAUTHN_CHALLENGE, WEBAUTHN_ORIGIN, WEBAUTHN_PRIMITIVE, WEBAUTHN_SIGNATURE, WEBAUTHN_TYPE, WebauthnRefusal, coseKeyParse, decodeAssertion, verifyWebauthn, webauthnChallenge, } from './webauthn.js';
|
|
13
|
+
export { b64Decode } from './wire.js';
|
|
9
14
|
export { CLAUSE_BODY_SIZE, CLAUSE_CANONICAL, CLAUSE_DECISION, CLAUSE_PROPOSAL_BINDING, CLAUSE_RECEIPT_NONCE_SIZE, CLAUSE_SIGNATURE, CLAUSE_SUITE_FLOOR, CLAUSE_TEMPORAL, CLAUSE_UNKNOWN_SUITE, CLAUSE_VALIDITY_WINDOW, CLAUSE_VERSION, CLAUSE_WIRE_TYPE, } from './clauses.js';
|
|
10
15
|
export { ED25519_PK_LEN, ED25519_SIG_LEN, ed25519IsSmallOrder, verifyEd25519Strict, } from './ed25519.js';
|
|
11
16
|
export { parseInstant } from './instant.js';
|