@tearleads/client-sdk 0.1.249 → 0.1.251

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.
Files changed (119) hide show
  1. package/data/documents/shared/events.js +2 -1
  2. package/data/documents/shared/events.js.map +1 -1
  3. package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js +1 -4
  4. package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -1
  5. package/data/persistence/principalPolicy/heldOrganizationDirectories.js +6 -1
  6. package/data/persistence/principalPolicy/heldOrganizationDirectories.js.map +1 -1
  7. package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js +1 -1
  8. package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js.map +1 -1
  9. package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js +1 -5
  10. package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js.map +1 -1
  11. package/data/principals/organizationGroupDirectoryRequest.js +0 -2
  12. package/data/principals/organizationGroupDirectoryRequest.js.map +1 -1
  13. package/data/principals/organizationPolicyRequest.js +0 -2
  14. package/data/principals/organizationPolicyRequest.js.map +1 -1
  15. package/data/principals/principalPolicyRequest.js +0 -2
  16. package/data/principals/principalPolicyRequest.js.map +1 -1
  17. package/internal/api-client/ApiClient.d.ts +0 -58
  18. package/internal/api-client/client/apiClientContext.d.ts +0 -30
  19. package/internal/api-client/client/documents.d.ts +0 -12
  20. package/internal/api-client/client/principalPolicies.d.ts +0 -18
  21. package/internal/api-client/client/writerProjections.d.ts +0 -12
  22. package/internal/api-client/heldDirectoryCitations.d.ts +8 -4
  23. package/internal/api-client/heldDirectoryCitations.js +6 -10
  24. package/internal/api-client/heldDirectoryCitations.js.map +1 -1
  25. package/internal/api-client/organizationPolicyHistory.d.ts +0 -6
  26. package/internal/api-client/principalPolicyRequests.d.ts +0 -18
  27. package/internal/api-client/verifiedManifestCitations.js +3 -3
  28. package/internal/api-client/verifiedManifestCitations.js.map +1 -1
  29. package/internal/crypto/index.d.ts +1 -1
  30. package/internal/crypto/index.js.map +1 -1
  31. package/internal/crypto/keying/principalPolicyPayload.js +2 -12
  32. package/internal/crypto/keying/principalPolicyPayload.js.map +1 -1
  33. package/internal/crypto/keying/principalPolicyTypes.d.ts +5 -6
  34. package/internal/crypto/keying/principalPolicyTypes.js.map +1 -1
  35. package/internal/crypto/principalState.d.ts +1 -1
  36. package/internal/crypto/principalState.js.map +1 -1
  37. package/internal/crypto/principalStateTypes.d.ts +0 -1
  38. package/internal/crypto/principalStateTypes.js.map +1 -1
  39. package/internal/validators/documentCreateSeedRefinements.js +2 -2
  40. package/internal/validators/documentCreateSeedRefinements.js.map +1 -1
  41. package/internal/validators/operation/auth.d.ts +50 -1727
  42. package/internal/validators/operation/auth.js +2 -2
  43. package/internal/validators/operation/auth.js.map +1 -1
  44. package/internal/validators/operation/containerMutations.d.ts +1 -294
  45. package/internal/validators/operation/containerMutations.js +2 -2
  46. package/internal/validators/operation/containerMutations.js.map +1 -1
  47. package/internal/validators/operation/documentMutations.d.ts +1 -342
  48. package/internal/validators/operation/documentMutations.js +2 -2
  49. package/internal/validators/operation/documentMutations.js.map +1 -1
  50. package/internal/validators/operation/organizationPolicyHistory.d.ts +0 -24
  51. package/internal/validators/operation/organizations.d.ts +50 -1751
  52. package/internal/validators/operation/organizations.js +2 -2
  53. package/internal/validators/operation/organizations.js.map +1 -1
  54. package/internal/validators/operation/principals.d.ts +0 -56
  55. package/internal/validators/operation/writerProjections.d.ts +0 -48
  56. package/internal/validators/organizationProvisioningRefinements.js +2 -2
  57. package/internal/validators/organizationProvisioningRefinements.js.map +1 -1
  58. package/internal/validators/request/containerMetadata.d.ts +0 -276
  59. package/internal/validators/request/containerMetadata.js +5 -4
  60. package/internal/validators/request/containerMetadata.js.map +1 -1
  61. package/internal/validators/request/document.d.ts +0 -277
  62. package/internal/validators/request/document.js +8 -4
  63. package/internal/validators/request/document.js.map +1 -1
  64. package/internal/validators/request/documentCreateSeed.d.ts +99 -0
  65. package/internal/validators/request/documentCreateSeed.js +132 -9
  66. package/internal/validators/request/documentCreateSeed.js.map +1 -1
  67. package/internal/validators/request/documentSyncSchema.d.ts +41 -0
  68. package/internal/validators/request/documentSyncSchema.js +1 -1
  69. package/internal/validators/request/documentSyncSchema.js.map +1 -1
  70. package/internal/validators/request/index.d.ts +1 -0
  71. package/internal/validators/request/index.js +1 -0
  72. package/internal/validators/request/index.js.map +1 -1
  73. package/internal/validators/request/organization.d.ts +0 -32
  74. package/internal/validators/request/organizationProvisioning.d.ts +263 -5639
  75. package/internal/validators/request/organizationProvisioning.js +10 -4
  76. package/internal/validators/request/organizationProvisioning.js.map +1 -1
  77. package/internal/validators/request/principal.d.ts +4 -48
  78. package/internal/validators/request/principal.js +4 -2
  79. package/internal/validators/request/principal.js.map +1 -1
  80. package/internal/validators/request/registration.d.ts +71 -1727
  81. package/internal/validators/response/container.d.ts +0 -48
  82. package/internal/validators/response/documentMutation.d.ts +0 -96
  83. package/internal/validators/response/organizationPolicyHistory.d.ts +0 -24
  84. package/internal/validators/response/policyEvidenceWire.d.ts +5 -3
  85. package/internal/validators/response/policyEvidenceWire.js +6 -4
  86. package/internal/validators/response/policyEvidenceWire.js.map +1 -1
  87. package/internal/validators/response/principal.d.ts +0 -48
  88. package/internal/validators/response/principalPolicyPage.d.ts +0 -48
  89. package/internal/validators/response/principalSnapshot.d.ts +4 -24
  90. package/internal/validators/response/principalSnapshot.js +4 -6
  91. package/internal/validators/response/principalSnapshot.js.map +1 -1
  92. package/internal/validators/response/projectionPolicyEvidence.d.ts +0 -48
  93. package/package.json +1 -1
  94. package/workflows/container-contents/container-state/create/createWithMetadata.js +6 -3
  95. package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
  96. package/workflows/documents/create/index.js +4 -4
  97. package/workflows/documents/create/index.js.map +1 -1
  98. package/workflows/documents/sync/initialSync.d.ts +26 -11
  99. package/workflows/documents/sync/initialSync.js +32 -12
  100. package/workflows/documents/sync/initialSync.js.map +1 -1
  101. package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js +1 -6
  102. package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js.map +1 -1
  103. package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js +1 -6
  104. package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js.map +1 -1
  105. package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js +4 -6
  106. package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js.map +1 -1
  107. package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js +1 -7
  108. package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js.map +1 -1
  109. package/workflows/principals/policyCache/principalPolicyCacheValidation.js +0 -13
  110. package/workflows/principals/policyCache/principalPolicyCacheValidation.js.map +1 -1
  111. package/workflows/principals/publicHistory/publicProjectionDirectory.js +4 -5
  112. package/workflows/principals/publicHistory/publicProjectionDirectory.js.map +1 -1
  113. package/workflows/registration/provisionedProfileDocument.js +2 -2
  114. package/workflows/registration/provisionedProfileDocument.js.map +1 -1
  115. package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -74
  116. package/workflows/registration/provisioningBootstrapBuilders.js +3 -3
  117. package/workflows/registration/provisioningBootstrapBuilders.js.map +1 -1
  118. package/workflows/registration/registrationPrincipalPolicyPersistence.js +1 -7
  119. package/workflows/registration/registrationPrincipalPolicyPersistence.js.map +1 -1
@@ -135,13 +135,7 @@ export declare class ApiClientContext {
135
135
  version: number;
136
136
  };
137
137
  payload: {
138
- cipherSuite: "aes-256-gcm";
139
138
  ciphertext: string;
140
- ciphertextHash: string;
141
- createdAt: string;
142
- principalId: string;
143
- principalType: "group" | "organization";
144
- stateHash: string;
145
139
  };
146
140
  }[];
147
141
  groups: {
@@ -222,13 +216,7 @@ export declare class ApiClientContext {
222
216
  version: number;
223
217
  };
224
218
  payload: {
225
- cipherSuite: "aes-256-gcm";
226
219
  ciphertext: string;
227
- ciphertextHash: string;
228
- createdAt: string;
229
- principalId: string;
230
- principalType: "group" | "organization";
231
- stateHash: string;
232
220
  };
233
221
  }[];
234
222
  groups: {
@@ -375,13 +363,7 @@ export declare class ApiClientContext {
375
363
  version: number;
376
364
  };
377
365
  payload: {
378
- cipherSuite: "aes-256-gcm";
379
366
  ciphertext: string;
380
- ciphertextHash: string;
381
- createdAt: string;
382
- principalId: string;
383
- principalType: "group" | "organization";
384
- stateHash: string;
385
367
  };
386
368
  }[];
387
369
  groups: {
@@ -462,13 +444,7 @@ export declare class ApiClientContext {
462
444
  version: number;
463
445
  };
464
446
  payload: {
465
- cipherSuite: "aes-256-gcm";
466
447
  ciphertext: string;
467
- ciphertextHash: string;
468
- createdAt: string;
469
- principalId: string;
470
- principalType: "group" | "organization";
471
- stateHash: string;
472
448
  };
473
449
  }[];
