@metalabel/dfos-protocol 0.52.1 → 0.54.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.
@@ -1,4 +1,4 @@
1
- export { b as Attenuation, e as CredentialVerificationError, D as DFOSCredentialPayload, i as MAX_CREDENTIAL_SIZE, R as ResolvedIdentity, r as RevocationChecker, V as VerifiedDFOSCredential, w as VerifiedDelegationChain, z as createDFOSCredential, B as decodeDFOSCredentialUnsafe, E as isAttenuated, F as matchesResource, H as verifyDFOSCredential, J as verifyDelegationChain } from '../dfos-credential-j-kHtFvG.js';
1
+ export { b as Attenuation, e as CredentialVerificationError, D as DFOSCredentialPayload, i as MAX_CREDENTIAL_SIZE, R as ResolvedIdentity, r as RevocationChecker, V as VerifiedDFOSCredential, w as VerifiedDelegationChain, z as apiResourceCovers, B as createDFOSCredential, E as decodeDFOSCredentialUnsafe, F as isAttenuated, G as matchesResource, H as parseApiResource, K as verifyDFOSCredential, L as verifyDelegationChain } from '../dfos-credential-DgT8XVTm.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -27,6 +27,11 @@ declare const IDENTITY_PROOF_JWS_TYP = "did:dfos:identity-proof";
27
27
  declare const EMPTY_BODY_SHA256 = "47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU";
28
28
  /** Size cap on the serialized proof token, checked BEFORE any decode. */
29
29
  declare const MAX_REQUEST_PROOF_SIZE = 4096;
30
+ /**
31
+ * Cap on the `jti` member, in UTF-8 bytes. There is no floor: uniqueness is the
32
+ * member's job, and a verifier's replay cache is what enforces it.
33
+ */
34
+ declare const MAX_JTI_BYTES = 256;
30
35
  /** RECOMMENDED acceptance window `W` — how old a proof may be, in seconds. */
31
36
  declare const DEFAULT_PROOF_WINDOW_SECONDS = 60;
32
37
  /** RECOMMENDED clock-skew allowance `S` — how forward-dated a proof may be. */
@@ -64,6 +69,11 @@ interface RequestProofPayload {
64
69
  credentialCID: string;
65
70
  /** Issued-at — unix seconds (positive integer). */
66
71
  iat: number;
72
+ /**
73
+ * The registered additive member: a per-request unique value, at most
74
+ * `MAX_JTI_BYTES` UTF-8 bytes. Emitted after `iat`, in the additive block.
75
+ */
76
+ jti?: string;
67
77
  }
68
78
  /**
69
79
  * The identity proof's payload: the request proof's five members MINUS
@@ -81,6 +91,11 @@ interface IdentityProofPayload {
81
91
  bodyHash: string;
82
92
  /** Issued-at — unix seconds (positive integer). */
83
93
  iat: number;
94
+ /**
95
+ * The registered additive member: a per-request unique value, at most
96
+ * `MAX_JTI_BYTES` UTF-8 bytes. Emitted after `iat`, in the additive block.
97
+ */
98
+ jti?: string;
84
99
  }
85
100
  /**
86
101
  * ADDITIVE MEMBERS, appended AFTER the canonical order.
@@ -108,7 +123,15 @@ interface ParsedProofPayload {
108
123
  bodyHash: string;
109
124
  credentialCID?: string;
110
125
  iat: number;
126
+ /** The registered additive member, when the proof carries one. */
127
+ jti?: string;
111
128
  }
129
+ /**
130
+ * Mint a `jti`: 128 bits from the platform CSPRNG, unpadded base64url (22
131
+ * characters). Uniqueness is per (presenter DID, freshness window), which this
132
+ * much randomness makes a collision no deployment will observe.
133
+ */
134
+ declare const generateJti: () => string;
112
135
  /**
113
136
  * Validate and normalize additive members into their canonical emission order:
114
137
  * lexicographic by name, after every canonical member. Returns `[]` for the
@@ -171,10 +194,17 @@ interface SignApiRequestInput {
171
194
  sign: (message: Uint8Array) => Promise<Uint8Array>;
172
195
  /** Issued-at override — unix seconds. Default `Math.floor(Date.now() / 1000)`. */
173
196
  iat?: number;
197
+ /**
198
+ * The registered additive member, per-request unique and at most
199
+ * `MAX_JTI_BYTES` bytes — required by a deployment that gates WRITES with this
200
+ * envelope (INTEGRATIONS.md, API security notes). `generateJti()` mints one.
201
+ * It emits the same bytes as `extraMembers: { jti }`, and naming it both ways
202
+ * throws.
203
+ */
204
+ jti?: string;
174
205
  /**
175
206
  * ADDITIVE members, appended after the canonical order in lexicographic name
176
- * order. `{ jti }` is the registered one required by a deployment that gates
177
- * WRITES with this envelope (INTEGRATIONS.md, API security notes).
207
+ * order. `{ jti }` is the registered one, and has the typed field above.
178
208
  */
179
209
  extraMembers?: ProofExtraMembers;
180
210
  }
