@officialunofficial/kit-wasm 0.0.0-stage → 0.7.1
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/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +147 -2
- package/kit_wasm.d.ts +815 -0
- package/kit_wasm.js +9 -0
- package/kit_wasm_bg.js +2977 -0
- package/kit_wasm_bg.wasm +0 -0
- package/kit_wasm_bg.wasm.d.ts +126 -0
- package/package.json +31 -4
package/kit_wasm.d.ts
ADDED
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class AttestKeyPairJs {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
readonly algo: string;
|
|
9
|
+
readonly keyid: string;
|
|
10
|
+
readonly pubkey_hex: string;
|
|
11
|
+
readonly seed_hex: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class AttestationJs {
|
|
15
|
+
private constructor();
|
|
16
|
+
free(): void;
|
|
17
|
+
[Symbol.dispose](): void;
|
|
18
|
+
readonly attestation_id_hex: string;
|
|
19
|
+
readonly envelope_json: string;
|
|
20
|
+
readonly keyid: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class BaoEncoded {
|
|
24
|
+
private constructor();
|
|
25
|
+
free(): void;
|
|
26
|
+
[Symbol.dispose](): void;
|
|
27
|
+
readonly hash_hex: string;
|
|
28
|
+
readonly outboard: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class BaoVerify {
|
|
32
|
+
private constructor();
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
readonly bytes: Uint8Array | undefined;
|
|
36
|
+
readonly error: string | undefined;
|
|
37
|
+
readonly ok: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* One `FastCDC` chunk boundary plus its BLAKE3.
|
|
42
|
+
*/
|
|
43
|
+
export class ChunkInfo {
|
|
44
|
+
private constructor();
|
|
45
|
+
free(): void;
|
|
46
|
+
[Symbol.dispose](): void;
|
|
47
|
+
readonly hash_hex: string;
|
|
48
|
+
readonly len: number;
|
|
49
|
+
readonly offset: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class ChunkedBlobJs {
|
|
53
|
+
private constructor();
|
|
54
|
+
free(): void;
|
|
55
|
+
[Symbol.dispose](): void;
|
|
56
|
+
chunk(i: number): ChunkInfo | undefined;
|
|
57
|
+
readonly bytes_len: number;
|
|
58
|
+
readonly chunk_count: number;
|
|
59
|
+
readonly root_hash_hex: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class ChunkerResult {
|
|
63
|
+
private constructor();
|
|
64
|
+
free(): void;
|
|
65
|
+
[Symbol.dispose](): void;
|
|
66
|
+
chunk(i: number): ChunkInfo | undefined;
|
|
67
|
+
readonly avg: number;
|
|
68
|
+
/**
|
|
69
|
+
* Number of chunks. The `chunk(i)` getter returns each one by index,
|
|
70
|
+
* which is cheaper than materialising a JS array of opaque handles
|
|
71
|
+
* when the web caller only wants a few.
|
|
72
|
+
*/
|
|
73
|
+
readonly chunk_count: number;
|
|
74
|
+
readonly max: number;
|
|
75
|
+
readonly min: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Decoded display fields of a commit object — what [`commit_decode`]
|
|
80
|
+
* returns for the multiplayer log to walk + render the room's `main`
|
|
81
|
+
* chain. `parents` are 64-hex object ids (parent 0 first); `signer_hex`
|
|
82
|
+
* is the 64-hex Ed25519 signer/author pubkey; `timestamp` is unix
|
|
83
|
+
* seconds; `tree_hex` is the 64-hex tree object id; `signature_hex` is
|
|
84
|
+
* the 128-hex Ed25519 signature.
|
|
85
|
+
*/
|
|
86
|
+
export class CommitInfoJs {
|
|
87
|
+
private constructor();
|
|
88
|
+
free(): void;
|
|
89
|
+
[Symbol.dispose](): void;
|
|
90
|
+
parent(i: number): string | undefined;
|
|
91
|
+
readonly message: string;
|
|
92
|
+
/**
|
|
93
|
+
* Number of parents; pair with [`CommitInfoJs::parent`] to read each
|
|
94
|
+
* 64-hex id by index, matching the `*_count` + indexed-getter shape
|
|
95
|
+
* used by the streaming result structs.
|
|
96
|
+
*/
|
|
97
|
+
readonly parent_count: number;
|
|
98
|
+
/**
|
|
99
|
+
* 128-hex Ed25519 signature over the commit's signing bytes.
|
|
100
|
+
*/
|
|
101
|
+
readonly signature_hex: string;
|
|
102
|
+
readonly signer_hex: string;
|
|
103
|
+
readonly timestamp: bigint;
|
|
104
|
+
/**
|
|
105
|
+
* 64-hex id of the tree this commit snapshots.
|
|
106
|
+
*/
|
|
107
|
+
readonly tree_hex: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* One entry in the delta summary. `offset` is populated only for `copy` ops.
|
|
112
|
+
*/
|
|
113
|
+
export class DeltaOp {
|
|
114
|
+
private constructor();
|
|
115
|
+
free(): void;
|
|
116
|
+
[Symbol.dispose](): void;
|
|
117
|
+
readonly kind: string;
|
|
118
|
+
readonly len: number;
|
|
119
|
+
readonly offset: number | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export class DeltaSummary {
|
|
123
|
+
private constructor();
|
|
124
|
+
free(): void;
|
|
125
|
+
[Symbol.dispose](): void;
|
|
126
|
+
op(i: number): DeltaOp | undefined;
|
|
127
|
+
readonly bytes_on_wire: number;
|
|
128
|
+
readonly full_size: number;
|
|
129
|
+
readonly op_count: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class EncodedCommit {
|
|
133
|
+
private constructor();
|
|
134
|
+
free(): void;
|
|
135
|
+
[Symbol.dispose](): void;
|
|
136
|
+
readonly bytes: Uint8Array;
|
|
137
|
+
readonly hash_hex: string;
|
|
138
|
+
readonly signature_hex: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export class EncodedObject {
|
|
142
|
+
private constructor();
|
|
143
|
+
free(): void;
|
|
144
|
+
[Symbol.dispose](): void;
|
|
145
|
+
readonly bytes: Uint8Array;
|
|
146
|
+
readonly hash_hex: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export class KeyPairJs {
|
|
150
|
+
private constructor();
|
|
151
|
+
free(): void;
|
|
152
|
+
[Symbol.dispose](): void;
|
|
153
|
+
readonly pubkey_hex: string;
|
|
154
|
+
readonly seed_hex: string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Decoded display fields of a remix object — the remix counterpart of
|
|
159
|
+
* [`CommitInfoJs`]. Carries the same commit-shaped fields plus the
|
|
160
|
+
* remix-only `sources` (read via `source_count` + the `source(i)`
|
|
161
|
+
* indexed getter), each a [`RemixSourceJs`] naming an upstream commit
|
|
162
|
+
* the fork derives from. `parents` are 64-hex object ids (parent 0
|
|
163
|
+
* first); `signer_hex` is the 64-hex Ed25519 signer pubkey; `timestamp`
|
|
164
|
+
* is unix seconds; `tree_hex` is the 64-hex tree id; `signature_hex` is
|
|
165
|
+
* the 128-hex Ed25519 signature.
|
|
166
|
+
*/
|
|
167
|
+
export class RemixInfoJs {
|
|
168
|
+
private constructor();
|
|
169
|
+
free(): void;
|
|
170
|
+
[Symbol.dispose](): void;
|
|
171
|
+
parent(i: number): string | undefined;
|
|
172
|
+
source(i: number): RemixSourceJs | undefined;
|
|
173
|
+
readonly message: string;
|
|
174
|
+
/**
|
|
175
|
+
* Number of parents; pair with [`RemixInfoJs::parent`] to read each
|
|
176
|
+
* 64-hex id by index.
|
|
177
|
+
*/
|
|
178
|
+
readonly parent_count: number;
|
|
179
|
+
/**
|
|
180
|
+
* 128-hex Ed25519 signature over the remix's signing bytes.
|
|
181
|
+
*/
|
|
182
|
+
readonly signature_hex: string;
|
|
183
|
+
readonly signer_hex: string;
|
|
184
|
+
/**
|
|
185
|
+
* Number of sources (upstream commits this fork derives from); pair
|
|
186
|
+
* with [`RemixInfoJs::source`] to read each `{ upstream_id_hex,
|
|
187
|
+
* commit_hash_hex }` by index.
|
|
188
|
+
*/
|
|
189
|
+
readonly source_count: number;
|
|
190
|
+
readonly timestamp: bigint;
|
|
191
|
+
/**
|
|
192
|
+
* 64-hex id of the tree this remix snapshots.
|
|
193
|
+
*/
|
|
194
|
+
readonly tree_hex: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* One remix source: a `{ upstream_id_hex, commit_hash_hex }` pair naming
|
|
199
|
+
* an upstream commit this fork derives from. `upstream_id` is the opaque
|
|
200
|
+
* caller-chosen 32-byte provenance tag (e.g. the room id); `commit_hash`
|
|
201
|
+
* is the 64-hex id of the upstream commit being remixed.
|
|
202
|
+
*/
|
|
203
|
+
export class RemixSourceJs {
|
|
204
|
+
private constructor();
|
|
205
|
+
free(): void;
|
|
206
|
+
[Symbol.dispose](): void;
|
|
207
|
+
readonly commit_hash_hex: string;
|
|
208
|
+
readonly upstream_id_hex: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A verified KDSP span, including its authenticated metadata and plaintext.
|
|
213
|
+
*
|
|
214
|
+
* Both getters use the result of one verification. The JSON deliberately
|
|
215
|
+
* excludes the bytes; callers obtain them through [`VerifiedSpan::bytes`].
|
|
216
|
+
*/
|
|
217
|
+
export class VerifiedSpan {
|
|
218
|
+
private constructor();
|
|
219
|
+
free(): void;
|
|
220
|
+
[Symbol.dispose](): void;
|
|
221
|
+
/**
|
|
222
|
+
* The authenticated content bytes of the requested range.
|
|
223
|
+
*/
|
|
224
|
+
readonly bytes: Uint8Array;
|
|
225
|
+
/**
|
|
226
|
+
* Authenticated span metadata as JSON.
|
|
227
|
+
*/
|
|
228
|
+
readonly json: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Build a DSSE-wrapped in-toto v1 attestation over a subject, signed with the chosen algorithm.
|
|
233
|
+
*
|
|
234
|
+
* * `subject_bytes` is the subject's serialised bytes — its `blake3` and
|
|
235
|
+
* paired `sha256` digest (SPEC-ATTESTATIONS §4.2) are both derived from
|
|
236
|
+
* these bytes, so the two can never disagree. For a real commit this is
|
|
237
|
+
* the commit's serialised bytes; callers binding a non-commit subject
|
|
238
|
+
* (e.g. a derived-key identity binding) pass whatever bytes that
|
|
239
|
+
* subject's identifier is itself the hash of.
|
|
240
|
+
* * `predicate_type` is a URI like `https://example.com/Review/v1`.
|
|
241
|
+
* * `predicate_jcs` is the predicate body as already-canonical JCS bytes (must start with `{` and end with `}`).
|
|
242
|
+
* * `seed_hex` is a 32-byte seed. How it's interpreted depends on `algo`:
|
|
243
|
+
* * `ed25519` — raw Ed25519 seed
|
|
244
|
+
* * `secp256k1` — raw 32-byte scalar
|
|
245
|
+
* * `p256` — raw 32-byte scalar
|
|
246
|
+
*
|
|
247
|
+
* Returns `{ envelope_json, keyid, attestation_id_hex }`. The keyid's prefix reveals which algorithm was used.
|
|
248
|
+
*/
|
|
249
|
+
export function attest_build(subject_bytes: Uint8Array, predicate_type: string, predicate_jcs: Uint8Array, seed_hex: string, algo: string): AttestationJs;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Derive the pubkey + canonical keyid for the given attestation algorithm from a 32-byte seed. `algo` is one of
|
|
253
|
+
* `"ed25519" | "secp256k1" | "p256"`. Deterministic: same seed + same algorithm always produces the same pubkey.
|
|
254
|
+
*
|
|
255
|
+
* Pubkey encoding depends on the algorithm:
|
|
256
|
+
* * `ed25519` — 32-byte raw pubkey
|
|
257
|
+
* * `secp256k1` — 33-byte compressed SEC1 (`0x02`/`0x03` prefix + x)
|
|
258
|
+
* * `p256` — 33-byte compressed SEC1 (same shape)
|
|
259
|
+
*
|
|
260
|
+
* `keyid` follows the canonical `<prefix>:<hex-pubkey>` form described in SPEC-ATTESTATIONS §6.3 for ES256K / ES256,
|
|
261
|
+
* and the legacy `blake3:<hex-of-blake3(pubkey)>` form for Ed25519 (what `RepoKeySigner` emits; verifier accepts).
|
|
262
|
+
*/
|
|
263
|
+
export function attest_keypair(seed_hex: string, algo: string): AttestKeyPairJs;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Compute the DSSE PAE for an (unsigned) in-toto attestation over a
|
|
267
|
+
* subject. This is the exact byte string a browser passkey MUST
|
|
268
|
+
* place in its `WebAuthn` `challenge` so the resulting assertion
|
|
269
|
+
* verifies under [`verify_webauthn_wrapping`].
|
|
270
|
+
*
|
|
271
|
+
* Same `(subject_bytes, predicate_type, predicate_jcs)` inputs as
|
|
272
|
+
* [`attest_build`], minus the key — the PAE is signer-independent, so a
|
|
273
|
+
* passkey and a software key over the same statement bind to identical
|
|
274
|
+
* bytes. Returns the raw PAE; the JS side passes it straight to
|
|
275
|
+
* `navigator.credentials.get` as a `BufferSource` challenge.
|
|
276
|
+
*
|
|
277
|
+
* NOTE: the `WebAuthn` `challenge` here is the *whole* PAE, and platform
|
|
278
|
+
* authenticators cap challenge size in practice — keep demo predicates
|
|
279
|
+
* small (see the research note's "challenge sizing" fork).
|
|
280
|
+
*
|
|
281
|
+
* # Errors
|
|
282
|
+
* The statement fails to encode.
|
|
283
|
+
*/
|
|
284
|
+
export function attest_pae(subject_bytes: Uint8Array, predicate_type: string, predicate_jcs: Uint8Array): Uint8Array;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Verify a DSSE envelope against a single trust root of the given algorithm.
|
|
288
|
+
*
|
|
289
|
+
* * `envelope_json` is the canonical DSSE envelope JSON emitted by [`attest_build`].
|
|
290
|
+
* * `pubkey_hex` is the public key, hex-encoded:
|
|
291
|
+
* * `ed25519` — 32-byte raw pubkey (64 hex chars)
|
|
292
|
+
* * `secp256k1` — 33-byte compressed SEC1 (66 hex chars) or 65-byte uncompressed (130 hex chars)
|
|
293
|
+
* * `p256` — same shape as `secp256k1`
|
|
294
|
+
* * `algo` selects which trust-root variant the registry dispatches on.
|
|
295
|
+
*
|
|
296
|
+
* Returns `true` iff at least one signature in the envelope verifies.
|
|
297
|
+
*/
|
|
298
|
+
export function attest_verify(envelope_json: string, pubkey_hex: string, algo: string): boolean;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Encode `bytes` in Bao outboard mode and return `{ hash_hex, outboard }`.
|
|
302
|
+
* Outboard keeps the encoded tree proof separate from the payload so
|
|
303
|
+
* the demo can stream the original bytes on one track and the proof on
|
|
304
|
+
* another.
|
|
305
|
+
*/
|
|
306
|
+
export function bao_encode(bytes: Uint8Array): BaoEncoded;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Extract a proof-carrying slice from a Bao outboard encoding. The
|
|
310
|
+
* returned bytes are in the format `bao::decode::SliceDecoder`
|
|
311
|
+
* consumes — the original payload plus just enough tree proof to
|
|
312
|
+
* verify it against the root hash.
|
|
313
|
+
*/
|
|
314
|
+
export function bao_slice(outboard: Uint8Array, bytes: Uint8Array, offset: number, len: number): Uint8Array;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Verify a Bao slice against a root hash. On success returns
|
|
318
|
+
* `{ ok: true, bytes }` with the verified payload. On tamper returns
|
|
319
|
+
* `{ ok: false, error }` with the error message — a convenience over
|
|
320
|
+
* throwing, since the demo wants to render both outcomes side-by-side.
|
|
321
|
+
*/
|
|
322
|
+
export function bao_verify_slice(hash_hex: string, slice_bytes: Uint8Array, offset: number, len: number): BaoVerify;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* BLAKE3 of arbitrary bytes, as 64-char lowercase hex. This is the
|
|
326
|
+
* object id kit uses for every stored object.
|
|
327
|
+
*/
|
|
328
|
+
export function blake3_hex(data: Uint8Array): string;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Bao outboard over the **canonical blob bytes** of `content`.
|
|
332
|
+
*
|
|
333
|
+
* `hash_hex` equals the blob object id (`object_id(blob_encode(content).bytes)`).
|
|
334
|
+
* Distinct from [`crate::bao_encode`], which hashes raw file bytes.
|
|
335
|
+
*
|
|
336
|
+
* # Errors
|
|
337
|
+
*
|
|
338
|
+
* Content larger than 16 MiB, or a serialize failure.
|
|
339
|
+
*/
|
|
340
|
+
export function blob_bao_encode(content: Uint8Array): BaoEncoded;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Extract a Bao slice over canonical blob bytes at a **content** offset.
|
|
344
|
+
*
|
|
345
|
+
* The +10 shift onto the canonical blob (6-byte prologue + 4-byte
|
|
346
|
+
* length) happens inside. Distinct from [`crate::bao_slice`].
|
|
347
|
+
*
|
|
348
|
+
* # Errors
|
|
349
|
+
*
|
|
350
|
+
* Oversize content, serialize failure, or a slice-extract error.
|
|
351
|
+
*/
|
|
352
|
+
export function blob_bao_slice(outboard: Uint8Array, content: Uint8Array, content_offset: number, len: number): Uint8Array;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Verify a Bao slice against a blob id at a **content** offset.
|
|
356
|
+
*
|
|
357
|
+
* Delegates to [`kit_core::verify::verify_blob_slice`]. Tamper returns
|
|
358
|
+
* `{ ok: false, error }` rather than throwing, matching [`crate::bao_verify_slice`].
|
|
359
|
+
*
|
|
360
|
+
* # Errors
|
|
361
|
+
*
|
|
362
|
+
* Malformed `blob_id_hex`.
|
|
363
|
+
*/
|
|
364
|
+
export function blob_bao_verify_slice(blob_id_hex: string, slice: Uint8Array, content_offset: number, len: number): BaoVerify;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Decode a canonical blob into its uninterpreted file bytes.
|
|
368
|
+
*
|
|
369
|
+
* # Errors
|
|
370
|
+
* Invalid encoding, a non-blob object, or input larger than 16 MiB.
|
|
371
|
+
*/
|
|
372
|
+
export function blob_decode(bytes: Uint8Array): Uint8Array;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Serialize a blob object and return `{ bytes, hash_hex }`.
|
|
376
|
+
*
|
|
377
|
+
* The returned `bytes` are the canonical on-disk v1 object bytes
|
|
378
|
+
* (see `docs/specs/SPEC-OBJECTS.md`); `hash_hex` is the object's content id
|
|
379
|
+
* (via `id_from_object`) — for a non-merkelized `Blob`, BLAKE3 of those bytes.
|
|
380
|
+
*/
|
|
381
|
+
export function blob_encode(data: Uint8Array): EncodedObject;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Run the frozen v1 `FastCDC` chunker over `bytes` and return
|
|
385
|
+
* `{ chunks: [{ offset, len, hash_hex }], avg, min, max }`.
|
|
386
|
+
*
|
|
387
|
+
* Each `hash_hex` is BLAKE3 of the chunk payload — handy for colouring
|
|
388
|
+
* chips in the web demo when an edit shifts boundaries.
|
|
389
|
+
*/
|
|
390
|
+
export function chunk_boundaries(bytes: Uint8Array): ChunkerResult;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Decode a canonical `ChunkedBlob` object into JSON
|
|
394
|
+
* `{ total_size, chunk_size, chunks: [hex] }`.
|
|
395
|
+
*
|
|
396
|
+
* Input is capped at 16 MiB, matching [`crate::chunked_blob_encode`]'s
|
|
397
|
+
* workspace admission limit.
|
|
398
|
+
*
|
|
399
|
+
* # Errors
|
|
400
|
+
*
|
|
401
|
+
* Oversize input, invalid encoding, or a non-`ChunkedBlob` object.
|
|
402
|
+
*/
|
|
403
|
+
export function chunked_blob_decode(bytes: Uint8Array): string;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Build a `ChunkedBlob` manifest from raw bytes: chunk with `FastCDC` v1 and
|
|
407
|
+
* return `{ root_hash_hex, chunks: [{ offset, len, hash_hex }], bytes_len }`.
|
|
408
|
+
*
|
|
409
|
+
* `root_hash_hex` is the object's content id — the BMT root of the manifest,
|
|
410
|
+
* whose leaves are the per-chunk **Blob object ids** (built via the shared
|
|
411
|
+
* `worktree::chunked_blob_from_bytes`), so it equals the id the native store
|
|
412
|
+
* keys the `ChunkedBlob` under. Each chunk's `hash_hex` is the **raw**
|
|
413
|
+
* BLAKE3 of the chunk payload — for UI colouring/dedup, distinct from the
|
|
414
|
+
* manifest leaf. `chunk_size` is `0` (the CDC marker, SPEC-OBJECTS §13.7).
|
|
415
|
+
*/
|
|
416
|
+
export function chunked_blob_encode(bytes: Uint8Array): ChunkedBlobJs;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Decode a commit object's display fields from its raw on-disk bytes.
|
|
420
|
+
*
|
|
421
|
+
* Deserializes via the same path [`commit_verify`] uses
|
|
422
|
+
* (`kit_core::deserialize` → [`Object::Commit`]) and exposes the
|
|
423
|
+
* fields the multiplayer log needs to walk + render the room's `main`
|
|
424
|
+
* chain: the [`CommitInfoJs::message`], the parents via
|
|
425
|
+
* [`CommitInfoJs::parent_count`] / [`CommitInfoJs::parent`]
|
|
426
|
+
* (64-hex object ids, parent 0 first), the
|
|
427
|
+
* [`CommitInfoJs::signer_hex`] (the 64-hex Ed25519 signer/author
|
|
428
|
+
* pubkey), the [`CommitInfoJs::timestamp`] (unix seconds), the
|
|
429
|
+
* [`CommitInfoJs::tree_hex`] (64-hex tree object id), and the
|
|
430
|
+
* [`CommitInfoJs::signature_hex`] (128-hex Ed25519 signature) — the
|
|
431
|
+
* last two power the navigable commit-detail view.
|
|
432
|
+
*
|
|
433
|
+
* This function does not verify the signature. The signer, tree and
|
|
434
|
+
* signature fields are unverified claims. Call [`commit_verify`] to check
|
|
435
|
+
* them. Input over 16 MiB is rejected.
|
|
436
|
+
*
|
|
437
|
+
* # Errors
|
|
438
|
+
* `commit_bytes` is not a valid serialized object, or it deserializes
|
|
439
|
+
* to a non-`Commit` object.
|
|
440
|
+
*/
|
|
441
|
+
export function commit_decode(bytes: Uint8Array): CommitInfoJs;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Build and sign a commit, returning `{ bytes, hash_hex, signature_hex }`.
|
|
445
|
+
*
|
|
446
|
+
* `parent_hex` is a comma-separated list of parent commit hashes (empty
|
|
447
|
+
* string = root commit). `seed_hex` is the 32-byte Ed25519 seed.
|
|
448
|
+
*/
|
|
449
|
+
export function commit_encode_and_sign(tree_hash_hex: string, parent_hex: string, message: string, timestamp: bigint, seed_hex: string): EncodedCommit;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Verify a commit signature, given the raw on-disk commit bytes.
|
|
453
|
+
* Returns `true` on pass, `false` on structural or crypto failure.
|
|
454
|
+
* Input over 16 MiB returns `false`.
|
|
455
|
+
*/
|
|
456
|
+
export function commit_verify(commit_bytes: Uint8Array): boolean;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Build a SPEC-DELTA v1 stream of `base -> target` and return a
|
|
460
|
+
* structural summary: `{ ops, bytes_on_wire, full_size }`.
|
|
461
|
+
*
|
|
462
|
+
* `ops` contains one entry per opcode — `{ kind: "copy", offset, len }`
|
|
463
|
+
* or `{ kind: "insert", len }` — without the insert payloads, so the
|
|
464
|
+
* whole thing stays cheap to pass across the JS boundary. `bytes_on_wire`
|
|
465
|
+
* is the total delta stream length; `full_size` is `target.len()` for
|
|
466
|
+
* easy delta-savings calculation.
|
|
467
|
+
*/
|
|
468
|
+
export function delta_encode(base: Uint8Array, target: Uint8Array): DeltaSummary;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Return the verified payload bytes of a disclosure bundle.
|
|
472
|
+
*
|
|
473
|
+
* Re-verifies the bundle. Object payload: canonical object bytes. Chunk
|
|
474
|
+
* payload: the chunk's canonical blob bytes. Range payload: the
|
|
475
|
+
* disclosed range bytes.
|
|
476
|
+
*
|
|
477
|
+
* # Errors
|
|
478
|
+
*
|
|
479
|
+
* The same failures as [`verify_disclosure`].
|
|
480
|
+
*/
|
|
481
|
+
export function disclosure_payload_bytes(commit_id_hex: string, bundle: Uint8Array): Uint8Array;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Derive the 32-byte Ed25519 public key from a 32-byte seed.
|
|
485
|
+
*
|
|
486
|
+
* Pure function: same seed → same pubkey. Errors only if `seed` is not
|
|
487
|
+
* exactly 32 bytes. Internally goes through `kit-core`'s
|
|
488
|
+
* `KeyPair::from_seed`, which is the same derivation step the commit
|
|
489
|
+
* signer uses, so a key minted here interoperates 1:1 with on-disk
|
|
490
|
+
* `.kit/keys/default.key` material.
|
|
491
|
+
*/
|
|
492
|
+
export function ed25519_pubkey_from_seed(seed: Uint8Array): Uint8Array;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Sign `msg` with the Ed25519 secret derived from a 32-byte `seed`.
|
|
496
|
+
*
|
|
497
|
+
* Returns the 64-byte signature (`R || s`). Errors only if `seed` is
|
|
498
|
+
* not exactly 32 bytes — Ed25519 signing itself is infallible once the
|
|
499
|
+
* key material is the right shape (RFC 8032 is deterministic; no RNG).
|
|
500
|
+
*
|
|
501
|
+
* The output is byte-equal to
|
|
502
|
+
* `ed25519_dalek::SigningKey::from_bytes(seed).sign(msg)`, which is the
|
|
503
|
+
* same signing path `kit-core::sign::KeyPair` drives for commit
|
|
504
|
+
* signatures (modulo the BLAKE3-domain wrapper that commits add on
|
|
505
|
+
* top — those callers should keep using `commit_encode_and_sign`).
|
|
506
|
+
*/
|
|
507
|
+
export function ed25519_sign(msg: Uint8Array, seed: Uint8Array): Uint8Array;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Verify a raw Ed25519 signature, with strict canonical-encoding checks.
|
|
511
|
+
*
|
|
512
|
+
* Returns `true` only if the signature passes the SPEC-SIGNING §1
|
|
513
|
+
* predicate over `msg`: canonical, non-small-order `A` and `R`, canonical
|
|
514
|
+
* `s`, and the cofactored equation. This is the same check every other
|
|
515
|
+
* Ed25519 verifier in kit runs.
|
|
516
|
+
*
|
|
517
|
+
* Wrong-length `sig` or `pubkey` return `false` (the JS API matches the
|
|
518
|
+
* noble shape — boolean out, no exceptions on shape errors).
|
|
519
|
+
*/
|
|
520
|
+
export function ed25519_verify(sig: Uint8Array, msg: Uint8Array, pubkey: Uint8Array): boolean;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Derive `{ seed_hex, pubkey_hex }` from a 32-byte seed. Deterministic:
|
|
524
|
+
* the same seed always yields the same public key.
|
|
525
|
+
*/
|
|
526
|
+
export function keypair_from_seed(seed_hex: string): KeyPairJs;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Generate a fresh Ed25519 keypair from the browser CSPRNG.
|
|
530
|
+
*/
|
|
531
|
+
export function keypair_generate(): KeyPairJs;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Return a canonical object's 64-hex content id, including Merkle ids.
|
|
535
|
+
*
|
|
536
|
+
* This checks the encoding, not signatures or referenced child objects.
|
|
537
|
+
* Callers must compare the result with the independently requested id.
|
|
538
|
+
*
|
|
539
|
+
* # Errors
|
|
540
|
+
* Invalid object encoding or input larger than 16 MiB.
|
|
541
|
+
*/
|
|
542
|
+
export function object_id(bytes: Uint8Array): string;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Read the object-type tag from a serialized object's prologue and
|
|
546
|
+
* return its spec short name: `"commit" | "remix" | "tree" | "blob" |
|
|
547
|
+
* "chunked_blob" | "delta" | "tag"`.
|
|
548
|
+
*
|
|
549
|
+
* Lets the browser route a fetched object to the right decoder
|
|
550
|
+
* (`commit_decode` vs `remix_decode`) without guessing or trial-decoding.
|
|
551
|
+
* Goes through `kit_core::deserialize` so the answer reflects a fully
|
|
552
|
+
* well-formed object, then reports `ObjectType::name`.
|
|
553
|
+
*
|
|
554
|
+
* # Errors
|
|
555
|
+
* `bytes` is not a valid serialized object (bad prologue / truncated /
|
|
556
|
+
* unknown type tag), or longer than 16 MiB.
|
|
557
|
+
*/
|
|
558
|
+
export function object_kind(bytes: Uint8Array): string;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Decode a remix object's display fields from its raw on-disk bytes.
|
|
562
|
+
*
|
|
563
|
+
* The remix counterpart of [`commit_decode`]: deserializes via
|
|
564
|
+
* `kit_core::deserialize` → [`Object::Remix`] and exposes the same
|
|
565
|
+
* commit-shaped fields (`message`, `signer_hex`, `timestamp`,
|
|
566
|
+
* `tree_hex`, `signature_hex`, `parents`) plus the remix-only
|
|
567
|
+
* `sources` — each a `{ upstream_id_hex, commit_hash_hex }`
|
|
568
|
+
* read by `source_count` + the `source(i)` indexed getter. The web
|
|
569
|
+
* browser uses the sources to render the "fork of …" badge whose
|
|
570
|
+
* `commit_hash` links to the upstream commit's detail.
|
|
571
|
+
*
|
|
572
|
+
* This function does not verify the signature. The signer, tree and
|
|
573
|
+
* signature fields are unverified claims. Input over 16 MiB is rejected.
|
|
574
|
+
*
|
|
575
|
+
* # Errors
|
|
576
|
+
* `bytes` is not a valid serialized object, or it deserializes to a
|
|
577
|
+
* non-`Remix` object.
|
|
578
|
+
*/
|
|
579
|
+
export function remix_decode(bytes: Uint8Array): RemixInfoJs;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Build and sign a remix (fork/derivation), returning
|
|
583
|
+
* `{ bytes, hash_hex, signature_hex }` like [`commit_encode_and_sign`].
|
|
584
|
+
*
|
|
585
|
+
* A `Remix` is the first-class fork object: it snapshots a `tree_hash`,
|
|
586
|
+
* names zero or more `parents` (prior remixes/commits in the fork's own
|
|
587
|
+
* history), and — crucially — records one or more `sources`, each a
|
|
588
|
+
* `RemixSource { upstream_id, commit_hash }` pointing at the upstream
|
|
589
|
+
* commit(s) this fork derives from.
|
|
590
|
+
*
|
|
591
|
+
* Inputs mirror the commit variant, plus `sources_json`:
|
|
592
|
+
* * `tree_hash_hex` — 64-hex tree object id this remix snapshots.
|
|
593
|
+
* * `parent_hex` — comma-separated parent ids (empty = root remix).
|
|
594
|
+
* * `sources_json` — JSON array of `{ "upstream_id_hex", "commit_hash_hex" }`
|
|
595
|
+
* objects, each 64-hex. The upstream commits being forked/remixed.
|
|
596
|
+
* * `message` / `timestamp` — same as a commit.
|
|
597
|
+
* * `seed_hex` — the 32-byte Ed25519 seed.
|
|
598
|
+
*
|
|
599
|
+
* `sources` are sorted here by `(upstream_id, commit_hash)` and checked
|
|
600
|
+
* for duplicates, satisfying the strict-ascending order kit-core's
|
|
601
|
+
* `read_remix` enforces at decode time (see `Remix::sources_sorted`).
|
|
602
|
+
* At least one source is required — a remix with no source is not a fork.
|
|
603
|
+
*
|
|
604
|
+
* # Errors
|
|
605
|
+
* Any hex field is malformed, `sources_json` does not parse, `sources`
|
|
606
|
+
* is empty or contains a duplicate `(upstream_id, commit_hash)` pair, or
|
|
607
|
+
* signing-bytes construction fails.
|
|
608
|
+
*/
|
|
609
|
+
export function remix_encode_and_sign(tree_hash_hex: string, parent_hex: string, sources_json: string, message: string, timestamp: bigint, seed_hex: string): EncodedCommit;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Verify a canonical remix's signature. Returns false for invalid encoding,
|
|
613
|
+
* wrong object kind, signature failure, or input larger than 16 MiB.
|
|
614
|
+
*/
|
|
615
|
+
export function remix_verify(bytes: Uint8Array): boolean;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Sign arbitrary bytes under kit's commit signing domain. Exposed for
|
|
619
|
+
* the signing demo — real kit commits go through `commit_encode_and_sign`.
|
|
620
|
+
*/
|
|
621
|
+
export function sign_bytes_commit_domain(seed_hex: string, bytes: Uint8Array): string;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Decode a canonical tree into JSON `[name, mode, hash_hex]` triples.
|
|
625
|
+
* Modes match [`tree_encode`]: `blob`, `tree`, `symlink`, and `exec`.
|
|
626
|
+
*
|
|
627
|
+
* # Errors
|
|
628
|
+
* Invalid encoding, a non-tree object, input larger than 16 MiB, or a
|
|
629
|
+
* non-UTF-8 entry name (which cannot round-trip through the JSON API).
|
|
630
|
+
*/
|
|
631
|
+
export function tree_decode(bytes: Uint8Array): string;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Build a tree object from a JSON array of `[name, mode, hash_hex]`
|
|
635
|
+
* triples and return its serialized bytes + hash. `mode` is one of
|
|
636
|
+
* `"blob" | "tree" | "symlink" | "exec"`.
|
|
637
|
+
*/
|
|
638
|
+
export function tree_encode(entries_json: string): EncodedObject;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Verify a signature made by [`sign_bytes_commit_domain`].
|
|
642
|
+
*/
|
|
643
|
+
export function verify_bytes_commit_domain(pubkey_hex: string, bytes: Uint8Array, sig_hex: string): boolean;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Verify a single chunk inclusion proof against a `ChunkedBlob` id.
|
|
647
|
+
*
|
|
648
|
+
* `position` is the BMT position (chunk index + 1). Position 0 is the
|
|
649
|
+
* metadata leaf and is never a valid chunk proof. Returns `Ok(false)`
|
|
650
|
+
* on [`MerkleError::VerificationFailed`]; `Err` on malformed input.
|
|
651
|
+
*
|
|
652
|
+
* # Errors
|
|
653
|
+
*
|
|
654
|
+
* Malformed hex or proof bytes, or any merkle error other than
|
|
655
|
+
* [`MerkleError::VerificationFailed`].
|
|
656
|
+
*/
|
|
657
|
+
export function verify_chunk(chunked_id_hex: string, chunk_id_hex: string, position: number, proof: Uint8Array): boolean;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Verify a closure manifest plus concatenated packs against a trusted root.
|
|
661
|
+
*
|
|
662
|
+
* The manifest is a locator, never a trust anchor: `expected_root_hex`
|
|
663
|
+
* must match the manifest root. Pack framing matches
|
|
664
|
+
* [`verify_closure_packs`].
|
|
665
|
+
*
|
|
666
|
+
* # Errors
|
|
667
|
+
*
|
|
668
|
+
* Malformed hex, oversize input, or any [`verify::VerifyError`].
|
|
669
|
+
*/
|
|
670
|
+
export function verify_closure_manifest(expected_root_hex: string, manifest: Uint8Array, packs: Uint8Array, pack_lengths_json: string): string;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Verify concatenated raw-only closure packs against a trusted root.
|
|
674
|
+
*
|
|
675
|
+
* `mode` is `"snapshot"` or `"history"`. `packs` is the concatenation of
|
|
676
|
+
* each pack's bytes; `pack_lengths_json` is a JSON array of those
|
|
677
|
+
* lengths in the same order, e.g. `"[1024,2048]"`. Each pack and the
|
|
678
|
+
* concatenated buffer are capped at 1 GiB.
|
|
679
|
+
*
|
|
680
|
+
* Returns JSON `{ root, mode, verified, complete, unreferenced_checked,
|
|
681
|
+
* missing, corrupt, unreferenced }`.
|
|
682
|
+
*
|
|
683
|
+
* # Errors
|
|
684
|
+
*
|
|
685
|
+
* Malformed hex or mode, oversize or mis-sliced packs, or any
|
|
686
|
+
* [`verify::VerifyError`].
|
|
687
|
+
*/
|
|
688
|
+
export function verify_closure_packs(root_hex: string, mode: string, packs: Uint8Array, pack_lengths_json: string): string;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Verify a disclosure bundle against a trusted commit id.
|
|
692
|
+
*
|
|
693
|
+
* Returns JSON `{ commit_id, tree_hash, path, leaf_id, signer,
|
|
694
|
+
* signature_valid, payload, step_inner_roots, chunk_inner_root }`
|
|
695
|
+
* **without** payload bytes. Call
|
|
696
|
+
* [`disclosure_payload_bytes`] for the verified bytes. Both functions
|
|
697
|
+
* re-verify; a caller that wants both should call this first and treat a
|
|
698
|
+
* failure of either as a failure.
|
|
699
|
+
*
|
|
700
|
+
* `path` entries are `{ name }` (UTF-8 or `null`), `{ name_hex }`, and
|
|
701
|
+
* `{ mode }` (`blob` / `tree` / `symlink` / `exec`). Payload `kind` is
|
|
702
|
+
* `object`, `chunk`, or `range`. Bundles larger than 64 MiB
|
|
703
|
+
* ([`MAX_BUNDLE_BYTES`]) are rejected before decode.
|
|
704
|
+
*
|
|
705
|
+
* # Errors
|
|
706
|
+
*
|
|
707
|
+
* Malformed hex, an oversize bundle, or any [`verify::VerifyError`].
|
|
708
|
+
*/
|
|
709
|
+
export function verify_disclosure(commit_id_hex: string, bundle: Uint8Array): string;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Verify a KDSP v1 span container against a trusted commit id.
|
|
713
|
+
*
|
|
714
|
+
* The JSON contains `commit_id`, `tree_hash`, `path`, `leaf_id`, `signer`,
|
|
715
|
+
* `signature_valid`, `offset`, `bytes_len`, `bytes_blake3`, `first`, `last`,
|
|
716
|
+
* `span_start`, and `chunk_inner_root`. A `path` entry has `name` (UTF-8 or
|
|
717
|
+
* `null`), `name_hex`, and `mode`. The bytes are returned by the getter of
|
|
718
|
+
* the same [`VerifiedSpan`] and are never reverified. Input is capped at
|
|
719
|
+
* 64 MiB. Every error starts with a SPEC-DISCLOSURE §8.2 reason label,
|
|
720
|
+
* except a malformed `commit_id_hex`, which is not a §8.2 condition and
|
|
721
|
+
* starts with `invalid_input:`.
|
|
722
|
+
*
|
|
723
|
+
* # Errors
|
|
724
|
+
*
|
|
725
|
+
* Invalid commit hex, an oversized container, malformed framing, or a
|
|
726
|
+
* failed cryptographic or span check.
|
|
727
|
+
*/
|
|
728
|
+
export function verify_disclosure_span(commit_id_hex: string, bundle: Uint8Array): VerifiedSpan;
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Verify a single tree-entry inclusion proof against a tree object id.
|
|
732
|
+
*
|
|
733
|
+
* `entry_json` is `{ "name" | "name_hex", "mode", "object_hash" }`.
|
|
734
|
+
* `mode` matches [`crate::tree_encode`]: `blob` / `tree` / `symlink` /
|
|
735
|
+
* `exec`. `object_hash` is 64-char lowercase hex. Returns `Ok(false)`
|
|
736
|
+
* when the proof does not fold to `tree_id_hex`
|
|
737
|
+
* ([`MerkleError::VerificationFailed`]); `Err` on malformed input.
|
|
738
|
+
*
|
|
739
|
+
* # Errors
|
|
740
|
+
*
|
|
741
|
+
* Malformed hex, JSON, or proof bytes, or any merkle error other than
|
|
742
|
+
* [`MerkleError::VerificationFailed`].
|
|
743
|
+
*/
|
|
744
|
+
export function verify_tree_entry(tree_id_hex: string, entry_json: string, position: number, proof: Uint8Array): boolean;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Verify a browser passkey (`WebAuthn` / P-256) assertion against a DSSE
|
|
748
|
+
* PAE — cryptographic checks only, no ceremony policy.
|
|
749
|
+
*
|
|
750
|
+
* Thin wrapper over `kit_attest::verify_webauthn_wrapping`. Checks the
|
|
751
|
+
* `type == "webauthn.get"`, `challenge == base64url-nopad(pae)`, the
|
|
752
|
+
* `authenticatorData` shape, and the P-256 signature over
|
|
753
|
+
* `authenticatorData || SHA-256(clientDataJSON)`. It does NOT bind the
|
|
754
|
+
* RP ID or origin — use [`verify_webauthn_wrapping_with_policy`] for
|
|
755
|
+
* that (which is what a real demo should do, pinning the RP ID to the
|
|
756
|
+
* site so the green check proves origin binding, not just a signature).
|
|
757
|
+
*
|
|
758
|
+
* * `pae` — the bytes from [`attest_pae`].
|
|
759
|
+
* * `authenticator_data` / `client_data_json` — raw bytes from the
|
|
760
|
+
* browser assertion (`response.authenticatorData` /
|
|
761
|
+
* `response.clientDataJSON`), passed as a `Uint8Array`.
|
|
762
|
+
* * `pubkey_hex` — SEC1 P-256 public key, 33-byte compressed (66 hex)
|
|
763
|
+
* or 65-byte uncompressed (130 hex).
|
|
764
|
+
* * `signature` — 64-byte compact `r || s` (DER must be converted and
|
|
765
|
+
* low-S-normalised JS-side first).
|
|
766
|
+
*
|
|
767
|
+
* Returns `Ok(())` when the assertion verifies. On failure the `Err`
|
|
768
|
+
* carries the typed reason (challenge mismatch, signature failed, …) so
|
|
769
|
+
* the demo can show *why* — more instructive than a bare boolean.
|
|
770
|
+
*
|
|
771
|
+
* # Errors
|
|
772
|
+
* `pubkey_hex` is not valid hex, or any `WebAuthn` verification failure.
|
|
773
|
+
*/
|
|
774
|
+
export function verify_webauthn_wrapping(pae: Uint8Array, authenticator_data: Uint8Array, client_data_json: Uint8Array, pubkey_hex: string, signature: Uint8Array): void;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Policy-aware counterpart of [`verify_webauthn_wrapping`].
|
|
778
|
+
*
|
|
779
|
+
* Same cryptographic checks, plus the ceremony policy parsed from
|
|
780
|
+
* `policy_json` — an empty string (or `"{}"`) is fully permissive.
|
|
781
|
+
* Recognised keys (all optional):
|
|
782
|
+
*
|
|
783
|
+
* ```json
|
|
784
|
+
* {
|
|
785
|
+
* "expected_rp_id": "kit.storage",
|
|
786
|
+
* "allowed_origins": ["https://kit.storage"],
|
|
787
|
+
* "require_user_presence": true,
|
|
788
|
+
* "require_user_verification": false,
|
|
789
|
+
* "allow_cross_origin": false,
|
|
790
|
+
* "previous_sign_count": 0
|
|
791
|
+
* }
|
|
792
|
+
* ```
|
|
793
|
+
*
|
|
794
|
+
* Defaults match `WebAuthnPolicy::permissive` (no RP-ID/origin binding,
|
|
795
|
+
* UP/UV off, cross-origin allowed, counter unenforced) — only keys
|
|
796
|
+
* present in `policy_json` tighten the check.
|
|
797
|
+
*
|
|
798
|
+
* # Errors
|
|
799
|
+
* Malformed `policy_json`, `pubkey_hex` is not valid hex, or any
|
|
800
|
+
* `WebAuthn` verification failure.
|
|
801
|
+
*/
|
|
802
|
+
export function verify_webauthn_wrapping_with_policy(pae: Uint8Array, authenticator_data: Uint8Array, client_data_json: Uint8Array, pubkey_hex: string, signature: Uint8Array, policy_json: string): void;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Wrap a BMT inner root with the kit type domain, producing the object id.
|
|
806
|
+
*
|
|
807
|
+
* `kind` is `"tree"` or `"chunked_blob"`. For a commonware BMT verifier
|
|
808
|
+
* that checked the inner root, this is the remaining step before
|
|
809
|
+
* comparing to an kit id.
|
|
810
|
+
*
|
|
811
|
+
* # Errors
|
|
812
|
+
*
|
|
813
|
+
* Unknown `kind` or malformed hex.
|
|
814
|
+
*/
|
|
815
|
+
export function wrap_object_id(kind: string, inner_root_hex: string): string;
|