474
450
  groups: {
@@ -710,13 +686,7 @@ export declare class ApiClientContext {
710
686
  stateHash: string;
711
687
  };
712
688
  currentPayload: {
713
- cipherSuite: "aes-256-gcm";
714
689
  ciphertext: string;
715
- ciphertextHash: string;
716
- createdAt: string;
717
- principalId: string;
718
- principalType: "group" | "organization";
719
- stateHash: string;
720
690
  };
721
691
  currentProjection: {
722
692
  identityBundleFingerprint: string;
@@ -174,13 +174,7 @@ export declare class DocumentArea {
174
174
  version: number;
175
175
  };
176
176
  payload: {
177
- cipherSuite: "aes-256-gcm";
178
177
  ciphertext: string;
179
- ciphertextHash: string;
180
- createdAt: string;
181
- principalId: string;
182
- principalType: "group" | "organization";
183
- stateHash: string;
184
178
  };
185
179
  }[];
186
180
  groups: {
@@ -276,13 +270,7 @@ export declare class DocumentArea {
276
270
  version: number;
277
271
  };
278
272
  payload: {
279
- cipherSuite: "aes-256-gcm";
280
273
  ciphertext: string;
281
- ciphertextHash: string;
282
- createdAt: string;
283
- principalId: string;
284
- principalType: "group" | "organization";
285
- stateHash: string;
286
274
  };
287
275
  }[];
288
276
  groups: {
@@ -76,13 +76,7 @@ export declare class PrincipalPolicyArea {
76
76
  stateHash: string;
77
77
  };
78
78
  currentPayload: {
79
- cipherSuite: "aes-256-gcm";
80
79
  ciphertext: string;
81
- ciphertextHash: string;
82
- createdAt: string;
83
- principalId: string;
84
- principalType: "group" | "organization";
85
- stateHash: string;
86
80
  };
87
81
  currentProjection: {
88
82
  identityBundleFingerprint: string;
@@ -186,13 +180,7 @@ export declare class PrincipalPolicyArea {
186
180
  stateHash: string;
187
181
  };
188
182
  currentPayload: {
189
- cipherSuite: "aes-256-gcm";
190
183
  ciphertext: string;
191
- ciphertextHash: string;
192
- createdAt: string;
193
- principalId: string;
194
- principalType: "group" | "organization";
195
- stateHash: string;
196
184
  };
197
185
  currentProjection: {
198
186
  identityBundleFingerprint: string;
@@ -304,13 +292,7 @@ export declare class PrincipalPolicyArea {
304
292
  stateHash: string;
305
293
  };
306
294
  currentPayload: {
307
- cipherSuite: "aes-256-gcm";
308
295
  ciphertext: string;
309
- ciphertextHash: string;
310
- createdAt: string;
311
- principalId: string;
312
- principalType: "group" | "organization";
313
- stateHash: string;
314
296
  };
315
297
  currentProjection: {
316
298
  identityBundleFingerprint: string;
@@ -37,13 +37,7 @@ export declare class WriterProjectionArea {
37
37
  version: number;
38
38
  };
39
39
  payload: {
40
- cipherSuite: "aes-256-gcm";
41
40
  ciphertext: string;
42
- ciphertextHash: string;
43
- createdAt: string;
44
- principalId: string;
45
- principalType: "group" | "organization";
46
- stateHash: string;
47
41
  };
48
42
  }[];
49
43
  groups: {
@@ -125,13 +119,7 @@ export declare class WriterProjectionArea {
125
119
  version: number;
126
120
  };
127
121
  payload: {
128
- cipherSuite: "aes-256-gcm";
129
122
  ciphertext: string;
130
- ciphertextHash: string;
131
- createdAt: string;
132
- principalId: string;
133
- principalType: "group" | "organization";
134
- stateHash: string;
135
123
  };
136
124
  }[];
137
125
  groups: {
@@ -10,10 +10,14 @@ export interface HeldDirectoryCitation {
10
10
  }
11
11
  export declare function isHeldDirectoryCitation(value: unknown): value is HeldDirectoryCitation;
12
12
  /**
13
- * The payload when its organization state recomputes to its own hash and its
14
- * bytes hash to the `payloadCiphertextHash` that state signs; null otherwise.
15
- * The state hash commits that payload hash, so a cited payload is exactly the
13
+ * The payload, under its state hash, when its organization state recomputes
14
+ * to its own hash and its bytes hash to the `payloadCiphertextHash` that
15
+ * state signs; null otherwise. A payload is only its ciphertext (#2903 P23),
16
+ * so the signed hash is its whole identity: a cited payload is exactly the
16
17
  * bytes the server would serve for that state, and verification of the
17
18
  * rebuilt evidence decides as if they had travelled.
18
19
  */
19
- export declare function signedDirectoryPayload(citation: HeldDirectoryCitation): Promise<PrincipalStatePayloadResponse | null>;
20
+ export declare function signedDirectoryPayload(citation: HeldDirectoryCitation): Promise<{
21
+ readonly payload: PrincipalStatePayloadResponse;
22
+ readonly stateHash: string;
23
+ } | null>;
@@ -8,9 +8,10 @@ export function isHeldDirectoryCitation(value) {
8
8
  isPrincipalStatePayloadResponse(Reflect.get(value, "directoryPayload")));
9
9
  }
10
10
  /**
11
- * The payload when its organization state recomputes to its own hash and its
12
- * bytes hash to the `payloadCiphertextHash` that state signs; null otherwise.
13
- * The state hash commits that payload hash, so a cited payload is exactly the
11
+ * The payload, under its state hash, when its organization state recomputes
12
+ * to its own hash and its bytes hash to the `payloadCiphertextHash` that
13
+ * state signs; null otherwise. A payload is only its ciphertext (#2903 P23),
14
+ * so the signed hash is its whole identity: a cited payload is exactly the
14
15
  * bytes the server would serve for that state, and verification of the
15
16
  * rebuilt evidence decides as if they had travelled.
16
17
  */
@@ -18,16 +19,11 @@ export async function signedDirectoryPayload(citation) {
18
19
  const { directoryState: state, directoryPayload: payload } = citation;
19
20
  try {
20
21
  if (state.principalType !== "organization" ||
21
- payload.principalType !== "organization" ||
22
- payload.principalId !== state.principalId ||
23
- payload.stateHash !== state.stateHash ||
24
22
  !isSha256HexString(state.stateHash) ||
25
23
  (await computePrincipalStateHash(state)) !== state.stateHash)
26
24
  return null;
27
- const hash = await computePrincipalStatePayloadCiphertextHash(payload.ciphertext);
28
- return hash === state.payloadCiphertextHash &&
29
- hash === payload.ciphertextHash
30
- ? payload
25
+ return (await computePrincipalStatePayloadCiphertextHash(payload.ciphertext)) === state.payloadCiphertextHash
26
+ ? { payload, stateHash: state.stateHash }
31
27
  : null;
32
28
  }
33
29
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"heldDirectoryCitations.js","sourceRoot":"","sources":["heldDirectoryCitations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,0CAA0C,GAC3C,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GAGzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAY/D,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,wBAAwB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAC9D,+BAA+B,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CACxE,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,QAA+B;IAE/B,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IACtE,IAAI,CAAC;QACH,IACE,KAAK,CAAC,aAAa,KAAK,cAAc;YACtC,OAAO,CAAC,aAAa,KAAK,cAAc;YACxC,OAAO,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW;YACzC,OAAO,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;YACrC,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC;YACnC,CAAC,MAAM,yBAAyB,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS;YAE5D,OAAO,IAAI,CAAC;QACd,MAAM,IAAI,GAAG,MAAM,0CAA0C,CAC3D,OAAO,CAAC,UAAU,CACnB,CAAC;QACF,OAAO,IAAI,KAAK,KAAK,CAAC,qBAAqB;YACzC,IAAI,KAAK,OAAO,CAAC,cAAc;YAC/B,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import {\n computePrincipalStateHash,\n computePrincipalStatePayloadCiphertextHash,\n} from \"@tearleads/crypto\";\nimport {\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalStatePayloadResponse,\n type PrincipalStateResponse,\n} from \"@tearleads/validators/response\";\nimport { isSha256HexString } from \"@tearleads/validators/util\";\n\n/**\n * An organization directory payload a device holds, beside the signed state\n * that commits its hash. Writer projections serve directory payloads as\n * policy evidence; a request may cite a held one by state hash instead.\n */\nexport interface HeldDirectoryCitation {\n readonly directoryState: PrincipalStateResponse;\n readonly directoryPayload: PrincipalStatePayloadResponse;\n}\n\nexport function isHeldDirectoryCitation(\n value: unknown,\n): value is HeldDirectoryCitation {\n return (\n typeof value === \"object\" &&\n value !== null &&\n isPrincipalStateResponse(Reflect.get(value, \"directoryState\")) &&\n isPrincipalStatePayloadResponse(Reflect.get(value, \"directoryPayload\"))\n );\n}\n\n/**\n * The payload when its organization state recomputes to its own hash and its\n * bytes hash to the `payloadCiphertextHash` that state signs; null otherwise.\n * The state hash commits that payload hash, so a cited payload is exactly the\n * bytes the server would serve for that state, and verification of the\n * rebuilt evidence decides as if they had travelled.\n */\nexport async function signedDirectoryPayload(\n citation: HeldDirectoryCitation,\n): Promise<PrincipalStatePayloadResponse | null> {\n const { directoryState: state, directoryPayload: payload } = citation;\n try {\n if (\n state.principalType !== \"organization\" ||\n payload.principalType !== \"organization\" ||\n payload.principalId !== state.principalId ||\n payload.stateHash !== state.stateHash ||\n !isSha256HexString(state.stateHash) ||\n (await computePrincipalStateHash(state)) !== state.stateHash\n )\n return null;\n const hash = await computePrincipalStatePayloadCiphertextHash(\n payload.ciphertext,\n );\n return hash === state.payloadCiphertextHash &&\n hash === payload.ciphertextHash\n ? payload\n : null;\n } catch {\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"heldDirectoryCitations.js","sourceRoot":"","sources":["heldDirectoryCitations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,0CAA0C,GAC3C,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GAGzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAY/D,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,wBAAwB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAC9D,+BAA+B,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CACxE,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,QAA+B;IAK/B,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IACtE,IAAI,CAAC;QACH,IACE,KAAK,CAAC,aAAa,KAAK,cAAc;YACtC,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC;YACnC,CAAC,MAAM,yBAAyB,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS;YAE5D,OAAO,IAAI,CAAC;QACd,OAAO,CAAC,MAAM,0CAA0C,CACtD,OAAO,CAAC,UAAU,CACnB,CAAC,KAAK,KAAK,CAAC,qBAAqB;YAChC,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE;YACzC,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import {\n computePrincipalStateHash,\n computePrincipalStatePayloadCiphertextHash,\n} from \"@tearleads/crypto\";\nimport {\n isPrincipalStatePayloadResponse,\n isPrincipalStateResponse,\n type PrincipalStatePayloadResponse,\n type PrincipalStateResponse,\n} from \"@tearleads/validators/response\";\nimport { isSha256HexString } from \"@tearleads/validators/util\";\n\n/**\n * An organization directory payload a device holds, beside the signed state\n * that commits its hash. Writer projections serve directory payloads as\n * policy evidence; a request may cite a held one by state hash instead.\n */\nexport interface HeldDirectoryCitation {\n readonly directoryState: PrincipalStateResponse;\n readonly directoryPayload: PrincipalStatePayloadResponse;\n}\n\nexport function isHeldDirectoryCitation(\n value: unknown,\n): value is HeldDirectoryCitation {\n return (\n typeof value === \"object\" &&\n value !== null &&\n isPrincipalStateResponse(Reflect.get(value, \"directoryState\")) &&\n isPrincipalStatePayloadResponse(Reflect.get(value, \"directoryPayload\"))\n );\n}\n\n/**\n * The payload, under its state hash, when its organization state recomputes\n * to its own hash and its bytes hash to the `payloadCiphertextHash` that\n * state signs; null otherwise. A payload is only its ciphertext (#2903 P23),\n * so the signed hash is its whole identity: a cited payload is exactly the\n * bytes the server would serve for that state, and verification of the\n * rebuilt evidence decides as if they had travelled.\n */\nexport async function signedDirectoryPayload(\n citation: HeldDirectoryCitation,\n): Promise<{\n readonly payload: PrincipalStatePayloadResponse;\n readonly stateHash: string;\n} | null> {\n const { directoryState: state, directoryPayload: payload } = citation;\n try {\n if (\n state.principalType !== \"organization\" ||\n !isSha256HexString(state.stateHash) ||\n (await computePrincipalStateHash(state)) !== state.stateHash\n )\n return null;\n return (await computePrincipalStatePayloadCiphertextHash(\n payload.ciphertext,\n )) === state.payloadCiphertextHash\n ? { payload, stateHash: state.stateHash }\n : null;\n } catch {\n return null;\n }\n}\n"]}
@@ -29,13 +29,7 @@ export declare function getOrganizationPolicyHistoryResult(runtime: ApiRequestRu
29
29
  version: number;
30
30
  };
31
31
  payload: {
32
- cipherSuite: "aes-256-gcm";
33
32
  ciphertext: string;
34
- ciphertextHash: string;
35
- createdAt: string;
36
- principalId: string;
37
- principalType: "group" | "organization";
38
- stateHash: string;
39
33
  };
40
34
  }[];
41
35
  groups: {
@@ -75,13 +75,7 @@ export declare class PrincipalPolicyRequests {
75
75
  stateHash: string;
76
76
  };
77
77
  currentPayload: {
78
- cipherSuite: "aes-256-gcm";
79
78
  ciphertext: string;
80
- ciphertextHash: string;
81
- createdAt: string;
82
- principalId: string;
83
- principalType: "group" | "organization";
84
- stateHash: string;
85
79
  };
86
80
  currentProjection: {
87
81
  identityBundleFingerprint: string;
@@ -184,13 +178,7 @@ export declare class PrincipalPolicyRequests {
184
178
  stateHash: string;
185
179
  };
186
180
  currentPayload: {
187
- cipherSuite: "aes-256-gcm";
188
181
  ciphertext: string;
189
- ciphertextHash: string;
190
- createdAt: string;
191
- principalId: string;
192
- principalType: "group" | "organization";
193
- stateHash: string;
194
182
  };
195
183
  currentProjection: {
196
184
  identityBundleFingerprint: string;
@@ -305,13 +293,7 @@ export declare class PrincipalPolicyRequests {
305
293
  stateHash: string;
306
294
  };
307
295
  currentPayload: {
308
- cipherSuite: "aes-256-gcm";
309
296
  ciphertext: string;
310
- ciphertextHash: string;
311
- createdAt: string;
312
- principalId: string;
313
- principalType: "group" | "organization";
314
- stateHash: string;
315
297
  };
316
298
  currentProjection: {
317
299
  identityBundleFingerprint: string;
@@ -79,9 +79,9 @@ async function prepareHeldCitations(entries) {
79
79
  held.kekLevels.set(digest, level);
80
80
  });
81
81
  const payloads = await Promise.all(directories.map(signedDirectoryPayload));
82
- for (const payload of payloads)
83
- if (payload && !held.directories.has(payload.stateHash))
84
- held.directories.set(payload.stateHash, payload);
82
+ for (const signed of payloads)
83
+ if (signed && !held.directories.has(signed.stateHash))
84
+ held.directories.set(signed.stateHash, signed.payload);
85
85
  return held;
86
86
  }
87
87
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"verifiedManifestCitations.js","sourceRoot":"","sources":["verifiedManifestCitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,uBAAuB,GAExB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wCAAwC,EACxC,iBAAiB,EACjB,0BAA0B,EAC1B,yBAAyB,GAE1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAIlC,mFAAmF;AACnF,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAkDjD,SAAS,WAAW;IAClB,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAC9E,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CACtB,OAA+C,EAC/C,MAA+B;IAE/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,IAA6B,EAAE,EAAE;YAC/C,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,6BAA6B,CAA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EAC9B,MAAgC;IAEhC,IAAI,CAAC,MAAM;QAAE,OAAO,WAAW,EAAE,CAAC;IAClC,OAAO,eAAe,CACpB,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC3D,MAAM,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { computeContainerKekLevelDigest } from \"@tearleads/crypto\";\nimport {\n type ContainerKekWireLevel,\n isContainerKekWireLevel,\n type PrincipalStatePayloadResponse,\n} from \"@tearleads/validators/response\";\nimport {\n isServedAccessManifestBundleWireResponse,\n isSha256HexString,\n KNOWN_DIRECTORY_HINT_LIMIT,\n KNOWN_MANIFEST_HINT_LIMIT,\n type ServedAccessManifestBundleWireResponse,\n} from \"@tearleads/validators/util\";\nimport {\n type HeldDirectoryCitation,\n isHeldDirectoryCitation,\n signedDirectoryPayload,\n} from \"./heldDirectoryCitations\";\n\nexport type { HeldDirectoryCitation } from \"./heldDirectoryCitations\";\n\n/** Citation only saves bytes: a source slower than this sends the read uncited. */\nexport const MANIFEST_CITATION_DEADLINE_MS = 250;\n\n/**\n * Where a listing placed a container the device has not stored yet. Only\n * which held bytes a read cites depends on it, never what the read accepts.\n */\nexport interface WriterProjectionListing {\n readonly organizationId: string;\n readonly parentId: string | null;\n}\n\nexport interface WriterProjectionTarget {\n readonly kind: \"container\" | \"document\";\n readonly id: string;\n readonly listing?: WriterProjectionListing | undefined;\n}\n\n/**\n * A held access-manifest bundle, a held container KEK level, or a held\n * organization directory payload with its signed state.\n */\nexport type HeldProjectionCitation =\n | ServedAccessManifestBundleWireResponse\n | ContainerKekWireLevel\n | HeldDirectoryCitation;\n\n/**\n * Verified access-manifest bundles, container KEK levels and organization\n * directory payloads a device durably holds that a writer projection of\n * `target` may cite, most useful first.\n * This is never trust input: the exact cited bytes only fill the response's\n * omitted positions, and the caller verifies the rebuilt projection exactly\n * as a full one.\n */\nexport interface VerifiedManifestCitations {\n cite(\n target: WriterProjectionTarget,\n ): Promise<readonly HeldProjectionCitation[]>;\n}\n\n/**\n * The exact bytes one request cites: bundles by hash, levels by digest,\n * directory payloads by their organization state's hash.\n */\nexport interface HeldProjectionCitations {\n readonly bundles: Map<string, ServedAccessManifestBundleWireResponse>;\n readonly kekLevels: Map<string, ContainerKekWireLevel>;\n readonly directories: Map<string, PrincipalStatePayloadResponse>;\n}\n\nfunction noCitations(): HeldProjectionCitations {\n return { bundles: new Map(), kekLevels: new Map(), directories: new Map() };\n}\n\n/**\n * The prepared citations, or none once the deadline passes, the caller\n * aborts, or the source or preparation throws or rejects. A late answer is\n * discarded: it can never reach a request that was already sent.\n */\nfunction boundedCitation(\n prepare: () => Promise<HeldProjectionCitations>,\n signal: AbortSignal | undefined,\n): Promise<HeldProjectionCitations> {\n return new Promise((resolve) => {\n let settled = false;\n const finish = (held: HeldProjectionCitations) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n signal?.removeEventListener(\"abort\", abandon);\n resolve(held);\n };\n const abandon = () => finish(noCitations());\n const timer = setTimeout(abandon, MANIFEST_CITATION_DEADLINE_MS);\n if (signal?.aborted) return abandon();\n signal?.addEventListener(\"abort\", abandon, { once: true });\n try {\n prepare().then(finish, abandon);\n } catch {\n abandon();\n }\n });\n}\n\n/** Copies of the source's entries, each kind within its own hint quota. */\nfunction copyHeldEntries(entries: readonly unknown[]) {\n const bundles = new Map<string, ServedAccessManifestBundleWireResponse>();\n const levels: ContainerKekWireLevel[] = [];\n const directories: HeldDirectoryCitation[] = [];\n const manifestQuotaLeft = () =>\n bundles.size + levels.length < KNOWN_MANIFEST_HINT_LIMIT;\n for (const entry of entries) {\n try {\n if (isHeldDirectoryCitation(entry)) {\n if (directories.length < KNOWN_DIRECTORY_HINT_LIMIT)\n directories.push(structuredClone(entry));\n } else if (!manifestQuotaLeft()) continue;\n else if (isContainerKekWireLevel(entry))\n levels.push(structuredClone(entry));\n else if (\n isServedAccessManifestBundleWireResponse(entry) &&\n isSha256HexString(entry.manifestHash) &&\n !bundles.has(entry.manifestHash)\n )\n bundles.set(entry.manifestHash, structuredClone(entry));\n } catch {\n // An uncloneable entry is skipped; its bytes simply travel.\n }\n }\n return { bundles, levels, directories };\n}\n\n/**\n * Copies the source's answer and keys each KEK level by the digest\n * recomputed from its own bytes, never by a digest the source names. A\n * directory payload is cited only when it hashes to the payload hash its own\n * signed organization state commits.\n */\nasync function prepareHeldCitations(\n entries: readonly unknown[],\n): Promise<HeldProjectionCitations> {\n const { bundles, levels, directories } = copyHeldEntries(entries);\n const held: HeldProjectionCitations = { ...noCitations(), bundles };\n const digests = await Promise.all(levels.map(computeContainerKekLevelDigest));\n levels.forEach((level, index) => {\n const digest = digests[index];\n if (digest && !held.kekLevels.has(digest))\n held.kekLevels.set(digest, level);\n });\n const payloads = await Promise.all(directories.map(signedDirectoryPayload));\n for (const payload of payloads)\n if (payload && !held.directories.has(payload.stateHash))\n held.directories.set(payload.stateHash, payload);\n return held;\n}\n\n/**\n * The bytes one request cites, copied so a later eviction or mutation of the\n * source cannot change what fills its omissions. Citing only saves bytes, so\n * it never blocks or fails a read: a slow, failing, or abandoned source or\n * preparation yields no hints, within one deadline.\n */\nexport async function heldManifestCitations(\n source: VerifiedManifestCitations | null,\n target: WriterProjectionTarget,\n signal?: AbortSignal | undefined,\n): Promise<HeldProjectionCitations> {\n if (!source) return noCitations();\n return boundedCitation(\n async () => prepareHeldCitations(await source.cite(target)),\n signal,\n );\n}\n"]}
1
+ {"version":3,"file":"verifiedManifestCitations.js","sourceRoot":"","sources":["verifiedManifestCitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,uBAAuB,GAExB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wCAAwC,EACxC,iBAAiB,EACjB,0BAA0B,EAC1B,yBAAyB,GAE1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,GACvB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M,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9E,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;YACvC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC5E,KAAK,MAAM,MAAM,IAAI,QAAQ;QAC3B,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;YACnD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAwC,EACxC,MAA8B,EAC9B,MAAgC;IAEhC,IAAI,CAAC,MAAM;QAAE,OAAO,WAAW,EAAE,CAAC;IAClC,OAAO,eAAe,CACpB,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC3D,MAAM,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { computeContainerKekLevelDigest } from \"@tearleads/crypto\";\nimport {\n type ContainerKekWireLevel,\n isContainerKekWireLevel,\n type PrincipalStatePayloadResponse,\n} from \"@tearleads/validators/response\";\nimport {\n isServedAccessManifestBundleWireResponse,\n isSha256HexString,\n KNOWN_DIRECTORY_HINT_LIMIT,\n KNOWN_MANIFEST_HINT_LIMIT,\n type ServedAccessManifestBundleWireResponse,\n} from \"@tearleads/validators/util\";\nimport {\n type HeldDirectoryCitation,\n isHeldDirectoryCitation,\n signedDirectoryPayload,\n} from \"./heldDirectoryCitations\";\n\nexport type { HeldDirectoryCitation } from \"./heldDirectoryCitations\";\n\n/** Citation only saves bytes: a source slower than this sends the read uncited. */\nexport const MANIFEST_CITATION_DEADLINE_MS = 250;\n\n/**\n * Where a listing placed a container the device has not stored yet. Only\n * which held bytes a read cites depends on it, never what the read accepts.\n */\nexport interface WriterProjectionListing {\n readonly organizationId: string;\n readonly parentId: string | null;\n}\n\nexport interface WriterProjectionTarget {\n readonly kind: \"container\" | \"document\";\n readonly id: string;\n readonly listing?: WriterProjectionListing | undefined;\n}\n\n/**\n * A held access-manifest bundle, a held container KEK level, or a held\n * organization directory payload with its signed state.\n */\nexport type HeldProjectionCitation =\n | ServedAccessManifestBundleWireResponse\n | ContainerKekWireLevel\n | HeldDirectoryCitation;\n\n/**\n * Verified access-manifest bundles, container KEK levels and organization\n * directory payloads a device durably holds that a writer projection of\n * `target` may cite, most useful first.\n * This is never trust input: the exact cited bytes only fill the response's\n * omitted positions, and the caller verifies the rebuilt projection exactly\n * as a full one.\n */\nexport interface VerifiedManifestCitations {\n cite(\n target: WriterProjectionTarget,\n ): Promise<readonly HeldProjectionCitation[]>;\n}\n\n/**\n * The exact bytes one request cites: bundles by hash, levels by digest,\n * directory payloads by their organization state's hash.\n */\nexport interface HeldProjectionCitations {\n readonly bundles: Map<string, ServedAccessManifestBundleWireResponse>;\n readonly kekLevels: Map<string, ContainerKekWireLevel>;\n readonly directories: Map<string, PrincipalStatePayloadResponse>;\n}\n\nfunction noCitations(): HeldProjectionCitations {\n return { bundles: new Map(), kekLevels: new Map(), directories: new Map() };\n}\n\n/**\n * The prepared citations, or none once the deadline passes, the caller\n * aborts, or the source or preparation throws or rejects. A late answer is\n * discarded: it can never reach a request that was already sent.\n */\nfunction boundedCitation(\n prepare: () => Promise<HeldProjectionCitations>,\n signal: AbortSignal | undefined,\n): Promise<HeldProjectionCitations> {\n return new Promise((resolve) => {\n let settled = false;\n const finish = (held: HeldProjectionCitations) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n signal?.removeEventListener(\"abort\", abandon);\n resolve(held);\n };\n const abandon = () => finish(noCitations());\n const timer = setTimeout(abandon, MANIFEST_CITATION_DEADLINE_MS);\n if (signal?.aborted) return abandon();\n signal?.addEventListener(\"abort\", abandon, { once: true });\n try {\n prepare().then(finish, abandon);\n } catch {\n abandon();\n }\n });\n}\n\n/** Copies of the source's entries, each kind within its own hint quota. */\nfunction copyHeldEntries(entries: readonly unknown[]) {\n const bundles = new Map<string, ServedAccessManifestBundleWireResponse>();\n const levels: ContainerKekWireLevel[] = [];\n const directories: HeldDirectoryCitation[] = [];\n const manifestQuotaLeft = () =>\n bundles.size + levels.length < KNOWN_MANIFEST_HINT_LIMIT;\n for (const entry of entries) {\n try {\n if (isHeldDirectoryCitation(entry)) {\n if (directories.length < KNOWN_DIRECTORY_HINT_LIMIT)\n directories.push(structuredClone(entry));\n } else if (!manifestQuotaLeft()) continue;\n else if (isContainerKekWireLevel(entry))\n levels.push(structuredClone(entry));\n else if (\n isServedAccessManifestBundleWireResponse(entry) &&\n isSha256HexString(entry.manifestHash) &&\n !bundles.has(entry.manifestHash)\n )\n bundles.set(entry.manifestHash, structuredClone(entry));\n } catch {\n // An uncloneable entry is skipped; its bytes simply travel.\n }\n }\n return { bundles, levels, directories };\n}\n\n/**\n * Copies the source's answer and keys each KEK level by the digest\n * recomputed from its own bytes, never by a digest the source names. A\n * directory payload is cited only when it hashes to the payload hash its own\n * signed organization state commits.\n */\nasync function prepareHeldCitations(\n entries: readonly unknown[],\n): Promise<HeldProjectionCitations> {\n const { bundles, levels, directories } = copyHeldEntries(entries);\n const held: HeldProjectionCitations = { ...noCitations(), bundles };\n const digests = await Promise.all(levels.map(computeContainerKekLevelDigest));\n levels.forEach((level, index) => {\n const digest = digests[index];\n if (digest && !held.kekLevels.has(digest))\n held.kekLevels.set(digest, level);\n });\n const payloads = await Promise.all(directories.map(signedDirectoryPayload));\n for (const signed of payloads)\n if (signed && !held.directories.has(signed.stateHash))\n held.directories.set(signed.stateHash, signed.payload);\n return held;\n}\n\n/**\n * The bytes one request cites, copied so a later eviction or mutation of the\n * source cannot change what fills its omissions. Citing only saves bytes, so\n * it never blocks or fails a read: a slow, failing, or abandoned source or\n * preparation yields no hints, within one deadline.\n */\nexport async function heldManifestCitations(\n source: VerifiedManifestCitations | null,\n target: WriterProjectionTarget,\n signal?: AbortSignal | undefined,\n): Promise<HeldProjectionCitations> {\n if (!source) return noCitations();\n return boundedCitation(\n async () => prepareHeldCitations(await source.cite(target)),\n signal,\n );\n}\n"]}
@@ -29,7 +29,7 @@ export { computePrincipalContainerGrantRoot, normalizePrincipalContainerGrants,
29
29
  export { computePrincipalMemberEnvelopesRoot, normalizePrincipalStateMemberEnvelopes, PrincipalMemberEnvelopeValidationError, } from "./principalMemberEnvelopes.js";
30
30
  export type { PrincipalPolicyValidationErrorCode } from "./principalPolicyValidationError.js";
31
31
  export { PrincipalPolicyValidationError, throwPrincipalPolicyValidationError, } from "./principalPolicyValidationError.js";
32
- export type { ManagedRecipientPrincipalType, PrincipalContainerGrant, PrincipalContainerGrantAccessLevel, PrincipalProjectionMember, PrincipalProjectionRole, PrincipalStateExternalAuthority, PrincipalStateHeaderInput, PrincipalStateMember, PrincipalStateMemberEnvelope, PrincipalStateMembershipMode, PrincipalStatePayloadCipherSuite, PrincipalStateSigningInput, SignedPrincipalState, UnsignedPrincipalState, } from "./principalState.js";
32
+ export type { ManagedRecipientPrincipalType, PrincipalContainerGrant, PrincipalContainerGrantAccessLevel, PrincipalProjectionMember, PrincipalProjectionRole, PrincipalStateExternalAuthority, PrincipalStateHeaderInput, PrincipalStateMember, PrincipalStateMemberEnvelope, PrincipalStateMembershipMode, PrincipalStateSigningInput, SignedPrincipalState, UnsignedPrincipalState, } from "./principalState.js";
33
33
  export { buildPrincipalStateSigningInput, computePrincipalMembershipRoot, computePrincipalProjectionRoot, computePrincipalStateHash, computePrincipalStatePayloadCiphertextHash, derivePrincipalProjectionMembers, isManagedRecipientPrincipalType, isPrincipalProjectionRole, normalizePrincipalProjectionMembers, normalizePrincipalStateMembers, serializeUnsignedPrincipalState, signPrincipalState, } from "./principalState.js";
34
34
  export { verifySignedPrincipalState, verifySignedPrincipalStateResult, } from "./principalStateVerification.js";
35
35
  export type { SigningKeyPair } from "./signing/generateKeyPair.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B,EAC9B,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAA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,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { blobContentMetadataHash } from \"./blobContentMetadata\";\nexport { BlobEnvelopeError } from \"./blobEnvelopeError\";\nexport type {\n BlobEnvelopeHeaderRecord,\n BlobEnvelopeRecord,\n} from \"./blobEnvelopeReader\";\nexport {\n MAX_BLOB_ENVELOPE_HEADER_BYTES,\n parseBlobEnvelopeV2,\n parseBlobEnvelopeV2Header,\n readBlobEnvelopeHeaderByteLength,\n} from \"./blobEnvelopeReader\";\nexport type { BlobEnvelopeV2Header } from \"./blobEnvelopeV2\";\nexport {\n BLOB_CHUNK_SIZE_BYTES,\n BLOB_ENCRYPTED_BYTES_FORMAT,\n BLOB_ENCRYPTED_BYTES_VERSION,\n BLOB_ENVELOPE_MAGIC_BYTES,\n BLOB_ENVELOPE_PREFIX_BYTES,\n blobChunkPlaintextByteLength,\n computeBlobChunkCount,\n computeBlobEncryptedByteLength,\n deriveBlobChunkIv,\n encodeBlobEnvelopeV2Header,\n joinBlobPartBytes,\n MAX_BLOB_CHUNK_COUNT,\n normalizeBlobChunkSize,\n} from \"./blobEnvelopeV2\";\nexport { compareCanonicalStrings } from \"./canonicalOrdering\";\nexport {\n AUTH_CHALLENGE_BYTES,\n AUTH_CHALLENGE_HEX_LENGTH,\n authChallengeSigningBytes,\n CHALLENGE_TTL_SECONDS,\n canonicalAuthOrigin,\n generateChallenge,\n} from \"./challenge\";\nexport type {\n ContentKeyEnvelopeKind,\n ContentKeyWrapBinding,\n} from \"./contentKeyEnvelope\";\nexport {\n ContentKeyEnvelopeError,\n decodeContentKeyEnvelope,\n unwrapContentKey,\n wrapContentKey,\n} from \"./contentKeyEnvelope\";\nexport { decryptAsRecipient } from \"./encapsulation/decryptAsRecipient\";\nexport { encryptForRecipients } from \"./encapsulation/encryptForRecipients\";\nexport type { EncapsulationKeyPair } from \"./encapsulation/generateKeyPair\";\nexport {\n generateKemKeyPair,\n generateKemSeedAndKeyPair,\n ML_KEM1024_CIPHERTEXT_BYTES,\n ML_KEM1024_PUBLIC_KEY_BYTES,\n ML_KEM1024_SECRET_KEY_BYTES,\n ML_KEM1024_SEED_BYTES,\n} from \"./encapsulation/generateKeyPair\";\nexport type { EncryptedEnvelope, RecipientEntry } from \"./encapsulation/types\";\nexport { unwrapDek } from \"./encapsulation/unwrapDek\";\nexport { wrapDekForRecipients } from \"./encapsulation/wrapDek\";\nexport { toFingerprint } from \"./fingerprint\";\nexport {\n decryptGroupMetadata,\n encodeBuiltinGroupMetadata,\n encryptGroupMetadata,\n type GroupMetadata,\n type GroupMetadataKey,\n readGroupMetadata,\n} from \"./groupMetadata\";\nexport { bytesToHex, hexToBytes } from \"./hex\";\nexport {\n createIdentitySeedPhrase,\n createIdentitySeedPhraseFromEntropy,\n generateIdentityKeyPairsFromSeedPhrase,\n IDENTITY_SEED_PHRASE_DERIVATION_SUITE,\n IDENTITY_SEED_PHRASE_ENTROPY_BYTES,\n IDENTITY_SEED_PHRASE_STRENGTH_BITS,\n IDENTITY_SEED_PHRASE_WORDS,\n type IdentitySeedPhraseKeyPairs,\n normalizeIdentitySeedPhrase,\n validateIdentitySeedPhrase,\n} from \"./identitySeedPhrase\";\nexport { canonicalIdentityTrustDomain } from \"./identityTrustDomain\";\nexport {\n createIncrementalSha256,\n type IncrementalSha256,\n} from \"./incrementalSha256\";\nexport type {\n AccessEvent,\n AccessEventType,\n AccessManifest,\n AccessManifestCheckpoint,\n AccessManifestTransparencyLeaf,\n AccessObjectKind,\n AnyVerifiedAccessManifest,\n AnyVerifiedPrincipalPolicy,\n AttachmentAccessEventBody,\n AttachmentBindAccessEventBody,\n AttachmentDetachAccessEventBody,\n BlobAccessManifest,\n BlobContentKeyTarget,\n ContainerAccessEventBody,\n ContainerAccessKeyState,\n ContainerAccessLevel,\n ContainerAccessManifest,\n ContainerAccessManifestState,\n ContainerAccessStructural,\n ContainerCreateAccessEventBody,\n ContainerDirectGrant,\n ContainerGrantAccessEventBody,\n ContainerGrantPrincipalHead,\n ContainerGrantSubjectType,\n ContainerKekKeyring,\n ContainerKekKeyringEntry,\n ContainerKekParentBinding,\n ContainerKekPredecessorBridge,\n ContainerKekRecipientTarget,\n ContainerKekTarget,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerMoveAccessEventBody,\n ContainerReciteAccessEventBody,\n ContainerRekeyAccessEventBody,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n ContentObjectKind,\n ContentRecordEncryptionSuite,\n ContentRecordNonceDomain,\n DeriveBlobKekTargetsInput,\n DeriveContainerKekRecipientTargetsInput,\n DeriveDocumentKekTargetsInput,\n DocumentAccessEventBody,\n DocumentContentKeyTarget,\n DocumentContentRecordMetadataInput,\n DocumentLinkAccessEventBody,\n DocumentLinkSetManifestState,\n DocumentLinkSetStructural,\n DocumentPurgeAccessEventBody,\n DocumentUnlinkAccessEventBody,\n IdentityStateCheckpoint,\n IdentityStateHead,\n IdentityStateTransparencyLeaf,\n KekRecipientKind,\n KeyingCanonicalJson,\n KeyingHashDomain,\n KeyingLocalCheckpointStore,\n KeyingVerificationCode,\n KeyingVerificationResult,\n ManagedPrincipalKind,\n PrincipalHistoryIndexNode,\n PrincipalHistorySigner,\n PrincipalPolicyAuthorization,\n PrincipalPolicyBundle,\n PrincipalPolicyCheckpoint,\n PrincipalPolicyCurrent,\n PrincipalPolicyExternalAuthority,\n PrincipalPolicyExternalAuthorityState,\n PrincipalPolicyHistoryInput,\n PrincipalPolicyHistoryPage,\n PrincipalPolicyHistoryProgressOptions,\n PrincipalPolicyHistoryReferenceProof,\n PrincipalPolicyHistoryVerifier,\n PrincipalPolicyMemberEnvelopes,\n PrincipalPolicyPayload,\n PrincipalPolicySignedState,\n PrincipalPolicySignerPublicKey,\n PrincipalPolicySnapshot,\n PrincipalPolicyStateChainEntry,\n PrincipalPolicyTransitionMismatch,\n PrincipalPolicyTransitionMismatchCode,\n PrincipalPolicyTransparencyLeaf,\n ReferencedPrincipalHead,\n SignedTransparencyTreeHead,\n TransparencyConsistencyProof,\n TransparencyInclusionProof,\n TransparencyLeaf,\n TransparencyLeafKind,\n TransparencyTreeCheckpoint,\n UnsignedAccessEvent,\n UnsignedTransparencyTreeHead,\n UnsignedWriteHeader,\n VerifiedAccessEvent,\n VerifiedAccessManifest,\n VerifiedAccessManifestCheckpointEvidence,\n VerifiedAccessManifestSnapshot,\n VerifiedAttachmentBinding,\n VerifiedAttachmentDetach,\n VerifiedBlobKekTargets,\n VerifiedContainerAccessManifest,\n VerifiedContainerKekState,\n VerifiedContainerParentEdge,\n VerifiedDocumentKekTargets,\n VerifiedDocumentLinkSetManifest,\n VerifiedDocumentLinkSetSnapshot,\n VerifiedDocumentLinkSetStateEvidence,\n VerifiedIdentityState,\n VerifiedPrincipalPolicy,\n VerifiedPrincipalPolicyCurrent,\n VerifiedPrincipalPolicyHistory,\n VerifiedPrincipalPolicySelection,\n VerifiedPrincipalPolicySnapshot,\n VerifiedTransparencyProof,\n VerifiedTransparencyTreeHead,\n VerifiedWriteHeader,\n VerifyAccessEventInput,\n VerifyAccessManifestInput,\n VerifyAttachmentBindingEventInput,\n VerifyAttachmentDetachEventInput,\n VerifyContainerAccessManifestInput,\n VerifyContainerKekStateInput,\n VerifyContainerParentEdgeInput,\n VerifyDocumentLinkSetManifestInput,\n VerifyDocumentPurgeEventInput,\n VerifyIdentityStateCheckpointInput,\n VerifyPrincipalPolicyBundleInput,\n VerifyPrincipalPolicySnapshotInput,\n VerifySignedTransparencyTreeHeadInput,\n VerifyTransparencyConsistencyProofInput,\n VerifyTransparencyInclusionProofInput,\n VerifyTransparencyProofInput,\n VerifyWriteHeaderInput,\n WriteHeader,\n} from \"./keying\";\nexport {\n ACCESS_MANIFEST_VERIFICATION_REVISION,\n accessManifestCheckpointFromManifest,\n accessManifestTransparencyLeaf,\n assertSealedContainerKekKeyringLength,\n BLOB_CONTENT_KEY_WRAP_SUITE,\n CONTAINER_KEK_KEYRING_ENTRY_BYTES,\n CONTAINER_KEK_KEYRING_FORMAT_VERSION,\n CONTAINER_KEK_KEYRING_HEADER_BYTES,\n CONTAINER_KEK_KEYRING_SEAL_SUITE,\n CONTAINER_KEK_MATERIAL_ID_PREFIX,\n CONTAINER_KEK_PARENT_WRAP_SUITE,\n CONTAINER_KEK_PREDECESSOR_WRAP_SUITE,\n CONTAINER_KEK_USER_WRAP_SUITE,\n CONTENT_RECORD_ENCRYPTION_SUITE,\n computeAccessEventBodyHash,\n computeAccessEventHash,\n computeAccessManifestBundleDigest,\n computeAccessManifestHash,\n computeBlobAccessManifestHash,\n computeBlobContentKeyTargetHash,\n computeContainerAccessKeyTargetHash,\n computeContainerAccessStructuralHash,\n computeContainerDirectGrantRoot,\n computeContainerKekKeyringHash,\n computeContainerKekLevelDigest,\n computeContainerKekMaterialId,\n computeContainerKekPredecessorBridgeHash,\n computeContainerKekRecipientTargetHash,\n computeContainerKeyEpochHash,\n computeContentRecordNonceDomainHash,\n computeDocumentContentKeyTargetHash,\n computeDocumentContentRecordCiphertextHash,\n computeDocumentContentRecordMetadataHash,\n computeDocumentContentRecordPlaintextHash,\n computeDocumentLinkSetGrantRoot,\n computeDocumentLinkSetKeyTargetHash,\n computeDocumentLinkSetStructuralHash,\n computeKeyingDomainHash,\n computeTransparencyLeafHash,\n computeTransparencyMerkleRoot,\n computeWriteHeaderHash,\n createContainerKekPredecessorBridge,\n createPrincipalHistoryIndexProof,\n createPrincipalPolicyHistoryVerifier,\n createTransparencyConsistencyProof,\n createTransparencyInclusionProof,\n DOCUMENT_CONTENT_KEY_WRAP_SUITE,\n deriveBlobKekTargets,\n deriveContainerAccessManifest,\n deriveContainerKekRecipientTargets,\n deriveContainerKekWrappingPublicKey,\n deriveDocumentKekTargets,\n deriveDocumentLinkSetManifest,\n derivePrincipalRecipientKeyEpochId,\n documentContentRecordMetadata,\n expectedSealedContainerKekKeyringBytes,\n getPrincipalPolicyTransitionMismatch,\n getPrincipalPolicyTransitionMismatchReason,\n identityStateTransparencyLeaf,\n isContainerKekMaterialId,\n isKeyingCanonicalJson,\n isKeyingVerificationCode,\n KEYING_VERIFICATION_CODES,\n KeyingVerificationError,\n largestPowerOfTwoLessThan,\n MAX_CONTAINER_KEY_EPOCH,\n MAX_CONTAINER_RECITATION_EPOCH,\n makeVerifiedAccessEvent,\n makeVerifiedBlobKekTargets,\n makeVerifiedContainerAccessManifest,\n makeVerifiedContainerKekState,\n makeVerifiedDocumentKekTargets,\n makeVerifiedDocumentLinkSetManifest,\n makeVerifiedDocumentLinkSetSnapshot,\n makeVerifiedPrincipalPolicy,\n normalizeAttachmentAccessEventBody,\n normalizeContainerAccessEventBody,\n normalizeContainerKekKeyring,\n normalizeContainerKekPredecessorBridge,\n normalizeDocumentAccessEventBody,\n normalizeDocumentPurgeAccessEventBody,\n openContainerKekKeyring,\n PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT,\n PRINCIPAL_HISTORY_VERIFICATION_REVISION,\n principalHistoryIndexLeaf,\n principalPolicyMatchesReference,\n principalPolicyTransparencyLeaf,\n readKeyingCanonicalJson,\n resolveContainerPathUserAccessLevel,\n resolveContainerStatePathUserAccessLevel,\n resolveHistoricalContainerPathUserAccessLevel,\n resolvePrincipalHistoryIndexProof,\n restorePrincipalPolicyHistoryVerifier,\n sealContainerKekKeyring,\n selectPrincipalPolicyAuthorization,\n selectPrincipalPolicyCurrentPredecessorReferences,\n serializeKeyingCanonicalJson,\n signAccessEvent,\n signTransparencyTreeHead,\n signWriteHeader,\n unwrapContainerKekParentWrap,\n unwrapContainerKekPredecessorBridge,\n verifyAccessManifest,\n verifyAccessManifestLocalCheckpoint,\n verifyAccessManifestSnapshot,\n verifyAttachmentBindingEvent,\n verifyAttachmentDetachEvent,\n verifyContainerAccessManifest,\n verifyContainerKekKeyringEntry,\n verifyContainerKekState,\n verifyContainerParentEdge,\n verifyDocumentLinkSetManifest,\n verifyDocumentLinkSetSnapshot,\n verifyDocumentPurgeEvent,\n verifyIdentityStateCheckpoint,\n verifyPrincipalPolicyBundle,\n verifyPrincipalPolicyBundleAgainstHistory,\n verifyPrincipalPolicyCheckpoint,\n verifyPrincipalPolicyCurrent,\n verifyPrincipalPolicyCurrentMutation,\n verifyPrincipalPolicyCurrentSuccessor,\n verifyPrincipalPolicyHistoryReferences,\n verifyPrincipalPolicySnapshot,\n verifySignedAccessEvent,\n verifySignedTransparencyTreeHead,\n verifyTransparencyConsistencyProof,\n verifyTransparencyInclusionProof,\n verifyTransparencyProof,\n verifyWriteHeader,\n} from \"./keying\";\nexport {\n isValidOrganizationLeaveRequest,\n organizationLeaveRequestSigningBytes,\n signOrganizationLeaveRequest,\n} from \"./organizationLeaveRequest\";\nexport {\n organizationReplacementAuthorizationPayload,\n organizationReplacementSigningBytes,\n signOrganizationReplacementAuthorization,\n type VerifiedOrganizationReplacementAuthorization,\n verifyOrganizationReplacementAuthorization,\n} from \"./organizationReplacement\";\nexport {\n computePrincipalContainerGrantRoot,\n normalizePrincipalContainerGrants,\n} from \"./principalContainerGrants\";\nexport {\n computePrincipalMemberEnvelopesRoot,\n normalizePrincipalStateMemberEnvelopes,\n PrincipalMemberEnvelopeValidationError,\n} from \"./principalMemberEnvelopes\";\nexport type { PrincipalPolicyValidationErrorCode } from \"./principalPolicyValidationError\";\nexport {\n PrincipalPolicyValidationError,\n throwPrincipalPolicyValidationError,\n} from \"./principalPolicyValidationError\";\nexport type {\n ManagedRecipientPrincipalType,\n PrincipalContainerGrant,\n PrincipalContainerGrantAccessLevel,\n PrincipalProjectionMember,\n PrincipalProjectionRole,\n PrincipalStateExternalAuthority,\n PrincipalStateHeaderInput,\n PrincipalStateMember,\n PrincipalStateMemberEnvelope,\n PrincipalStateMembershipMode,\n PrincipalStatePayloadCipherSuite,\n PrincipalStateSigningInput,\n SignedPrincipalState,\n UnsignedPrincipalState,\n} from \"./principalState\";\nexport {\n buildPrincipalStateSigningInput,\n computePrincipalMembershipRoot,\n computePrincipalProjectionRoot,\n computePrincipalStateHash,\n computePrincipalStatePayloadCiphertextHash,\n derivePrincipalProjectionMembers,\n isManagedRecipientPrincipalType,\n isPrincipalProjectionRole,\n normalizePrincipalProjectionMembers,\n normalizePrincipalStateMembers,\n serializeUnsignedPrincipalState,\n signPrincipalState,\n} from \"./principalState\";\nexport {\n verifySignedPrincipalState,\n verifySignedPrincipalStateResult,\n} from \"./principalStateVerification\";\nexport type { SigningKeyPair } from \"./signing/generateKeyPair\";\nexport {\n generateSigningKeyPair,\n generateSigningSeedAndKeyPair,\n ML_DSA87_PUBLIC_KEY_BYTES,\n ML_DSA87_SECRET_KEY_BYTES,\n ML_DSA87_SIGNATURE_BYTES,\n} from \"./signing/generateKeyPair\";\nexport { sign } from \"./signing/sign\";\nexport { verify } from \"./signing/verify\";\nexport type { SymmetricCiphertext } from \"./symmetric\";\nexport {\n AES_256_KEY_BYTES,\n AES_GCM_IV_BYTES,\n AES_GCM_TAG_BYTES,\n assertAesGcmIv,\n createAesGcmIv,\n decryptWithDek,\n encryptWithDek,\n} from \"./symmetric\";\nexport { computeUserIdentityBundleFingerprint } from \"./userIdentityBundle\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B,EAC9B,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,oBAAoB,E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yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { blobContentMetadataHash } from \"./blobContentMetadata\";\nexport { BlobEnvelopeError } from \"./blobEnvelopeError\";\nexport type {\n BlobEnvelopeHeaderRecord,\n BlobEnvelopeRecord,\n} from \"./blobEnvelopeReader\";\nexport {\n MAX_BLOB_ENVELOPE_HEADER_BYTES,\n parseBlobEnvelopeV2,\n parseBlobEnvelopeV2Header,\n readBlobEnvelopeHeaderByteLength,\n} from \"./blobEnvelopeReader\";\nexport type { BlobEnvelopeV2Header } from \"./blobEnvelopeV2\";\nexport {\n BLOB_CHUNK_SIZE_BYTES,\n BLOB_ENCRYPTED_BYTES_FORMAT,\n BLOB_ENCRYPTED_BYTES_VERSION,\n BLOB_ENVELOPE_MAGIC_BYTES,\n BLOB_ENVELOPE_PREFIX_BYTES,\n blobChunkPlaintextByteLength,\n computeBlobChunkCount,\n computeBlobEncryptedByteLength,\n deriveBlobChunkIv,\n encodeBlobEnvelopeV2Header,\n joinBlobPartBytes,\n MAX_BLOB_CHUNK_COUNT,\n normalizeBlobChunkSize,\n} from \"./blobEnvelopeV2\";\nexport { compareCanonicalStrings } from \"./canonicalOrdering\";\nexport {\n AUTH_CHALLENGE_BYTES,\n AUTH_CHALLENGE_HEX_LENGTH,\n authChallengeSigningBytes,\n CHALLENGE_TTL_SECONDS,\n canonicalAuthOrigin,\n generateChallenge,\n} from \"./challenge\";\nexport type {\n ContentKeyEnvelopeKind,\n ContentKeyWrapBinding,\n} from \"./contentKeyEnvelope\";\nexport {\n ContentKeyEnvelopeError,\n decodeContentKeyEnvelope,\n unwrapContentKey,\n wrapContentKey,\n} from \"./contentKeyEnvelope\";\nexport { decryptAsRecipient } from \"./encapsulation/decryptAsRecipient\";\nexport { encryptForRecipients } from \"./encapsulation/encryptForRecipients\";\nexport type { EncapsulationKeyPair } from \"./encapsulation/generateKeyPair\";\nexport {\n generateKemKeyPair,\n generateKemSeedAndKeyPair,\n ML_KEM1024_CIPHERTEXT_BYTES,\n ML_KEM1024_PUBLIC_KEY_BYTES,\n ML_KEM1024_SECRET_KEY_BYTES,\n ML_KEM1024_SEED_BYTES,\n} from \"./encapsulation/generateKeyPair\";\nexport type { EncryptedEnvelope, RecipientEntry } from \"./encapsulation/types\";\nexport { unwrapDek } from \"./encapsulation/unwrapDek\";\nexport { wrapDekForRecipients } from \"./encapsulation/wrapDek\";\nexport { toFingerprint } from \"./fingerprint\";\nexport {\n decryptGroupMetadata,\n encodeBuiltinGroupMetadata,\n encryptGroupMetadata,\n type GroupMetadata,\n type GroupMetadataKey,\n readGroupMetadata,\n} from \"./groupMetadata\";\nexport { bytesToHex, hexToBytes } from \"./hex\";\nexport {\n createIdentitySeedPhrase,\n createIdentitySeedPhraseFromEntropy,\n generateIdentityKeyPairsFromSeedPhrase,\n IDENTITY_SEED_PHRASE_DERIVATION_SUITE,\n IDENTITY_SEED_PHRASE_ENTROPY_BYTES,\n IDENTITY_SEED_PHRASE_STRENGTH_BITS,\n IDENTITY_SEED_PHRASE_WORDS,\n type IdentitySeedPhraseKeyPairs,\n normalizeIdentitySeedPhrase,\n validateIdentitySeedPhrase,\n} from \"./identitySeedPhrase\";\nexport { canonicalIdentityTrustDomain } from \"./identityTrustDomain\";\nexport {\n createIncrementalSha256,\n type IncrementalSha256,\n} from \"./incrementalSha256\";\nexport type {\n AccessEvent,\n AccessEventType,\n AccessManifest,\n AccessManifestCheckpoint,\n AccessManifestTransparencyLeaf,\n AccessObjectKind,\n AnyVerifiedAccessManifest,\n AnyVerifiedPrincipalPolicy,\n AttachmentAccessEventBody,\n AttachmentBindAccessEventBody,\n AttachmentDetachAccessEventBody,\n BlobAccessManifest,\n BlobContentKeyTarget,\n ContainerAccessEventBody,\n ContainerAccessKeyState,\n ContainerAccessLevel,\n ContainerAccessManifest,\n ContainerAccessManifestState,\n ContainerAccessStructural,\n ContainerCreateAccessEventBody,\n ContainerDirectGrant,\n ContainerGrantAccessEventBody,\n ContainerGrantPrincipalHead,\n ContainerGrantSubjectType,\n ContainerKekKeyring,\n ContainerKekKeyringEntry,\n ContainerKekParentBinding,\n ContainerKekPredecessorBridge,\n ContainerKekRecipientTarget,\n ContainerKekTarget,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerMoveAccessEventBody,\n ContainerReciteAccessEventBody,\n ContainerRekeyAccessEventBody,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n ContentObjectKind,\n ContentRecordEncryptionSuite,\n ContentRecordNonceDomain,\n DeriveBlobKekTargetsInput,\n DeriveContainerKekRecipientTargetsInput,\n DeriveDocumentKekTargetsInput,\n DocumentAccessEventBody,\n DocumentContentKeyTarget,\n DocumentContentRecordMetadataInput,\n DocumentLinkAccessEventBody,\n DocumentLinkSetManifestState,\n DocumentLinkSetStructural,\n DocumentPurgeAccessEventBody,\n DocumentUnlinkAccessEventBody,\n IdentityStateCheckpoint,\n IdentityStateHead,\n IdentityStateTransparencyLeaf,\n KekRecipientKind,\n KeyingCanonicalJson,\n KeyingHashDomain,\n KeyingLocalCheckpointStore,\n KeyingVerificationCode,\n KeyingVerificationResult,\n ManagedPrincipalKind,\n PrincipalHistoryIndexNode,\n PrincipalHistorySigner,\n PrincipalPolicyAuthorization,\n PrincipalPolicyBundle,\n PrincipalPolicyCheckpoint,\n PrincipalPolicyCurrent,\n PrincipalPolicyExternalAuthority,\n PrincipalPolicyExternalAuthorityState,\n PrincipalPolicyHistoryInput,\n PrincipalPolicyHistoryPage,\n PrincipalPolicyHistoryProgressOptions,\n PrincipalPolicyHistoryReferenceProof,\n PrincipalPolicyHistoryVerifier,\n PrincipalPolicyMemberEnvelopes,\n PrincipalPolicyPayload,\n PrincipalPolicySignedState,\n PrincipalPolicySignerPublicKey,\n PrincipalPolicySnapshot,\n PrincipalPolicyStateChainEntry,\n PrincipalPolicyTransitionMismatch,\n PrincipalPolicyTransitionMismatchCode,\n PrincipalPolicyTransparencyLeaf,\n ReferencedPrincipalHead,\n SignedTransparencyTreeHead,\n TransparencyConsistencyProof,\n TransparencyInclusionProof,\n TransparencyLeaf,\n TransparencyLeafKind,\n TransparencyTreeCheckpoint,\n UnsignedAccessEvent,\n UnsignedTransparencyTreeHead,\n UnsignedWriteHeader,\n VerifiedAccessEvent,\n VerifiedAccessManifest,\n VerifiedAccessManifestCheckpointEvidence,\n VerifiedAccessManifestSnapshot,\n VerifiedAttachmentBinding,\n VerifiedAttachmentDetach,\n VerifiedBlobKekTargets,\n VerifiedContainerAccessManifest,\n VerifiedContainerKekState,\n VerifiedContainerParentEdge,\n VerifiedDocumentKekTargets,\n VerifiedDocumentLinkSetManifest,\n VerifiedDocumentLinkSetSnapshot,\n VerifiedDocumentLinkSetStateEvidence,\n VerifiedIdentityState,\n VerifiedPrincipalPolicy,\n VerifiedPrincipalPolicyCurrent,\n VerifiedPrincipalPolicyHistory,\n VerifiedPrincipalPolicySelection,\n VerifiedPrincipalPolicySnapshot,\n VerifiedTransparencyProof,\n VerifiedTransparencyTreeHead,\n VerifiedWriteHeader,\n VerifyAccessEventInput,\n VerifyAccessManifestInput,\n VerifyAttachmentBindingEventInput,\n VerifyAttachmentDetachEventInput,\n VerifyContainerAccessManifestInput,\n VerifyContainerKekStateInput,\n VerifyContainerParentEdgeInput,\n VerifyDocumentLinkSetManifestInput,\n VerifyDocumentPurgeEventInput,\n VerifyIdentityStateCheckpointInput,\n VerifyPrincipalPolicyBundleInput,\n VerifyPrincipalPolicySnapshotInput,\n VerifySignedTransparencyTreeHeadInput,\n VerifyTransparencyConsistencyProofInput,\n VerifyTransparencyInclusionProofInput,\n VerifyTransparencyProofInput,\n VerifyWriteHeaderInput,\n WriteHeader,\n} from \"./keying\";\nexport {\n ACCESS_MANIFEST_VERIFICATION_REVISION,\n accessManifestCheckpointFromManifest,\n accessManifestTransparencyLeaf,\n assertSealedContainerKekKeyringLength,\n BLOB_CONTENT_KEY_WRAP_SUITE,\n CONTAINER_KEK_KEYRING_ENTRY_BYTES,\n CONTAINER_KEK_KEYRING_FORMAT_VERSION,\n CONTAINER_KEK_KEYRING_HEADER_BYTES,\n CONTAINER_KEK_KEYRING_SEAL_SUITE,\n CONTAINER_KEK_MATERIAL_ID_PREFIX,\n CONTAINER_KEK_PARENT_WRAP_SUITE,\n CONTAINER_KEK_PREDECESSOR_WRAP_SUITE,\n CONTAINER_KEK_USER_WRAP_SUITE,\n CONTENT_RECORD_ENCRYPTION_SUITE,\n computeAccessEventBodyHash,\n computeAccessEventHash,\n computeAccessManifestBundleDigest,\n computeAccessManifestHash,\n computeBlobAccessManifestHash,\n computeBlobContentKeyTargetHash,\n computeContainerAccessKeyTargetHash,\n computeContainerAccessStructuralHash,\n computeContainerDirectGrantRoot,\n computeContainerKekKeyringHash,\n computeContainerKekLevelDigest,\n computeContainerKekMaterialId,\n computeContainerKekPredecessorBridgeHash,\n computeContainerKekRecipientTargetHash,\n computeContainerKeyEpochHash,\n computeContentRecordNonceDomainHash,\n computeDocumentContentKeyTargetHash,\n computeDocumentContentRecordCiphertextHash,\n computeDocumentContentRecordMetadataHash,\n computeDocumentContentRecordPlaintextHash,\n computeDocumentLinkSetGrantRoot,\n computeDocumentLinkSetKeyTargetHash,\n computeDocumentLinkSetStructuralHash,\n computeKeyingDomainHash,\n computeTransparencyLeafHash,\n computeTransparencyMerkleRoot,\n computeWriteHeaderHash,\n createContainerKekPredecessorBridge,\n createPrincipalHistoryIndexProof,\n createPrincipalPolicyHistoryVerifier,\n createTransparencyConsistencyProof,\n createTransparencyInclusionProof,\n DOCUMENT_CONTENT_KEY_WRAP_SUITE,\n deriveBlobKekTargets,\n deriveContainerAccessManifest,\n deriveContainerKekRecipientTargets,\n deriveContainerKekWrappingPublicKey,\n deriveDocumentKekTargets,\n deriveDocumentLinkSetManifest,\n derivePrincipalRecipientKeyEpochId,\n documentContentRecordMetadata,\n expectedSealedContainerKekKeyringBytes,\n getPrincipalPolicyTransitionMismatch,\n getPrincipalPolicyTransitionMismatchReason,\n identityStateTransparencyLeaf,\n isContainerKekMaterialId,\n isKeyingCanonicalJson,\n isKeyingVerificationCode,\n KEYING_VERIFICATION_CODES,\n KeyingVerificationError,\n largestPowerOfTwoLessThan,\n MAX_CONTAINER_KEY_EPOCH,\n MAX_CONTAINER_RECITATION_EPOCH,\n makeVerifiedAccessEvent,\n makeVerifiedBlobKekTargets,\n makeVerifiedContainerAccessManifest,\n makeVerifiedContainerKekState,\n makeVerifiedDocumentKekTargets,\n makeVerifiedDocumentLinkSetManifest,\n makeVerifiedDocumentLinkSetSnapshot,\n makeVerifiedPrincipalPolicy,\n normalizeAttachmentAccessEventBody,\n normalizeContainerAccessEventBody,\n normalizeContainerKekKeyring,\n normalizeContainerKekPredecessorBridge,\n normalizeDocumentAccessEventBody,\n normalizeDocumentPurgeAccessEventBody,\n openContainerKekKeyring,\n PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT,\n PRINCIPAL_HISTORY_VERIFICATION_REVISION,\n principalHistoryIndexLeaf,\n principalPolicyMatchesReference,\n principalPolicyTransparencyLeaf,\n readKeyingCanonicalJson,\n resolveContainerPathUserAccessLevel,\n resolveContainerStatePathUserAccessLevel,\n resolveHistoricalContainerPathUserAccessLevel,\n resolvePrincipalHistoryIndexProof,\n restorePrincipalPolicyHistoryVerifier,\n sealContainerKekKeyring,\n selectPrincipalPolicyAuthorization,\n selectPrincipalPolicyCurrentPredecessorReferences,\n serializeKeyingCanonicalJson,\n signAccessEvent,\n signTransparencyTreeHead,\n signWriteHeader,\n unwrapContainerKekParentWrap,\n unwrapContainerKekPredecessorBridge,\n verifyAccessManifest,\n verifyAccessManifestLocalCheckpoint,\n verifyAccessManifestSnapshot,\n verifyAttachmentBindingEvent,\n verifyAttachmentDetachEvent,\n verifyContainerAccessManifest,\n verifyContainerKekKeyringEntry,\n verifyContainerKekState,\n verifyContainerParentEdge,\n verifyDocumentLinkSetManifest,\n verifyDocumentLinkSetSnapshot,\n verifyDocumentPurgeEvent,\n verifyIdentityStateCheckpoint,\n verifyPrincipalPolicyBundle,\n verifyPrincipalPolicyBundleAgainstHistory,\n verifyPrincipalPolicyCheckpoint,\n verifyPrincipalPolicyCurrent,\n verifyPrincipalPolicyCurrentMutation,\n verifyPrincipalPolicyCurrentSuccessor,\n verifyPrincipalPolicyHistoryReferences,\n verifyPrincipalPolicySnapshot,\n verifySignedAccessEvent,\n verifySignedTransparencyTreeHead,\n verifyTransparencyConsistencyProof,\n verifyTransparencyInclusionProof,\n verifyTransparencyProof,\n verifyWriteHeader,\n} from \"./keying\";\nexport {\n isValidOrganizationLeaveRequest,\n organizationLeaveRequestSigningBytes,\n signOrganizationLeaveRequest,\n} from \"./organizationLeaveRequest\";\nexport {\n organizationReplacementAuthorizationPayload,\n organizationReplacementSigningBytes,\n signOrganizationReplacementAuthorization,\n type VerifiedOrganizationReplacementAuthorization,\n verifyOrganizationReplacementAuthorization,\n} from \"./organizationReplacement\";\nexport {\n computePrincipalContainerGrantRoot,\n normalizePrincipalContainerGrants,\n} from \"./principalContainerGrants\";\nexport {\n computePrincipalMemberEnvelopesRoot,\n normalizePrincipalStateMemberEnvelopes,\n PrincipalMemberEnvelopeValidationError,\n} from \"./principalMemberEnvelopes\";\nexport type { PrincipalPolicyValidationErrorCode } from \"./principalPolicyValidationError\";\nexport {\n PrincipalPolicyValidationError,\n throwPrincipalPolicyValidationError,\n} from \"./principalPolicyValidationError\";\nexport type {\n ManagedRecipientPrincipalType,\n PrincipalContainerGrant,\n PrincipalContainerGrantAccessLevel,\n PrincipalProjectionMember,\n PrincipalProjectionRole,\n PrincipalStateExternalAuthority,\n PrincipalStateHeaderInput,\n PrincipalStateMember,\n PrincipalStateMemberEnvelope,\n PrincipalStateMembershipMode,\n PrincipalStateSigningInput,\n SignedPrincipalState,\n UnsignedPrincipalState,\n} from \"./principalState\";\nexport {\n buildPrincipalStateSigningInput,\n computePrincipalMembershipRoot,\n computePrincipalProjectionRoot,\n computePrincipalStateHash,\n computePrincipalStatePayloadCiphertextHash,\n derivePrincipalProjectionMembers,\n isManagedRecipientPrincipalType,\n isPrincipalProjectionRole,\n normalizePrincipalProjectionMembers,\n normalizePrincipalStateMembers,\n serializeUnsignedPrincipalState,\n signPrincipalState,\n} from \"./principalState\";\nexport {\n verifySignedPrincipalState,\n verifySignedPrincipalStateResult,\n} from \"./principalStateVerification\";\nexport type { SigningKeyPair } from \"./signing/generateKeyPair\";\nexport {\n generateSigningKeyPair,\n generateSigningSeedAndKeyPair,\n ML_DSA87_PUBLIC_KEY_BYTES,\n ML_DSA87_SECRET_KEY_BYTES,\n ML_DSA87_SIGNATURE_BYTES,\n} from \"./signing/generateKeyPair\";\nexport { sign } from \"./signing/sign\";\nexport { verify } from \"./signing/verify\";\nexport type { SymmetricCiphertext } from \"./symmetric\";\nexport {\n AES_256_KEY_BYTES,\n AES_GCM_IV_BYTES,\n AES_GCM_TAG_BYTES,\n assertAesGcmIv,\n createAesGcmIv,\n decryptWithDek,\n encryptWithDek,\n} from \"./symmetric\";\nexport { computeUserIdentityBundleFingerprint } from \"./userIdentityBundle\";\n"]}
@@ -1,19 +1,9 @@
1
1
  import { computePrincipalStatePayloadCiphertextHash } from "../principalState.js";
2
2
  import { throwVerification } from "./shared.js";
3
+ /** The payload's ciphertext hashes to the state's signed commitment. */
3
4
  export async function verifyPrincipalPolicyPayload(input) {
4
5
  const { currentPayload, currentState } = input.bundle;
5
- if (currentPayload.principalType !== currentState.principalType ||
6
- currentPayload.principalId !== currentState.principalId) {
7
- throwVerification("object_mismatch", "principal policy payload does not match current state principal");
8
- }
9
- if (currentPayload.stateHash !== currentState.stateHash) {
10
- throwVerification("hash_mismatch", "principal policy payload state hash does not match current state");
11
- }
12
- const computedPayloadHash = await computePrincipalStatePayloadCiphertextHash(currentPayload.ciphertext);
13
- if (computedPayloadHash !== currentPayload.ciphertextHash) {
14
- throwVerification("hash_mismatch", "principal policy payload hash does not match ciphertext");
15
- }
16
- if (computedPayloadHash !== currentState.payloadCiphertextHash) {
6
+ if ((await computePrincipalStatePayloadCiphertextHash(currentPayload.ciphertext)) !== currentState.payloadCiphertextHash) {
17
7
  throwVerification("hash_mismatch", "principal policy payload hash does not match current state");
18
8
  }
19
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyPayload.js","sourceRoot":"","sources":["principalPolicyPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0CAA0C,EAAE,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,KAKlD;IACC,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAEtD,IACE,cAAc,CAAC,aAAa,KAAK,YAAY,CAAC,aAAa;QAC3D,cAAc,CAAC,WAAW,KAAK,YAAY,CAAC,WAAW,EACvD,CAAC;QACD,iBAAiB,CACf,iBAAiB,EACjB,iEAAiE,CAClE,CAAC;IACJ,CAAC;IAED,IAAI,cAAc,CAAC,SAAS,KAAK,YAAY,CAAC,SAAS,EAAE,CAAC;QACxD,iBAAiB,CACf,eAAe,EACf,kEAAkE,CACnE,CAAC;IACJ,CAAC;IAED,MAAM,mBAAmB,GAAG,MAAM,0CAA0C,CAC1E,cAAc,CAAC,UAAU,CAC1B,CAAC;IAEF,IAAI,mBAAmB,KAAK,cAAc,CAAC,cAAc,EAAE,CAAC;QAC1D,iBAAiB,CACf,eAAe,EACf,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,IAAI,mBAAmB,KAAK,YAAY,CAAC,qBAAqB,EAAE,CAAC;QAC/D,iBAAiB,CACf,eAAe,EACf,4DAA4D,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { computePrincipalStatePayloadCiphertextHash } from \"../principalState\";\nimport type { PrincipalPolicyBundle } from \"./principalPolicyTypes\";\nimport { throwVerification } from \"./shared\";\n\nexport async function verifyPrincipalPolicyPayload(input: {\n readonly bundle: Pick<\n PrincipalPolicyBundle,\n \"currentState\" | \"currentPayload\"\n >;\n}): Promise<void> {\n const { currentPayload, currentState } = input.bundle;\n\n if (\n currentPayload.principalType !== currentState.principalType ||\n currentPayload.principalId !== currentState.principalId\n ) {\n throwVerification(\n \"object_mismatch\",\n \"principal policy payload does not match current state principal\",\n );\n }\n\n if (currentPayload.stateHash !== currentState.stateHash) {\n throwVerification(\n \"hash_mismatch\",\n \"principal policy payload state hash does not match current state\",\n );\n }\n\n const computedPayloadHash = await computePrincipalStatePayloadCiphertextHash(\n currentPayload.ciphertext,\n );\n\n if (computedPayloadHash !== currentPayload.ciphertextHash) {\n throwVerification(\n \"hash_mismatch\",\n \"principal policy payload hash does not match ciphertext\",\n );\n }\n\n if (computedPayloadHash !== currentState.payloadCiphertextHash) {\n throwVerification(\n \"hash_mismatch\",\n \"principal policy payload hash does not match current state\",\n );\n }\n}\n"]}
1
+ {"version":3,"file":"principalPolicyPayload.js","sourceRoot":"","sources":["principalPolicyPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0CAA0C,EAAE,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,KAKlD;IACC,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IACtD,IACE,CAAC,MAAM,0CAA0C,CAC/C,cAAc,CAAC,UAAU,CAC1B,CAAC,KAAK,YAAY,CAAC,qBAAqB,EACzC,CAAC;QACD,iBAAiB,CACf,eAAe,EACf,4DAA4D,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { computePrincipalStatePayloadCiphertextHash } from \"../principalState\";\nimport type { PrincipalPolicyBundle } from \"./principalPolicyTypes\";\nimport { throwVerification } from \"./shared\";\n\n/** The payload's ciphertext hashes to the state's signed commitment. */\nexport async function verifyPrincipalPolicyPayload(input: {\n readonly bundle: Pick<\n PrincipalPolicyBundle,\n \"currentState\" | \"currentPayload\"\n >;\n}): Promise<void> {\n const { currentPayload, currentState } = input.bundle;\n if (\n (await computePrincipalStatePayloadCiphertextHash(\n currentPayload.ciphertext,\n )) !== currentState.payloadCiphertextHash\n ) {\n throwVerification(\n \"hash_mismatch\",\n \"principal policy payload hash does not match current state\",\n );\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { PrincipalContainerGrant, PrincipalProjectionMember, PrincipalStateMemberEnvelope, PrincipalStatePayloadCipherSuite, SignedPrincipalState } from "../principalState.js";
1
+ import type { PrincipalContainerGrant, PrincipalProjectionMember, PrincipalStateMemberEnvelope, SignedPrincipalState } from "../principalState.js";
2
2
  import type { PrincipalPolicyExternalAuthority } from "./principalPolicyExternalAuthorityTypes.js";
3
3
  export type ManagedPrincipalKind = "group" | "organization";
4
4
  export interface ReferencedPrincipalHead {
@@ -23,13 +23,12 @@ export interface PrincipalPolicyStateChainEntry {
23
23
  readonly projection: readonly PrincipalProjectionMember[];
24
24
  readonly grants: readonly PrincipalContainerGrant[];
25
25
  }
26
+ /**
27
+ * Only the ciphertext: it travels beside its state, whose signed
28
+ * `payloadCiphertextHash` commits to it (#2903 P23).
29
+ */
26
30
  export interface PrincipalPolicyPayload {
27
- readonly principalType: ManagedPrincipalKind;
28
- readonly principalId: string;
29
- readonly stateHash: string;
30
- readonly cipherSuite: PrincipalStatePayloadCipherSuite;
31
31
  readonly ciphertext: string;
32
- readonly ciphertextHash: string;
33
32
  }
34
33
  export interface PrincipalPolicyMemberEnvelopes {
35
34
  readonly principalType: ManagedPrincipalKind;
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyTypes.js","sourceRoot":"","sources":["principalPolicyTypes.ts"],"names":[],"mappings":"AAiGA,MAAM,4BAA4B,GAAkB,MAAM,CACxD,yBAAyB,CAC1B,CAAC;AACF,MAAM,oCAAoC,GAAkB,MAAM,EAAE,CAAC;AAwCrE,MAAM,oBAAoB,GAAkB,MAAM,CAChD,gCAAgC,CACjC,CAAC;AAoBF,MAAM,sBAAsB,GAAkB,MAAM,CAClD,kCAAkC,CACnC,CAAC;AA0BF,MAAM,UAAU,2BAA2B,CACzC,KAAyE;IAEzE,OAAO;QACL,GAAG,KAAK;QACR,CAAC,4BAA4B,CAAC,EAAE,IAAI;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAGC;IAED,OAAO;QACL,GAAG,KAAK;QACR,CAAC,oCAAoC,CAAC,EAAE,IAAI;KAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,KAAwE;IAExE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,KAA4E;IAE5E,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import type {\n PrincipalContainerGrant,\n PrincipalProjectionMember,\n PrincipalStateMemberEnvelope,\n PrincipalStatePayloadCipherSuite,\n SignedPrincipalState,\n} from \"../principalState\";\nimport type { PrincipalPolicyExternalAuthority } from \"./principalPolicyExternalAuthorityTypes\";\n\nexport type ManagedPrincipalKind = \"group\" | \"organization\";\n\nexport interface ReferencedPrincipalHead {\n principalType: ManagedPrincipalKind;\n principalId: string;\n version: number;\n keyEpoch: number;\n stateHash: string;\n keyFingerprint: string;\n}\n\nexport interface PrincipalPolicyCheckpoint {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly version: number;\n readonly stateHash: string;\n}\n\nexport interface PrincipalPolicySignedState extends SignedPrincipalState {\n readonly stateHash: string;\n}\n\nexport interface PrincipalPolicyStateChainEntry {\n readonly state: PrincipalPolicySignedState;\n readonly projection: readonly PrincipalProjectionMember[];\n readonly grants: readonly PrincipalContainerGrant[];\n}\n\nexport interface PrincipalPolicyPayload {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly stateHash: string;\n readonly cipherSuite: PrincipalStatePayloadCipherSuite;\n readonly ciphertext: string;\n readonly ciphertextHash: string;\n}\n\nexport interface PrincipalPolicyMemberEnvelopes {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly stateHash: string;\n readonly epoch: number;\n readonly envelopes: readonly PrincipalStateMemberEnvelope[];\n}\n\nexport interface PrincipalPolicyBundle {\n readonly currentState: PrincipalPolicySignedState;\n readonly currentPayload: PrincipalPolicyPayload;\n readonly currentProjection: readonly PrincipalProjectionMember[];\n readonly currentGrants: readonly PrincipalContainerGrant[];\n readonly currentMemberEnvelopes: PrincipalPolicyMemberEnvelopes;\n readonly previousStates: readonly PrincipalPolicyStateChainEntry[];\n}\n\nexport interface PrincipalPolicySnapshot {\n readonly currentState: PrincipalPolicySignedState;\n readonly currentProjection: readonly PrincipalProjectionMember[];\n readonly currentGrants: readonly PrincipalContainerGrant[];\n readonly previousStates: readonly PrincipalPolicyStateChainEntry[];\n}\n\nexport interface PrincipalPolicySignerPublicKey {\n readonly userId: string;\n readonly signingKeyFingerprint: string;\n readonly signingPublicKey: Uint8Array;\n}\n\nexport interface VerifyPrincipalPolicyBundleInput {\n readonly bundle: PrincipalPolicyBundle;\n readonly externalAuthority?: PrincipalPolicyExternalAuthority;\n readonly expectedReference?: ReferencedPrincipalHead;\n readonly localCheckpoint?: PrincipalPolicyCheckpoint | null;\n readonly signerPublicKeys: readonly PrincipalPolicySignerPublicKey[];\n}\n\nexport interface VerifyPrincipalPolicySnapshotInput {\n readonly snapshot: PrincipalPolicySnapshot;\n readonly externalAuthority?: PrincipalPolicyExternalAuthority;\n readonly expectedReference?: ReferencedPrincipalHead;\n readonly signerPublicKeys: readonly PrincipalPolicySignerPublicKey[];\n}\n\nexport interface NormalizedPrincipalPolicyStateChainEntry {\n readonly state: PrincipalPolicySignedState;\n readonly projection: PrincipalProjectionMember[];\n readonly grants: PrincipalContainerGrant[];\n}\n\nconst verifiedPrincipalPolicyBrand: unique symbol = Symbol(\n \"verifiedPrincipalPolicy\",\n);\nconst verifiedPrincipalPolicySnapshotBrand: unique symbol = Symbol();\n\nexport interface VerifiedPrincipalPolicy {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly version: number;\n readonly keyEpoch: number;\n readonly stateHash: string;\n readonly state: PrincipalPolicySignedState;\n readonly projection: PrincipalProjectionMember[];\n readonly grants: PrincipalContainerGrant[];\n readonly history?: readonly NormalizedPrincipalPolicyStateChainEntry[];\n readonly checkpoint: PrincipalPolicyCheckpoint;\n readonly [verifiedPrincipalPolicyBrand]: true;\n}\n\nexport interface VerifiedPrincipalPolicySnapshot {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly version: number;\n readonly keyEpoch: number;\n readonly stateHash: string;\n readonly state: PrincipalPolicySignedState;\n readonly projection: PrincipalProjectionMember[];\n readonly grants: PrincipalContainerGrant[];\n readonly history: readonly NormalizedPrincipalPolicyStateChainEntry[];\n readonly checkpoint: PrincipalPolicyCheckpoint;\n readonly [verifiedPrincipalPolicySnapshotBrand]: true;\n}\n\nexport type AnyVerifiedPrincipalPolicy =\n | VerifiedPrincipalPolicy\n | VerifiedPrincipalPolicySnapshot;\n\n/** Current artifacts whose authorization history is delivered separately. */\nexport type PrincipalPolicyCurrent = Omit<\n PrincipalPolicyBundle,\n \"previousStates\"\n>;\n\nconst verifiedCurrentBrand: unique symbol = Symbol(\n \"verifiedPrincipalPolicyCurrent\",\n);\n\n/** Verified current artifacts and selected history, never a full-chain policy. */\nexport interface VerifiedPrincipalPolicyCurrent\n extends Pick<\n VerifiedPrincipalPolicy,\n | \"principalType\"\n | \"principalId\"\n | \"version\"\n | \"keyEpoch\"\n | \"stateHash\"\n | \"state\"\n | \"projection\"\n | \"grants\"\n | \"checkpoint\"\n > {\n readonly [verifiedCurrentBrand]: true;\n readonly retainedHistory: NonNullable<VerifiedPrincipalPolicy[\"history\"]>;\n}\n\nconst verifiedSelectionBrand: unique symbol = Symbol(\n \"verifiedPrincipalPolicySelection\",\n);\n\n/** Public authorization only; neither full history nor current key material. */\nexport interface VerifiedPrincipalPolicySelection\n extends Pick<\n VerifiedPrincipalPolicyCurrent,\n | \"principalType\"\n | \"principalId\"\n | \"version\"\n | \"keyEpoch\"\n | \"stateHash\"\n | \"state\"\n | \"projection\"\n | \"grants\"\n | \"checkpoint\"\n | \"retainedHistory\"\n > {\n readonly [verifiedSelectionBrand]: true;\n}\n\n/** Exact membership and explicitly retained citations for authorization. */\nexport type PrincipalPolicyAuthorization =\n | AnyVerifiedPrincipalPolicy\n | VerifiedPrincipalPolicyCurrent\n | VerifiedPrincipalPolicySelection;\n\nexport function makeVerifiedPrincipalPolicy(\n value: Omit<VerifiedPrincipalPolicy, typeof verifiedPrincipalPolicyBrand>,\n): VerifiedPrincipalPolicy {\n return {\n ...value,\n [verifiedPrincipalPolicyBrand]: true,\n };\n}\n\nexport function makeVerifiedPrincipalPolicySnapshot(\n value: Omit<\n VerifiedPrincipalPolicySnapshot,\n typeof verifiedPrincipalPolicySnapshotBrand\n >,\n): VerifiedPrincipalPolicySnapshot {\n return {\n ...value,\n [verifiedPrincipalPolicySnapshotBrand]: true,\n };\n}\n\nexport function makeVerifiedPrincipalPolicyCurrent(\n value: Omit<VerifiedPrincipalPolicyCurrent, typeof verifiedCurrentBrand>,\n): VerifiedPrincipalPolicyCurrent {\n return { ...value, [verifiedCurrentBrand]: true };\n}\n\nexport function makeVerifiedPrincipalPolicySelection(\n value: Omit<VerifiedPrincipalPolicySelection, typeof verifiedSelectionBrand>,\n): VerifiedPrincipalPolicySelection {\n return { ...value, [verifiedSelectionBrand]: true };\n}\n"]}
1
+ {"version":3,"file":"principalPolicyTypes.js","sourceRoot":"","sources":["principalPolicyTypes.ts"],"names":[],"mappings":"AA+FA,MAAM,4BAA4B,GAAkB,MAAM,CACxD,yBAAyB,CAC1B,CAAC;AACF,MAAM,oCAAoC,GAAkB,MAAM,EAAE,CAAC;AAwCrE,MAAM,oBAAoB,GAAkB,MAAM,CAChD,gCAAgC,CACjC,CAAC;AAoBF,MAAM,sBAAsB,GAAkB,MAAM,CAClD,kCAAkC,CACnC,CAAC;AA0BF,MAAM,UAAU,2BAA2B,CACzC,KAAyE;IAEzE,OAAO;QACL,GAAG,KAAK;QACR,CAAC,4BAA4B,CAAC,EAAE,IAAI;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAGC;IAED,OAAO;QACL,GAAG,KAAK;QACR,CAAC,oCAAoC,CAAC,EAAE,IAAI;KAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,KAAwE;IAExE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,KAA4E;IAE5E,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import type {\n PrincipalContainerGrant,\n PrincipalProjectionMember,\n PrincipalStateMemberEnvelope,\n SignedPrincipalState,\n} from \"../principalState\";\nimport type { PrincipalPolicyExternalAuthority } from \"./principalPolicyExternalAuthorityTypes\";\n\nexport type ManagedPrincipalKind = \"group\" | \"organization\";\n\nexport interface ReferencedPrincipalHead {\n principalType: ManagedPrincipalKind;\n principalId: string;\n version: number;\n keyEpoch: number;\n stateHash: string;\n keyFingerprint: string;\n}\n\nexport interface PrincipalPolicyCheckpoint {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly version: number;\n readonly stateHash: string;\n}\n\nexport interface PrincipalPolicySignedState extends SignedPrincipalState {\n readonly stateHash: string;\n}\n\nexport interface PrincipalPolicyStateChainEntry {\n readonly state: PrincipalPolicySignedState;\n readonly projection: readonly PrincipalProjectionMember[];\n readonly grants: readonly PrincipalContainerGrant[];\n}\n\n/**\n * Only the ciphertext: it travels beside its state, whose signed\n * `payloadCiphertextHash` commits to it (#2903 P23).\n */\nexport interface PrincipalPolicyPayload {\n readonly ciphertext: string;\n}\n\nexport interface PrincipalPolicyMemberEnvelopes {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly stateHash: string;\n readonly epoch: number;\n readonly envelopes: readonly PrincipalStateMemberEnvelope[];\n}\n\nexport interface PrincipalPolicyBundle {\n readonly currentState: PrincipalPolicySignedState;\n readonly currentPayload: PrincipalPolicyPayload;\n readonly currentProjection: readonly PrincipalProjectionMember[];\n readonly currentGrants: readonly PrincipalContainerGrant[];\n readonly currentMemberEnvelopes: PrincipalPolicyMemberEnvelopes;\n readonly previousStates: readonly PrincipalPolicyStateChainEntry[];\n}\n\nexport interface PrincipalPolicySnapshot {\n readonly currentState: PrincipalPolicySignedState;\n readonly currentProjection: readonly PrincipalProjectionMember[];\n readonly currentGrants: readonly PrincipalContainerGrant[];\n readonly previousStates: readonly PrincipalPolicyStateChainEntry[];\n}\n\nexport interface PrincipalPolicySignerPublicKey {\n readonly userId: string;\n readonly signingKeyFingerprint: string;\n readonly signingPublicKey: Uint8Array;\n}\n\nexport interface VerifyPrincipalPolicyBundleInput {\n readonly bundle: PrincipalPolicyBundle;\n readonly externalAuthority?: PrincipalPolicyExternalAuthority;\n readonly expectedReference?: ReferencedPrincipalHead;\n readonly localCheckpoint?: PrincipalPolicyCheckpoint | null;\n readonly signerPublicKeys: readonly PrincipalPolicySignerPublicKey[];\n}\n\nexport interface VerifyPrincipalPolicySnapshotInput {\n readonly snapshot: PrincipalPolicySnapshot;\n readonly externalAuthority?: PrincipalPolicyExternalAuthority;\n readonly expectedReference?: ReferencedPrincipalHead;\n readonly signerPublicKeys: readonly PrincipalPolicySignerPublicKey[];\n}\n\nexport interface NormalizedPrincipalPolicyStateChainEntry {\n readonly state: PrincipalPolicySignedState;\n readonly projection: PrincipalProjectionMember[];\n readonly grants: PrincipalContainerGrant[];\n}\n\nconst verifiedPrincipalPolicyBrand: unique symbol = Symbol(\n \"verifiedPrincipalPolicy\",\n);\nconst verifiedPrincipalPolicySnapshotBrand: unique symbol = Symbol();\n\nexport interface VerifiedPrincipalPolicy {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly version: number;\n readonly keyEpoch: number;\n readonly stateHash: string;\n readonly state: PrincipalPolicySignedState;\n readonly projection: PrincipalProjectionMember[];\n readonly grants: PrincipalContainerGrant[];\n readonly history?: readonly NormalizedPrincipalPolicyStateChainEntry[];\n readonly checkpoint: PrincipalPolicyCheckpoint;\n readonly [verifiedPrincipalPolicyBrand]: true;\n}\n\nexport interface VerifiedPrincipalPolicySnapshot {\n readonly principalType: ManagedPrincipalKind;\n readonly principalId: string;\n readonly version: number;\n readonly keyEpoch: number;\n readonly stateHash: string;\n readonly state: PrincipalPolicySignedState;\n readonly projection: PrincipalProjectionMember[];\n readonly grants: PrincipalContainerGrant[];\n readonly history: readonly NormalizedPrincipalPolicyStateChainEntry[];\n readonly checkpoint: PrincipalPolicyCheckpoint;\n readonly [verifiedPrincipalPolicySnapshotBrand]: true;\n}\n\nexport type AnyVerifiedPrincipalPolicy =\n | VerifiedPrincipalPolicy\n | VerifiedPrincipalPolicySnapshot;\n\n/** Current artifacts whose authorization history is delivered separately. */\nexport type PrincipalPolicyCurrent = Omit<\n PrincipalPolicyBundle,\n \"previousStates\"\n>;\n\nconst verifiedCurrentBrand: unique symbol = Symbol(\n \"verifiedPrincipalPolicyCurrent\",\n);\n\n/** Verified current artifacts and selected history, never a full-chain policy. */\nexport interface VerifiedPrincipalPolicyCurrent\n extends Pick<\n VerifiedPrincipalPolicy,\n | \"principalType\"\n | \"principalId\"\n | \"version\"\n | \"keyEpoch\"\n | \"stateHash\"\n | \"state\"\n | \"projection\"\n | \"grants\"\n | \"checkpoint\"\n > {\n readonly [verifiedCurrentBrand]: true;\n readonly retainedHistory: NonNullable<VerifiedPrincipalPolicy[\"history\"]>;\n}\n\nconst verifiedSelectionBrand: unique symbol = Symbol(\n \"verifiedPrincipalPolicySelection\",\n);\n\n/** Public authorization only; neither full history nor current key material. */\nexport interface VerifiedPrincipalPolicySelection\n extends Pick<\n VerifiedPrincipalPolicyCurrent,\n | \"principalType\"\n | \"principalId\"\n | \"version\"\n | \"keyEpoch\"\n | \"stateHash\"\n | \"state\"\n | \"projection\"\n | \"grants\"\n | \"checkpoint\"\n | \"retainedHistory\"\n > {\n readonly [verifiedSelectionBrand]: true;\n}\n\n/** Exact membership and explicitly retained citations for authorization. */\nexport type PrincipalPolicyAuthorization =\n | AnyVerifiedPrincipalPolicy\n | VerifiedPrincipalPolicyCurrent\n | VerifiedPrincipalPolicySelection;\n\nexport function makeVerifiedPrincipalPolicy(\n value: Omit<VerifiedPrincipalPolicy, typeof verifiedPrincipalPolicyBrand>,\n): VerifiedPrincipalPolicy {\n return {\n ...value,\n [verifiedPrincipalPolicyBrand]: true,\n };\n}\n\nexport function makeVerifiedPrincipalPolicySnapshot(\n value: Omit<\n VerifiedPrincipalPolicySnapshot,\n typeof verifiedPrincipalPolicySnapshotBrand\n >,\n): VerifiedPrincipalPolicySnapshot {\n return {\n ...value,\n [verifiedPrincipalPolicySnapshotBrand]: true,\n };\n}\n\nexport function makeVerifiedPrincipalPolicyCurrent(\n value: Omit<VerifiedPrincipalPolicyCurrent, typeof verifiedCurrentBrand>,\n): VerifiedPrincipalPolicyCurrent {\n return { ...value, [verifiedCurrentBrand]: true };\n}\n\nexport function makeVerifiedPrincipalPolicySelection(\n value: Omit<VerifiedPrincipalPolicySelection, typeof verifiedSelectionBrand>,\n): VerifiedPrincipalPolicySelection {\n return { ...value, [verifiedSelectionBrand]: true };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { ManagedRecipientPrincipalType, PrincipalProjectionMember, PrincipalProjectionRole, PrincipalStateHeaderInput, PrincipalStateMember, PrincipalStateSigningInput, SignedPrincipalState, UnsignedPrincipalState } from "./principalStateTypes.js";
2
- export type { ManagedRecipientPrincipalType, PrincipalContainerGrant, PrincipalContainerGrantAccessLevel, PrincipalProjectionMember, PrincipalProjectionRole, PrincipalStateExternalAuthority, PrincipalStateHeaderInput, PrincipalStateMember, PrincipalStateMemberEnvelope, PrincipalStateMembershipMode, PrincipalStatePayloadCipherSuite, PrincipalStateSigningInput, SignedPrincipalState, UnsignedPrincipalState, } from "./principalStateTypes.js";
2
+ export type { ManagedRecipientPrincipalType, PrincipalContainerGrant, PrincipalContainerGrantAccessLevel, PrincipalProjectionMember, PrincipalProjectionRole, PrincipalStateExternalAuthority, PrincipalStateHeaderInput, PrincipalStateMember, PrincipalStateMemberEnvelope, PrincipalStateMembershipMode, PrincipalStateSigningInput, SignedPrincipalState, UnsignedPrincipalState, } from "./principalStateTypes.js";
3
3
  export declare function encodeUnsignedPrincipalState(state: UnsignedPrincipalState): Uint8Array;
4
4
  export declare function toUnsignedPrincipalState(state: UnsignedPrincipalState): UnsignedPrincipalState;
5
5
  export declare function normalizeUnsignedPrincipalState(state: UnsignedPrincipalState): Promise<UnsignedPrincipalState>;