@@ -209,10 +239,17 @@ interface SignApiIdentityRequestInput {
209
239
  sign: (message: Uint8Array) => Promise<Uint8Array>;
210
240
  /** Issued-at override — unix seconds. Default `Math.floor(Date.now() / 1000)`. */
211
241
  iat?: number;
242
+ /**
243
+ * The registered additive member, per-request unique and at most
244
+ * `MAX_JTI_BYTES` bytes. A WRITE-SHAPED surface — relay ingestion, blob
245
+ * upload — REQUIRES it (INTEGRATIONS.md, API security notes). `generateJti()`
246
+ * mints one. It emits the same bytes as `extraMembers: { jti }`, and naming it
247
+ * both ways throws.
248
+ */
249
+ jti?: string;
212
250
  /**
213
251
  * ADDITIVE members, appended after the canonical order in lexicographic name
214
- * order. `{ jti }` is the registered one, and a WRITE-SHAPED surface relay
215
- * ingestion, blob upload — REQUIRES it (INTEGRATIONS.md, API security notes).
252
+ * order. `{ jti }` is the registered one, and has the typed field above.
216
253
  */
217
254
  extraMembers?: ProofExtraMembers;
218
255
  }
@@ -261,13 +298,21 @@ declare const buildApiIdentityHeaders: (input: {
261
298
  * The verdict class. Branch on `reason`, never on message text.
262
299
  *
263
300
  * - `invalid` — checked and failed.
301
+ * - `replayed` — checked, VALID, and already spent: this `jti` was seen inside
302
+ * the proof's own freshness window. Its own verdict rather than an `invalid`
303
+ * one because the caller's answer differs — re-read state, do not re-sign the
304
+ * same request.
305
+ * - `uncovered` — the credential is VALID and simply does not reach this route's
306
+ * resource and action. Distinct from `invalid` because nothing is wrong with
307
+ * the artifact: a route offering optional authentication serves its anonymous
308
+ * projection on an `uncovered` verdict, and still refuses an `invalid` one.
264
309
  * - `unverifiable` — could not check (an unresolvable presenter, an unreachable
265
310
  * revocation source). A transient resolution failure is the server's
266
311
  * condition, not the caller's.
267
312
  * - `config` — the DEPLOYMENT is misconfigured (a `W + S` over the 300-second
268
313
  * ceiling, or an empty required action). Not a judgment about the artifact.
269
314
  */
270
- type RequestProofFailureReason = 'invalid' | 'unverifiable' | 'config';
315
+ type RequestProofFailureReason = 'invalid' | 'replayed' | 'uncovered' | 'unverifiable' | 'config';
271
316
  /**
272
317
  * The verification phase a failure arose in. Load-bearing for HTTP mapping: an
273
318
  * `invalid` proof-layer failure is a 401 (with a `WWW-Authenticate: DFOS`
@@ -279,12 +324,26 @@ type RequestProofFailurePhase = 'proof' | 'credential' | 'config';
279
324
  declare class ApiRequestVerifyError extends Error {
280
325
  readonly reason: RequestProofFailureReason;
281
326
  readonly phase: RequestProofFailurePhase;
282
- /** Recommended HTTP status: 401 proof-invalid, 403 credential-invalid, 503 unverifiable, 500 config. */
327
+ /** Recommended HTTP status: 401 proof-invalid, 403 credential-invalid or uncovered, 409 replayed, 503 unverifiable, 500 config. */
283
328
  readonly status: number;
284
329
  constructor(reason: RequestProofFailureReason, phase: RequestProofFailurePhase, status: number, message: string);
285
330
  }
286
331
  /** invalid, proof phase → 401. */
287
332
  declare const invalidProof: (message: string) => ApiRequestVerifyError;
333
+ /**
334
+ * replayed, proof phase → 409. The proof verified; its `jti` was already spent.
335
+ * The cache belongs to the deployment, so this is the constructor every consumer
336
+ * classifies a replay with rather than a status each one picks.
337
+ */
338
+ declare const replayedProof: (message: string) => ApiRequestVerifyError;
339
+ /**
340
+ * uncovered, credential phase → 403. The credential verified and simply does not
341
+ * reach this route's resource and action. Its own verdict because a route
342
+ * offering optional authentication answers it with the anonymous projection a
343
+ * caller presenting nothing would get — a credential only ever ADDS — while an
344
+ * `invalid` credential is refused outright.
345
+ */
346
+ declare const uncoveredProof: (message: string) => ApiRequestVerifyError;
288
347
  /** unverifiable, proof phase → 503. */
289
348
  declare const unverifiableProof: (message: string) => ApiRequestVerifyError;
290
349
  /** the DEPLOYMENT is misconfigured → 500. Never a judgment about the artifact. */
@@ -301,10 +360,16 @@ declare const misconfiguredProof: (message: string) => ApiRequestVerifyError;
301
360
  interface ProofPresenterState {
302
361
  /** Current-state deletion. A deleted presenter's proofs are INVALID (401). */
303
362
  isDeleted: boolean;
304
- /** Current keys, any role. */
363
+ /**
364
+ * Current keys, any role. `roles` is OPTIONAL and the resolver's to supply: a
365
+ * key may hold several, and a deployment gating writes decides for itself
366
+ * which role may sign. The verifier never reads it — it hands the matched
367
+ * key's roles back on the verified envelope.
368
+ */
305
369
  keys: readonly {
306
370
  id: string;
307
371
  publicKeyMultibase: string;
372
+ roles?: readonly ('auth' | 'assert' | 'controller')[];
308
373
  }[];
309
374
  }
310
375
  /**
@@ -345,6 +410,12 @@ interface ProofEnvelopeInput {
345
410
  skewSeconds?: number;
346
411
  /** Clock injection (unix ms). Default `Date.now()`. */
347
412
  now?: () => number;
413
+ /**
414
+ * Require the registered `jti` member. Default false. A verifier gating WRITES
415
+ * sets it on every write-shaped route and records the value in its own replay
416
+ * cache; a read-shaped route may ignore the member entirely.
417
+ */
418
+ requireJti?: boolean;
348
419
  }
349
420
  /**
350
421
  * INTEGRATIONS.md, Verification algorithm step 4's freshness configuration,
@@ -372,11 +443,10 @@ interface VerifiedProofEnvelope {
372
443
  /**
373
444
  * The DECODED payload object, unknown members included.
374
445
  *
375
- * ADDITIVE MEMBERS ARE READ FROM HERE, at the consuming layer, AFTER
376
- * verification — the signature already covers them, and the canonical member
377
- * set stays closed. `jti` is the case this exists for: the envelope verifier
378
- * ignores it per MUST-ignore-unknown, and a write-gating deployment reads it
379
- * off this object and applies its own replay discipline.
446
+ * UNREGISTERED ADDITIVE MEMBERS ARE READ FROM HERE, at the consuming layer,
447
+ * AFTER verification — the signature already covers them, and the canonical
448
+ * member set stays closed. The registered `jti` has its own field above; every
449
+ * other additive member is ignored per MUST-ignore-unknown and survives here.
380
450
  */
381
451
  rawPayload: Record<string, unknown>;
382
452
  /** THE PRINCIPAL — the `kid`'s DID. */
@@ -385,6 +455,17 @@ interface VerifiedProofEnvelope {
385
455
  kid: string;
386
456
  /** The integer unix seconds the freshness check used. */
387
457
  now: number;
458
+ /**
459
+ * The registered `jti`, when the proof carried one — the value a write-gating
460
+ * deployment records in its replay cache, keyed with `presenterDID`.
461
+ */
462
+ jti?: string;
463
+ /**
464
+ * The matched key's roles, when the resolver supplied them. A deployment
465
+ * gating writes with an identity proof applies its own rule here: a key whose
466
+ * only effective role is `controller` should not stand for a write.
467
+ */
468
+ keyRoles?: readonly ('auth' | 'assert' | 'controller')[];
388
469
  }
389
470
  /**
390
471
  * Verify an IDENTITY proof's envelope — for this artifact steps 1–7 ARE the whole
@@ -406,4 +487,4 @@ declare const verifyIdentityProofEnvelope: (input: ProofEnvelopeInput, resolvePr
406
487
  */
407
488
  declare const verifyRequestProofEnvelope: (input: ProofEnvelopeInput, resolvePresenter: ResolveProofPresenter) => Promise<VerifiedProofEnvelope>;
408
489
 
409
- export { ApiRequestVerifyError, DEFAULT_PROOF_SKEW_SECONDS, DEFAULT_PROOF_WINDOW_SECONDS, DFOS_AUTH_SCHEME, EMPTY_BODY_SHA256, IDENTITY_PROOF_JWS_TYP, type IdentityProofPayload, MAX_BODY_BYTES, MAX_PROOF_FRESHNESS_SPAN_SECONDS, MAX_REQUEST_PROOF_SIZE, type ParsedProofPayload, type ProofEnvelopeInput, type ProofExtraMembers, type ProofPresenterState, REQUEST_PROOF_JWS_TYP, type RequestProofFailurePhase, type RequestProofFailureReason, type RequestProofPayload, type ResolveProofPresenter, type SignApiIdentityRequestInput, type SignApiRequestInput, type VerifiedProofEnvelope, apiIdentitySigningInput, apiRequestSigningInput, assertProofVerifierConfig, buildApiAuthHeaders, buildApiIdentityHeaders, canonicalExtraMembers, invalidProof, misconfiguredProof, parseDfosAuthorization, sha256BodyHash, signApiIdentityRequest, signApiRequest, unverifiableProof, verifyIdentityProofEnvelope, verifyRequestProofEnvelope };
490
+ export { ApiRequestVerifyError, DEFAULT_PROOF_SKEW_SECONDS, DEFAULT_PROOF_WINDOW_SECONDS, DFOS_AUTH_SCHEME, EMPTY_BODY_SHA256, IDENTITY_PROOF_JWS_TYP, type IdentityProofPayload, MAX_BODY_BYTES, MAX_JTI_BYTES, MAX_PROOF_FRESHNESS_SPAN_SECONDS, MAX_REQUEST_PROOF_SIZE, type ParsedProofPayload, type ProofEnvelopeInput, type ProofExtraMembers, type ProofPresenterState, REQUEST_PROOF_JWS_TYP, type RequestProofFailurePhase, type RequestProofFailureReason, type RequestProofPayload, type ResolveProofPresenter, type SignApiIdentityRequestInput, type SignApiRequestInput, type VerifiedProofEnvelope, apiIdentitySigningInput, apiRequestSigningInput, assertProofVerifierConfig, buildApiAuthHeaders, buildApiIdentityHeaders, canonicalExtraMembers, generateJti, invalidProof, misconfiguredProof, parseDfosAuthorization, replayedProof, sha256BodyHash, signApiIdentityRequest, signApiRequest, uncoveredProof, unverifiableProof, verifyIdentityProofEnvelope, verifyRequestProofEnvelope };
@@ -10,33 +10,39 @@ import {
10
10
  IDENTITY_PROOF_JWS_TYP,
11
11
  MAX_BODY_BYTES,
12
12
  MAX_CREDENTIAL_SIZE,
13
+ MAX_JTI_BYTES,
13
14
  MAX_PROOF_FRESHNESS_SPAN_SECONDS,
14
15
  MAX_REQUEST_PROOF_SIZE,
15
16
  REQUEST_PROOF_JWS_TYP,
16
17
  apiIdentitySigningInput,
17
18
  apiRequestSigningInput,
19
+ apiResourceCovers,
18
20
  assertProofVerifierConfig,
19
21
  buildApiAuthHeaders,
20
22
  buildApiIdentityHeaders,
21
23
  canonicalExtraMembers,
22
24
  createDFOSCredential,
23
25
  decodeDFOSCredentialUnsafe,
26
+ generateJti,
24
27
  invalidProof,
25
28
  isAttenuated,
26
29
  matchesResource,
27
30
  misconfiguredProof,
31
+ parseApiResource,
28
32
  parseDfosAuthorization,
33
+ replayedProof,
29
34
  sha256BodyHash,
30
35
  signApiIdentityRequest,
31
36
  signApiRequest,
37
+ uncoveredProof,
32
38
  unverifiableProof,
33
39
  verifyDFOSCredential,
34
40
  verifyDelegationChain,
35
41
  verifyIdentityProofEnvelope,
36
42
  verifyRequestProofEnvelope
37
- } from "../chunk-FZHHSC5N.js";
43
+ } from "../chunk-RPA44ND4.js";
38
44
  import "../chunk-F7RHI2CK.js";
39
- import "../chunk-KAW4MT4P.js";
45
+ import "../chunk-NUIIVAZ3.js";
40
46
  export {
41
47
  ApiRequestVerifyError,
42
48
  Attenuation,
@@ -49,25 +55,31 @@ export {
49
55
  IDENTITY_PROOF_JWS_TYP,
50
56
  MAX_BODY_BYTES,
51
57
  MAX_CREDENTIAL_SIZE,
58
+ MAX_JTI_BYTES,
52
59
  MAX_PROOF_FRESHNESS_SPAN_SECONDS,
53
60
  MAX_REQUEST_PROOF_SIZE,
54
61
  REQUEST_PROOF_JWS_TYP,
55
62
  apiIdentitySigningInput,
56
63
  apiRequestSigningInput,
64
+ apiResourceCovers,
57
65
  assertProofVerifierConfig,
58
66
  buildApiAuthHeaders,
59
67
  buildApiIdentityHeaders,
60
68
  canonicalExtraMembers,
61
69
  createDFOSCredential,
62
70
  decodeDFOSCredentialUnsafe,
71
+ generateJti,
63
72
  invalidProof,
64
73
  isAttenuated,
65
74
  matchesResource,
66
75
  misconfiguredProof,
76
+ parseApiResource,
67
77
  parseDfosAuthorization,
78
+ replayedProof,
68
79
  sha256BodyHash,
69
80
  signApiIdentityRequest,
70
81
  signApiRequest,
82
+ uncoveredProof,
71
83
  unverifiableProof,
72
84
  verifyDFOSCredential,
73
85
  verifyDelegationChain,
@@ -23,7 +23,7 @@ import {
23
23
  signPayloadEd25519,
24
24
  verifyJws,
25
25
  verifyJwt
26
- } from "../chunk-KAW4MT4P.js";
26
+ } from "../chunk-NUIIVAZ3.js";
27
27
  export {
28
28
  JwsVerificationError,
29
29
  JwtVerificationError,
@@ -648,6 +648,26 @@ declare const verifyDelegationChain: (credential: VerifiedDFOSCredential, option
648
648
  */
649
649
  nowUnix?: number;
650
650
  }) => Promise<VerifiedDelegationChain>;
651
+ /**
652
+ * Parse an `api:` resource into its host and, when present, its space id.
653
+ * Returns `null` for any other resource type and for a malformed `api:` id —
654
+ * `null` IS the malformed verdict, and a malformed resource covers nothing.
655
+ *
656
+ * Two forms are well-formed and no others: `api:<host>` with a non-empty host
657
+ * carrying no `/`, and `api:<host>/spaces/<id>`. The id half splits on the FIRST
658
+ * `/`, so a host keeps its port and anything past `spaces/<id>` is malformed.
659
+ */
660
+ declare const parseApiResource: (resource: string) => {
661
+ host: string;
662
+ spaceId?: string;
663
+ } | null;
664
+ /**
665
+ * Whether one `api:` resource covers another: same host, and either the entry is
666
+ * the bare host (the registered ancestor of every space on it) or the two name
667
+ * the same space. False when either side is malformed or is not `api:` —
668
+ * coverage never crosses hosts and never crosses resource types.
669
+ */
670
+ declare const apiResourceCovers: (entryResource: string, requiredResource: string) => boolean;
651
671
  /**
652
672
  * Check if `childAtt` is a valid attenuation of `parentAtt`
653
673
  *
@@ -658,11 +678,14 @@ declare const verifyDelegationChain: (credential: VerifiedDFOSCredential, option
658
678
  * - `chain:X` covered by `chain:*` (narrowing from wildcard — valid)
659
679
  * - `chain:*` covered by `chain:*` (exact match)
660
680
  * - `chain:*` NOT covered by `chain:X` (widening — invalid)
661
- * - Non-`chain` types (`mailbox:<id>`, and any form a future capability
662
- * registers): exact byte equality of the full resource string, nothing else.
663
- * The wildcard is a `chain:`-only concept — a literal `*` id in any other
664
- * type is an ordinary id covering only itself and coverage never crosses
665
- * resource types. See CREDENTIALS.md "Resource Types".
681
+ * - `api:<host>/spaces/<id>` covered by `api:<host>` (narrowing onto one space)
682
+ * or by the same child. A MALFORMED `api:` id narrows only from a
683
+ * byte-identical parent, under the rule below — a bare host does not carry it.
684
+ * - Other types (`mailbox:<id>`, and any form a future capability registers):
685
+ * exact byte equality of the full resource string, nothing else. The wildcard
686
+ * is a `chain:`-only concept — a literal `*` id in any other type is an
687
+ * ordinary id covering only itself — and coverage never crosses resource
688
+ * types. See CREDENTIALS.md "Resource Types".
666
689
  * - Actions: child action set must be a subset of parent action set
667
690
  */
668
691
  declare const isAttenuated: (parentAtt: Attenuation[], childAtt: Attenuation[]) => boolean;
@@ -670,7 +693,14 @@ declare const isAttenuated: (parentAtt: Attenuation[], childAtt: Attenuation[])
670
693
  * Check if an `att` array covers a requested resource
671
694
  *
672
695
  * Used at the relay to determine if a credential authorizes access to a
673
- * specific content chain.
696
+ * specific content chain, and by an API verifier to decide whether a grant
697
+ * reaches the route's resource.
698
+ *
699
+ * `chain:*` covers any `chain:` request; an `api:` entry covers an `api:`
700
+ * request under the host/space hierarchy; every other form is exact byte
701
+ * equality. A malformed `api:` resource covers nothing and is covered by
702
+ * nothing, itself included — a resource a verifier cannot parse must not
703
+ * authorize a request. Every entry is scanned, so any one of them may cover.
674
704
  */
675
705
  declare const matchesResource: (att: Attenuation[], resource: string, action: string) => Promise<boolean>;
676
706
  /**
@@ -691,4 +721,4 @@ declare class CredentialVerificationError extends Error {
691
721
  constructor(message: string);
692
722
  }
693
723
 
694
- export { ARTIFACT_CID_ANCHOR_RE as A, decodeDFOSCredentialUnsafe as B, CONTENT_ID_ANCHOR_RE as C, DFOSCredentialPayload as D, isAttenuated as E, matchesResource as F, parseProtocolTimestampUnix as G, verifyDFOSCredential as H, IdentityOperation as I, verifyDelegationChain as J, MAX_ARTIFACT_PAYLOAD_SIZE as M, type ResolvedIdentity as R, ServiceEntry as S, type VerifiedDFOSCredential as V, ArtifactPayload as a, Attenuation as b, ContentOperation as c, CountersignPayload as d, CredentialVerificationError as e, CreditClaimPayload as f, DeclaredKeyState as g, Iso8601 as h, MAX_CREDENTIAL_SIZE as i, MAX_CREDIT_CLAIM_SIZE as j, MAX_KEY_PROOFS as k, MAX_OPERATION_SIZE as l, MAX_SERVICES_ENTRIES as m, MAX_SERVICES_PAYLOAD_SIZE as n, MAX_SIGN_REQUEST_PAYLOAD_SIZE as o, MAX_SIGN_REQUEST_SIZE as p, MultikeyPublicKey as q, type RevocationChecker as r, RevocationPayload as s, ServicesArray as t, SignRequestPayload as u, type Signer as v, type VerifiedDelegationChain as w, VerifiedIdentity as x, VoidKeyMembership as y, createDFOSCredential as z };
724
+ export { ARTIFACT_CID_ANCHOR_RE as A, createDFOSCredential as B, CONTENT_ID_ANCHOR_RE as C, DFOSCredentialPayload as D, decodeDFOSCredentialUnsafe as E, isAttenuated as F, matchesResource as G, parseApiResource as H, IdentityOperation as I, parseProtocolTimestampUnix as J, verifyDFOSCredential as K, verifyDelegationChain as L, MAX_ARTIFACT_PAYLOAD_SIZE as M, type ResolvedIdentity as R, ServiceEntry as S, type VerifiedDFOSCredential as V, ArtifactPayload as a, Attenuation as b, ContentOperation as c, CountersignPayload as d, CredentialVerificationError as e, CreditClaimPayload as f, DeclaredKeyState as g, Iso8601 as h, MAX_CREDENTIAL_SIZE as i, MAX_CREDIT_CLAIM_SIZE as j, MAX_KEY_PROOFS as k, MAX_OPERATION_SIZE as l, MAX_SERVICES_ENTRIES as m, MAX_SERVICES_PAYLOAD_SIZE as n, MAX_SIGN_REQUEST_PAYLOAD_SIZE as o, MAX_SIGN_REQUEST_SIZE as p, MultikeyPublicKey as q, type RevocationChecker as r, RevocationPayload as s, ServicesArray as t, SignRequestPayload as u, type Signer as v, type VerifiedDelegationChain as w, VerifiedIdentity as x, VoidKeyMembership as y, apiResourceCovers as z };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { JwsHeader, JwsVerificationError, JwtClaims, JwtCreateOptions, JwtHeader, JwtVerificationError, JwtVerifyOptions, PrefixedID, assertCanonicalJsonText, assertJwsProfile, base64urlDecode, base64urlEncode, createJws, createJwt, createNewEd25519Keypair, dagCborCanonicalEncode, decodeJwsUnsafe, decodeJwtUnsafe, generateId, generateIdNoPrefix, importEd25519Keypair, isCanonicallyEqual, isValidEd25519Signature, isValidId, normalizedId, parseDagCborCID, sha256, signPayloadEd25519, verifyJws, verifyJwt } from './crypto/index.js';
2
- export { A as ARTIFACT_CID_ANCHOR_RE, a as ArtifactPayload, b as Attenuation, C as CONTENT_ID_ANCHOR_RE, c as ContentOperation, d as CountersignPayload, e as CredentialVerificationError, f as CreditClaimPayload, D as DFOSCredentialPayload, g as DeclaredKeyState, I as IdentityOperation, h as Iso8601, M as MAX_ARTIFACT_PAYLOAD_SIZE, i as MAX_CREDENTIAL_SIZE, j as MAX_CREDIT_CLAIM_SIZE, k as MAX_KEY_PROOFS, l as MAX_OPERATION_SIZE, m as MAX_SERVICES_ENTRIES, n as MAX_SERVICES_PAYLOAD_SIZE, o as MAX_SIGN_REQUEST_PAYLOAD_SIZE, p as MAX_SIGN_REQUEST_SIZE, q as MultikeyPublicKey, R as ResolvedIdentity, r as RevocationChecker, s as RevocationPayload, S as ServiceEntry, t as ServicesArray, u as SignRequestPayload, v as Signer, V as VerifiedDFOSCredential, w as VerifiedDelegationChain, x as VerifiedIdentity, y as VoidKeyMembership, z as createDFOSCredential, B as decodeDFOSCredentialUnsafe, E as isAttenuated, F as matchesResource, G as parseProtocolTimestampUnix, H as verifyDFOSCredential, J as verifyDelegationChain } from './dfos-credential-j-kHtFvG.js';
3
- export { AnchorKind, CreditClaimFailureReason, CreditClaimVerifyError, CreditEntry, CreditEntryState, ED25519_PRIV_MULTICODEC, ED25519_PUB_MULTICODEC, RECOGNIZED_SERVICE_TYPES, SignRequestFailureReason, SignRequestVerifyError, VerifiedArtifact, VerifiedContentChain, VerifiedCountersignature, VerifiedCreditClaim, VerifiedCreditEntry, VerifiedRevocation, VerifiedSignRequest, anchorsByLabel, assertCanonicalSignRequestPayload, assertServicesWithinCap, buildSignRequest, classifyAnchor, decodeEd25519PublicMultikey, decodeMultikey, deriveChainIdentifier, deriveContentId, encodeEd25519Multikey, isRecognizedServiceType, relayEndpoints, signArtifact, signContentOperation, signCountersignature, signCreditClaim, signIdentityOperation, signRevocation, verifyArtifact, verifyContentChain, verifyContentExtensionFromTrustedState, verifyCountersignature, verifyCreditClaim, verifyCreditEntry, verifyIdentityChain, verifyIdentityExtensionFromTrustedState, verifyRevocation, verifySignRequest } from './chain/index.js';
4
- export { ApiRequestVerifyError, DEFAULT_PROOF_SKEW_SECONDS, DEFAULT_PROOF_WINDOW_SECONDS, DFOS_AUTH_SCHEME, EMPTY_BODY_SHA256, IDENTITY_PROOF_JWS_TYP, IdentityProofPayload, MAX_BODY_BYTES, MAX_PROOF_FRESHNESS_SPAN_SECONDS, MAX_REQUEST_PROOF_SIZE, ParsedProofPayload, ProofEnvelopeInput, ProofExtraMembers, ProofPresenterState, REQUEST_PROOF_JWS_TYP, RequestProofFailurePhase, RequestProofFailureReason, RequestProofPayload, ResolveProofPresenter, SignApiIdentityRequestInput, SignApiRequestInput, VerifiedProofEnvelope, apiIdentitySigningInput, apiRequestSigningInput, assertProofVerifierConfig, buildApiAuthHeaders, buildApiIdentityHeaders, canonicalExtraMembers, invalidProof, misconfiguredProof, parseDfosAuthorization, sha256BodyHash, signApiIdentityRequest, signApiRequest, unverifiableProof, verifyIdentityProofEnvelope, verifyRequestProofEnvelope } from './credentials/index.js';
2
+ export { A as ARTIFACT_CID_ANCHOR_RE, a as ArtifactPayload, b as Attenuation, C as CONTENT_ID_ANCHOR_RE, c as ContentOperation, d as CountersignPayload, e as CredentialVerificationError, f as CreditClaimPayload, D as DFOSCredentialPayload, g as DeclaredKeyState, I as IdentityOperation, h as Iso8601, M as MAX_ARTIFACT_PAYLOAD_SIZE, i as MAX_CREDENTIAL_SIZE, j as MAX_CREDIT_CLAIM_SIZE, k as MAX_KEY_PROOFS, l as MAX_OPERATION_SIZE, m as MAX_SERVICES_ENTRIES, n as MAX_SERVICES_PAYLOAD_SIZE, o as MAX_SIGN_REQUEST_PAYLOAD_SIZE, p as MAX_SIGN_REQUEST_SIZE, q as MultikeyPublicKey, R as ResolvedIdentity, r as RevocationChecker, s as RevocationPayload, S as ServiceEntry, t as ServicesArray, u as SignRequestPayload, v as Signer, V as VerifiedDFOSCredential, w as VerifiedDelegationChain, x as VerifiedIdentity, y as VoidKeyMembership, z as apiResourceCovers, B as createDFOSCredential, E as decodeDFOSCredentialUnsafe, F as isAttenuated, G as matchesResource, H as parseApiResource, J as parseProtocolTimestampUnix, K as verifyDFOSCredential, L as verifyDelegationChain } from './dfos-credential-DgT8XVTm.js';
3
+ export { AnchorKind, CreditClaimFailureReason, CreditClaimVerifyError, CreditEntry, CreditEntryState, ED25519_PRIV_MULTICODEC, ED25519_PUB_MULTICODEC, IdentityStateNoSeenKeysError, RECOGNIZED_SERVICE_TYPES, SignRequestFailureReason, SignRequestVerifyError, VerifiedArtifact, VerifiedContentChain, VerifiedCountersignature, VerifiedCreditClaim, VerifiedCreditEntry, VerifiedRevocation, VerifiedSignRequest, anchorsByLabel, assertCanonicalSignRequestPayload, assertServicesWithinCap, buildSignRequest, classifyAnchor, decodeEd25519PublicMultikey, decodeMultikey, deriveChainIdentifier, deriveContentId, encodeEd25519Multikey, isRecognizedServiceType, relayEndpoints, signArtifact, signContentOperation, signCountersignature, signCreditClaim, signIdentityOperation, signRevocation, verifyArtifact, verifyContentChain, verifyContentExtensionFromTrustedState, verifyCountersignature, verifyCreditClaim, verifyCreditEntry, verifyIdentityChain, verifyIdentityExtensionFromTrustedState, verifyRevocation, verifySignRequest } from './chain/index.js';
4
+ export { ApiRequestVerifyError, DEFAULT_PROOF_SKEW_SECONDS, DEFAULT_PROOF_WINDOW_SECONDS, DFOS_AUTH_SCHEME, EMPTY_BODY_SHA256, IDENTITY_PROOF_JWS_TYP, IdentityProofPayload, MAX_BODY_BYTES, MAX_JTI_BYTES, MAX_PROOF_FRESHNESS_SPAN_SECONDS, MAX_REQUEST_PROOF_SIZE, ParsedProofPayload, ProofEnvelopeInput, ProofExtraMembers, ProofPresenterState, REQUEST_PROOF_JWS_TYP, RequestProofFailurePhase, RequestProofFailureReason, RequestProofPayload, ResolveProofPresenter, SignApiIdentityRequestInput, SignApiRequestInput, VerifiedProofEnvelope, apiIdentitySigningInput, apiRequestSigningInput, assertProofVerifierConfig, buildApiAuthHeaders, buildApiIdentityHeaders, canonicalExtraMembers, generateJti, invalidProof, misconfiguredProof, parseDfosAuthorization, replayedProof, sha256BodyHash, signApiIdentityRequest, signApiRequest, uncoveredProof, unverifiableProof, verifyIdentityProofEnvelope, verifyRequestProofEnvelope } from './credentials/index.js';
5
5
  export { DEFAULT_KEY_PROOF_SKEW_SECONDS, KEY_ADD_JWS_TYP, KEY_ROLES, KeyProofFailureReason, KeyProofPayload, KeyProofVerifyError, KeyRole, MAX_KEY_PROOF_SIZE, SignKeyProofInput, VerifiedKeyProof, VerifyChainKeyProofOptions, VerifyKeyProofOptions, isCanonicalRoleSet, keyProofSigningInput, keyWordFingerprint, parseRoleSet, roleSetCovers, serializeRoleSet, signKeyProof, unsafeKeyProofSubject, verifyChainKeyProof, verifyKeyProof } from './key-proof/index.js';
6
6
  export { FoldOperation, INDEX_V1_SCHEMA, IndexDelta, IndexDocument, IndexEntry, LwwDelta, OrderKey, byteCompare, compareHeadPreference, compareLinear, foldIndexV1, foldLwwMap, linearize } from './fold/index.js';
7
7
  import 'multiformats';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  CreditClaimVerifyError,
9
9
  DeclaredKeyState,
10
10
  IdentityOperation,
11
+ IdentityStateNoSeenKeysError,
11
12
  Iso8601,
12
13
  MAX_ARTIFACT_PAYLOAD_SIZE,
13
14
  MAX_CREDIT_CLAIM_SIZE,
@@ -52,7 +53,7 @@ import {
52
53
  verifyIdentityExtensionFromTrustedState,
53
54
  verifyRevocation,
54
55
  verifySignRequest
55
- } from "./chunk-Q7FREWMY.js";
56
+ } from "./chunk-QIM3KZXZ.js";
56
57
  import {
57
58
  ApiRequestVerifyError,
58
59
  Attenuation,
@@ -65,11 +66,13 @@ import {
65
66
  IDENTITY_PROOF_JWS_TYP,
66
67
  MAX_BODY_BYTES,
67
68
  MAX_CREDENTIAL_SIZE,
69
+ MAX_JTI_BYTES,
68
70
  MAX_PROOF_FRESHNESS_SPAN_SECONDS,
69
71
  MAX_REQUEST_PROOF_SIZE,
70
72
  REQUEST_PROOF_JWS_TYP,
71
73
  apiIdentitySigningInput,
72
74
  apiRequestSigningInput,
75
+ apiResourceCovers,
73
76
  assertProofVerifierConfig,
74
77
  buildApiAuthHeaders,
75
78
  buildApiIdentityHeaders,
@@ -77,22 +80,26 @@ import {
77
80
  carryDependencyMissing,
78
81
  createDFOSCredential,
79
82
  decodeDFOSCredentialUnsafe,
83
+ generateJti,
80
84
  invalidProof,
81
85
  isAttenuated,
82
86
  isDependencyMissing,
83
87
  markDependencyMissing,
84
88
  matchesResource,
85
89
  misconfiguredProof,
90
+ parseApiResource,
86
91
  parseDfosAuthorization,
92
+ replayedProof,
87
93
  sha256BodyHash,
88
94
  signApiIdentityRequest,
89
95
  signApiRequest,
96
+ uncoveredProof,
90
97
  unverifiableProof,
91
98
  verifyDFOSCredential,
92
99
  verifyDelegationChain,
93
100
  verifyIdentityProofEnvelope,
94
101
  verifyRequestProofEnvelope
95
- } from "./chunk-FZHHSC5N.js";
102
+ } from "./chunk-RPA44ND4.js";
96
103
  import {
97
104
  DEFAULT_KEY_PROOF_SKEW_SECONDS,
98
105
  KEY_ADD_JWS_TYP,
@@ -109,7 +116,7 @@ import {
109
116
  unsafeKeyProofSubject,
110
117
  verifyChainKeyProof,
111
118
  verifyKeyProof
112
- } from "./chunk-BMIOY5W5.js";
119
+ } from "./chunk-ISHAX5WN.js";
113
120
  import {
114
121
  ED25519_PRIV_MULTICODEC,
115
122
  ED25519_PUB_MULTICODEC,
@@ -142,7 +149,7 @@ import {
142
149
  signPayloadEd25519,
143
150
  verifyJws,
144
151
  verifyJwt
145
- } from "./chunk-KAW4MT4P.js";
152
+ } from "./chunk-NUIIVAZ3.js";
146
153
  import {
147
154
  INDEX_V1_SCHEMA,
148
155
  byteCompare,
@@ -175,6 +182,7 @@ export {
175
182
  IDENTITY_PROOF_JWS_TYP,
176
183
  INDEX_V1_SCHEMA,
177
184
  IdentityOperation,
185
+ IdentityStateNoSeenKeysError,
178
186
  Iso8601,
179
187
  JwsVerificationError,
180
188
  JwtVerificationError,
@@ -185,6 +193,7 @@ export {
185
193
  MAX_BODY_BYTES,
186
194
  MAX_CREDENTIAL_SIZE,
187
195
  MAX_CREDIT_CLAIM_SIZE,
196
+ MAX_JTI_BYTES,
188
197
  MAX_KEY_PROOFS,
189
198
  MAX_KEY_PROOF_SIZE,
190
199
  MAX_OPERATION_SIZE,
@@ -207,6 +216,7 @@ export {
207
216
  anchorsByLabel,
208
217
  apiIdentitySigningInput,
209
218
  apiRequestSigningInput,
219
+ apiResourceCovers,
210
220
  assertCanonicalJsonText,
211
221
  assertCanonicalSignRequestPayload,
212
222
  assertJwsProfile,
@@ -240,6 +250,7 @@ export {
240
250
  foldLwwMap,
241
251
  generateId,
242
252
  generateIdNoPrefix,
253
+ generateJti,
243
254
  importEd25519Keypair,
244
255
  invalidProof,
245
256
  isAttenuated,
@@ -256,11 +267,13 @@ export {
256
267
  matchesResource,
257
268
  misconfiguredProof,
258
269
  normalizedId,
270
+ parseApiResource,
259
271
  parseDagCborCID,
260
272
  parseDfosAuthorization,
261
273
  parseProtocolTimestampUnix,
262
274
  parseRoleSet,
263
275
  relayEndpoints,
276
+ replayedProof,
264
277
  roleSetCovers,
265
278
  serializeRoleSet,
266
279
  sha256,
@@ -275,6 +288,7 @@ export {
275
288
  signKeyProof,
276
289
  signPayloadEd25519,
277
290
  signRevocation,
291
+ uncoveredProof,
278
292
  unsafeKeyProofSubject,
279
293
  unverifiableProof,
280
294
  verifyArtifact,
@@ -14,9 +14,9 @@ import {
14
14
  unsafeKeyProofSubject,
15
15
  verifyChainKeyProof,
16
16
  verifyKeyProof
17
- } from "../chunk-BMIOY5W5.js";
17
+ } from "../chunk-ISHAX5WN.js";
18
18
  import "../chunk-F7RHI2CK.js";
19
- import "../chunk-KAW4MT4P.js";
19
+ import "../chunk-NUIIVAZ3.js";
20
20
  export {
21
21
  DEFAULT_KEY_PROOF_SKEW_SECONDS,
22
22
  KEY_ADD_JWS_TYP,