@tearleads/client-sdk 0.1.249 → 0.1.250

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 (76) hide show
  1. package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js +1 -4
  2. package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -1
  3. package/data/persistence/principalPolicy/heldOrganizationDirectories.js +6 -1
  4. package/data/persistence/principalPolicy/heldOrganizationDirectories.js.map +1 -1
  5. package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js +1 -1
  6. package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js.map +1 -1
  7. package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js +1 -5
  8. package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js.map +1 -1
  9. package/data/principals/organizationGroupDirectoryRequest.js +0 -2
  10. package/data/principals/organizationGroupDirectoryRequest.js.map +1 -1
  11. package/data/principals/organizationPolicyRequest.js +0 -2
  12. package/data/principals/organizationPolicyRequest.js.map +1 -1
  13. package/data/principals/principalPolicyRequest.js +0 -2
  14. package/data/principals/principalPolicyRequest.js.map +1 -1
  15. package/internal/api-client/ApiClient.d.ts +0 -58
  16. package/internal/api-client/client/apiClientContext.d.ts +0 -30
  17. package/internal/api-client/client/documents.d.ts +0 -12
  18. package/internal/api-client/client/principalPolicies.d.ts +0 -18
  19. package/internal/api-client/client/writerProjections.d.ts +0 -12
  20. package/internal/api-client/heldDirectoryCitations.d.ts +8 -4
  21. package/internal/api-client/heldDirectoryCitations.js +6 -10
  22. package/internal/api-client/heldDirectoryCitations.js.map +1 -1
  23. package/internal/api-client/organizationPolicyHistory.d.ts +0 -6
  24. package/internal/api-client/principalPolicyRequests.d.ts +0 -18
  25. package/internal/api-client/verifiedManifestCitations.js +3 -3
  26. package/internal/api-client/verifiedManifestCitations.js.map +1 -1
  27. package/internal/crypto/index.d.ts +1 -1
  28. package/internal/crypto/index.js.map +1 -1
  29. package/internal/crypto/keying/principalPolicyPayload.js +2 -12
  30. package/internal/crypto/keying/principalPolicyPayload.js.map +1 -1
  31. package/internal/crypto/keying/principalPolicyTypes.d.ts +5 -6
  32. package/internal/crypto/keying/principalPolicyTypes.js.map +1 -1
  33. package/internal/crypto/principalState.d.ts +1 -1
  34. package/internal/crypto/principalState.js.map +1 -1
  35. package/internal/crypto/principalStateTypes.d.ts +0 -1
  36. package/internal/crypto/principalStateTypes.js.map +1 -1
  37. package/internal/validators/operation/auth.d.ts +0 -24
  38. package/internal/validators/operation/documentMutations.d.ts +0 -48
  39. package/internal/validators/operation/organizationPolicyHistory.d.ts +0 -24
  40. package/internal/validators/operation/organizations.d.ts +0 -48
  41. package/internal/validators/operation/principals.d.ts +0 -56
  42. package/internal/validators/operation/writerProjections.d.ts +0 -48
  43. package/internal/validators/request/organization.d.ts +0 -32
  44. package/internal/validators/request/organizationProvisioning.d.ts +0 -72
  45. package/internal/validators/request/principal.d.ts +4 -48
  46. package/internal/validators/request/principal.js +4 -2
  47. package/internal/validators/request/principal.js.map +1 -1
  48. package/internal/validators/request/registration.d.ts +0 -24
  49. package/internal/validators/response/container.d.ts +0 -48
  50. package/internal/validators/response/documentMutation.d.ts +0 -96
  51. package/internal/validators/response/organizationPolicyHistory.d.ts +0 -24
  52. package/internal/validators/response/policyEvidenceWire.d.ts +5 -3
  53. package/internal/validators/response/policyEvidenceWire.js +6 -4
  54. package/internal/validators/response/policyEvidenceWire.js.map +1 -1
  55. package/internal/validators/response/principal.d.ts +0 -48
  56. package/internal/validators/response/principalPolicyPage.d.ts +0 -48
  57. package/internal/validators/response/principalSnapshot.d.ts +4 -24
  58. package/internal/validators/response/principalSnapshot.js +4 -6
  59. package/internal/validators/response/principalSnapshot.js.map +1 -1
  60. package/internal/validators/response/projectionPolicyEvidence.d.ts +0 -48
  61. package/package.json +1 -1
  62. package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js +1 -6
  63. package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js.map +1 -1
  64. package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js +1 -6
  65. package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js.map +1 -1
  66. package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js +4 -6
  67. package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js.map +1 -1
  68. package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js +1 -7
  69. package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js.map +1 -1
  70. package/workflows/principals/policyCache/principalPolicyCacheValidation.js +0 -13
  71. package/workflows/principals/policyCache/principalPolicyCacheValidation.js.map +1 -1
  72. package/workflows/principals/publicHistory/publicProjectionDirectory.js +4 -5
  73. package/workflows/principals/publicHistory/publicProjectionDirectory.js.map +1 -1
  74. package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -6
  75. package/workflows/registration/registrationPrincipalPolicyPersistence.js +1 -7
  76. package/workflows/registration/registrationPrincipalPolicyPersistence.js.map +1 -1
@@ -188,13 +188,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
188
188
  version: number;
189
189
  };
190
190
  payload: {
191
- cipherSuite: "aes-256-gcm";
192
191
  ciphertext: string;
193
- ciphertextHash: string;
194
- createdAt: string;
195
- principalId: string;
196
- principalType: "group" | "organization";
197
- stateHash: string;
198
192
  };
199
193
  }[];
200
194
  groups: {
@@ -289,13 +283,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
289
283
  version: number;
290
284
  };
291
285
  payload: {
292
- cipherSuite: "aes-256-gcm";
293
286
  ciphertext: string;
294
- ciphertextHash: string;
295
- createdAt: string;
296
- principalId: string;
297
- principalType: "group" | "organization";
298
- stateHash: string;
299
287
  };
300
288
  }[];
301
289
  groups: {
@@ -390,13 +378,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
390
378
  version: number;
391
379
  };
392
380
  payload: {
393
- cipherSuite: "aes-256-gcm";
394
381
  ciphertext: string;
395
- ciphertextHash: string;
396
- createdAt: string;
397
- principalId: string;
398
- principalType: "group" | "organization";
399
- stateHash: string;
400
382
  };
401
383
  }[];
402
384
  groups: {
@@ -491,13 +473,7 @@ export declare const DocumentPurgeProofResponseSchema: z.ZodType<{
491
473
  version: number;
492
474
  };
493
475
  payload: {
494
- cipherSuite: "aes-256-gcm";
495
476
  ciphertext: string;
496
- ciphertextHash: string;
497
- createdAt: string;
498
- principalId: string;
499
- principalType: "group" | "organization";
500
- stateHash: string;
501
477
  };
502
478
  }[];
503
479
  groups: {
@@ -595,13 +571,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
595
571
  version: number;
596
572
  };
597
573
  payload: {
598
- cipherSuite: "aes-256-gcm";
599
574
  ciphertext: string;
600
- ciphertextHash: string;
601
- createdAt: string;
602
- principalId: string;
603
- principalType: "group" | "organization";
604
- stateHash: string;
605
575
  };
606
576
  }[];
607
577
  groups: {
@@ -697,13 +667,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
697
667
  version: number;
698
668
  };
699
669
  payload: {
700
- cipherSuite: "aes-256-gcm";
701
670
  ciphertext: string;
702
- ciphertextHash: string;
703
- createdAt: string;
704
- principalId: string;
705
- principalType: "group" | "organization";
706
- stateHash: string;
707
671
  };
708
672
  }[];
709
673
  groups: {
@@ -799,13 +763,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
799
763
  version: number;
800
764
  };
801
765
  payload: {
802
- cipherSuite: "aes-256-gcm";
803
766
  ciphertext: string;
804
- ciphertextHash: string;
805
- createdAt: string;
806
- principalId: string;
807
- principalType: "group" | "organization";
808
- stateHash: string;
809
767
  };
810
768
  }[];
811
769
  groups: {
@@ -901,13 +859,7 @@ export declare const DocumentPurgeResponseSchema: z.ZodType<{
901
859
  version: number;
902
860
  };
903
861
  payload: {
904
- cipherSuite: "aes-256-gcm";
905
862
  ciphertext: string;
906
- ciphertextHash: string;
907
- createdAt: string;
908
- principalId: string;
909
- principalType: "group" | "organization";
910
- stateHash: string;
911
863
  };
912
864
  }[];
913
865
  groups: {
@@ -947,13 +899,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
947
899
  version: number;
948
900
  };
949
901
  payload: {
950
- cipherSuite: "aes-256-gcm";
951
902
  ciphertext: string;
952
- ciphertextHash: string;
953
- createdAt: string;
954
- principalId: string;
955
- principalType: "group" | "organization";
956
- stateHash: string;
957
903
  };
958
904
  }[];
959
905
  groups: {
@@ -1099,13 +1045,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
1099
1045
  version: number;
1100
1046
  };
1101
1047
  payload: {
1102
- cipherSuite: "aes-256-gcm";
1103
1048
  ciphertext: string;
1104
- ciphertextHash: string;
1105
- createdAt: string;
1106
- principalId: string;
1107
- principalType: "group" | "organization";
1108
- stateHash: string;
1109
1049
  };
1110
1050
  }[];
1111
1051
  groups: {
@@ -1251,13 +1191,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
1251
1191
  version: number;
1252
1192
  };
1253
1193
  payload: {
1254
- cipherSuite: "aes-256-gcm";
1255
1194
  ciphertext: string;
1256
- ciphertextHash: string;
1257
- createdAt: string;
1258
- principalId: string;
1259
- principalType: "group" | "organization";
1260
- stateHash: string;
1261
1195
  };
1262
1196
  }[];
1263
1197
  groups: {
@@ -1403,13 +1337,7 @@ export declare const DocumentWriterProjectionResponseSchema: z.ZodType<{
1403
1337
  version: number;
1404
1338
  };
1405
1339
  payload: {
1406
- cipherSuite: "aes-256-gcm";
1407
1340
  ciphertext: string;
1408
- ciphertextHash: string;
1409
- createdAt: string;
1410
- principalId: string;
1411
- principalType: "group" | "organization";
1412
- stateHash: string;
1413
1341
  };
1414
1342
  }[];
1415
1343
  groups: {
@@ -1569,13 +1497,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1569
1497
  version: number;
1570
1498
  };
1571
1499
  payload: {
1572
- cipherSuite: "aes-256-gcm";
1573
1500
  ciphertext: string;
1574
- ciphertextHash: string;
1575
- createdAt: string;
1576
- principalId: string;
1577
- principalType: "group" | "organization";
1578
- stateHash: string;
1579
1501
  } | null;
1580
1502
  }[];
1581
1503
  groups: {
@@ -1681,13 +1603,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1681
1603
  version: number;
1682
1604
  };
1683
1605
  payload: {
1684
- cipherSuite: "aes-256-gcm";
1685
1606
  ciphertext: string;
1686
- ciphertextHash: string;
1687
- createdAt: string;
1688
- principalId: string;
1689
- principalType: "group" | "organization";
1690
- stateHash: string;
1691
1607
  } | null;
1692
1608
  }[];
1693
1609
  groups: {
@@ -1793,13 +1709,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1793
1709
  version: number;
1794
1710
  };
1795
1711
  payload: {
1796
- cipherSuite: "aes-256-gcm";
1797
1712
  ciphertext: string;
1798
- ciphertextHash: string;
1799
- createdAt: string;
1800
- principalId: string;
1801
- principalType: "group" | "organization";
1802
- stateHash: string;
1803
1713
  } | null;
1804
1714
  }[];
1805
1715
  groups: {
@@ -1905,13 +1815,7 @@ export declare const DocumentWriterProjectionWireResponseSchema: z.ZodType<{
1905
1815
  version: number;
1906
1816
  };
1907
1817
  payload: {
1908
- cipherSuite: "aes-256-gcm";
1909
1818
  ciphertext: string;
1910
- ciphertextHash: string;
1911
- createdAt: string;
1912
- principalId: string;
1913
- principalType: "group" | "organization";
1914
- stateHash: string;
1915
1819
  } | null;
1916
1820
  }[];
1917
1821
  groups: {
@@ -29,13 +29,7 @@ export declare const OrganizationPolicyHistoryResponseSchema: z.ZodType<{
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: {
@@ -77,13 +71,7 @@ export declare const OrganizationPolicyHistoryResponseSchema: z.ZodType<{
77
71
  version: number;
78
72
  };
79
73
  payload: {
80
- cipherSuite: "aes-256-gcm";
81
74
  ciphertext: string;
82
- ciphertextHash: string;
83
- createdAt: string;
84
- principalId: string;
85
- principalType: "group" | "organization";
86
- stateHash: string;
87
75
  };
88
76
  }[];
89
77
  groups: {
@@ -125,13 +113,7 @@ export declare const OrganizationPolicyHistoryResponseSchema: z.ZodType<{
125
113
  version: number;
126
114
  };
127
115
  payload: {
128
- cipherSuite: "aes-256-gcm";
129
116
  ciphertext: string;
130
- ciphertextHash: string;
131
- createdAt: string;
132
- principalId: string;
133
- principalType: "group" | "organization";
134
- stateHash: string;
135
117
  };
136
118
  }[];
137
119
  groups: {
@@ -173,13 +155,7 @@ export declare const OrganizationPolicyHistoryResponseSchema: z.ZodType<{
173
155
  version: number;
174
156
  };
175
157
  payload: {
176
- cipherSuite: "aes-256-gcm";
177
158
  ciphertext: string;
178
- ciphertextHash: string;
179
- createdAt: string;
180
- principalId: string;
181
- principalType: "group" | "organization";
182
- stateHash: string;
183
159
  };
184
160
  }[];
185
161
  groups: {
@@ -10,8 +10,10 @@ export type HeldDirectoryPayloads = ReadonlyMap<string, PrincipalStatePayloadRes
10
10
  */
11
11
  export declare function encodeProjectionPolicyEvidence(evidence: ProjectionPolicyEvidenceResponse, heldDirectories: ReadonlySet<string>): ProjectionPolicyEvidenceWireResponse;
12
12
  /**
13
- * Fills each omitted directory payload with its own copy of the exact payload
14
- * the request cited under that state hash. An omission the request did not
15
- * cite makes the evidence unusable, so the caller refetches in full.
13
+ * Fills each omitted directory payload with its own copy of the payload the
14
+ * request cited under that state hash. An omission the request did not cite
15
+ * makes the evidence unusable, so the caller refetches in full. A payload is
16
+ * only its ciphertext, so the reader checks every one, refilled or served,
17
+ * against its state's signed `payloadCiphertextHash` (#2903 P23).
16
18
  */
17
19
  export declare function decodeProjectionPolicyEvidence(evidence: ProjectionPolicyEvidenceWireResponse, heldDirectories: HeldDirectoryPayloads): ProjectionPolicyEvidenceResponse | null;
@@ -15,9 +15,11 @@ export function encodeProjectionPolicyEvidence(evidence, heldDirectories) {
15
15
  };
16
16
  }
17
17
  /**
18
- * Fills each omitted directory payload with its own copy of the exact payload
19
- * the request cited under that state hash. An omission the request did not
20
- * cite makes the evidence unusable, so the caller refetches in full.
18
+ * Fills each omitted directory payload with its own copy of the payload the
19
+ * request cited under that state hash. An omission the request did not cite
20
+ * makes the evidence unusable, so the caller refetches in full. A payload is
21
+ * only its ciphertext, so the reader checks every one, refilled or served,
22
+ * against its state's signed `payloadCiphertextHash` (#2903 P23).
21
23
  */
22
24
  export function decodeProjectionPolicyEvidence(evidence, heldDirectories) {
23
25
  const organizationPayloads = [];
@@ -27,7 +29,7 @@ export function decodeProjectionPolicyEvidence(evidence, heldDirectories) {
27
29
  continue;
28
30
  }
29
31
  const payload = heldDirectories.get(entry.reference.stateHash);
30
- if (payload?.stateHash !== entry.reference.stateHash)
32
+ if (!payload)
31
33
  return null;
32
34
  organizationPayloads.push({ ...entry, payload: structuredClone(payload) });
33
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"policyEvidenceWire.js","sourceRoot":"","sources":["policyEvidenceWire.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAA0C,EAC1C,eAAoC;IAEpC,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChD,OAAO;QACL,GAAG,QAAQ;QACX,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAChE,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;YAC5C,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;YAC7B,CAAC,CAAC,KAAK,CACV;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAA8C,EAC9C,eAAsC;IAEtC,MAAM,oBAAoB,GACxB,EAAE,CAAC;IACL,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QAClD,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC3B,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAChE,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,OAAO,EAAE,SAAS,KAAK,KAAK,CAAC,SAAS,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAClE,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,EAAE,oBAAoB,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["import type { PrincipalStatePayloadResponse } from \"./principalSnapshot\";\nimport type {\n ProjectionPolicyEvidenceResponse,\n ProjectionPolicyEvidenceWireResponse,\n} from \"./projectionPolicyEvidence\";\n\n/** Directory payloads a request declared held, by organization state hash. */\nexport type HeldDirectoryPayloads = ReadonlyMap<\n string,\n PrincipalStatePayloadResponse\n>;\n\n/**\n * The served evidence: each directory payload whose organization state the\n * request declared held is `null`; everything else travels. Call after the\n * evidence is loaded and checked as for any reader. Unknown hashes are\n * ignored.\n */\nexport function encodeProjectionPolicyEvidence(\n evidence: ProjectionPolicyEvidenceResponse,\n heldDirectories: ReadonlySet<string>,\n): ProjectionPolicyEvidenceWireResponse {\n if (heldDirectories.size === 0) return evidence;\n return {\n ...evidence,\n organizationPayloads: evidence.organizationPayloads.map((entry) =>\n heldDirectories.has(entry.reference.stateHash)\n ? { ...entry, payload: null }\n : entry,\n ),\n };\n}\n\n/**\n * Fills each omitted directory payload with its own copy of the exact payload\n * the request cited under that state hash. An omission the request did not\n * cite makes the evidence unusable, so the caller refetches in full.\n */\nexport function decodeProjectionPolicyEvidence(\n evidence: ProjectionPolicyEvidenceWireResponse,\n heldDirectories: HeldDirectoryPayloads,\n): ProjectionPolicyEvidenceResponse | null {\n const organizationPayloads: ProjectionPolicyEvidenceResponse[\"organizationPayloads\"] =\n [];\n for (const entry of evidence.organizationPayloads) {\n if (entry.payload !== null) {\n organizationPayloads.push({ ...entry, payload: entry.payload });\n continue;\n }\n const payload = heldDirectories.get(entry.reference.stateHash);\n if (payload?.stateHash !== entry.reference.stateHash) return null;\n organizationPayloads.push({ ...entry, payload: structuredClone(payload) });\n }\n return { ...evidence, organizationPayloads };\n}\n"]}
1
+ {"version":3,"file":"policyEvidenceWire.js","sourceRoot":"","sources":["policyEvidenceWire.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAA0C,EAC1C,eAAoC;IAEpC,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChD,OAAO;QACL,GAAG,QAAQ;QACX,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAChE,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;YAC5C,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;YAC7B,CAAC,CAAC,KAAK,CACV;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAA8C,EAC9C,eAAsC;IAEtC,MAAM,oBAAoB,GACxB,EAAE,CAAC;IACL,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QAClD,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC3B,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAChE,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,EAAE,oBAAoB,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["import type { PrincipalStatePayloadResponse } from \"./principalSnapshot\";\nimport type {\n ProjectionPolicyEvidenceResponse,\n ProjectionPolicyEvidenceWireResponse,\n} from \"./projectionPolicyEvidence\";\n\n/** Directory payloads a request declared held, by organization state hash. */\nexport type HeldDirectoryPayloads = ReadonlyMap<\n string,\n PrincipalStatePayloadResponse\n>;\n\n/**\n * The served evidence: each directory payload whose organization state the\n * request declared held is `null`; everything else travels. Call after the\n * evidence is loaded and checked as for any reader. Unknown hashes are\n * ignored.\n */\nexport function encodeProjectionPolicyEvidence(\n evidence: ProjectionPolicyEvidenceResponse,\n heldDirectories: ReadonlySet<string>,\n): ProjectionPolicyEvidenceWireResponse {\n if (heldDirectories.size === 0) return evidence;\n return {\n ...evidence,\n organizationPayloads: evidence.organizationPayloads.map((entry) =>\n heldDirectories.has(entry.reference.stateHash)\n ? { ...entry, payload: null }\n : entry,\n ),\n };\n}\n\n/**\n * Fills each omitted directory payload with its own copy of the payload the\n * request cited under that state hash. An omission the request did not cite\n * makes the evidence unusable, so the caller refetches in full. A payload is\n * only its ciphertext, so the reader checks every one, refilled or served,\n * against its state's signed `payloadCiphertextHash` (#2903 P23).\n */\nexport function decodeProjectionPolicyEvidence(\n evidence: ProjectionPolicyEvidenceWireResponse,\n heldDirectories: HeldDirectoryPayloads,\n): ProjectionPolicyEvidenceResponse | null {\n const organizationPayloads: ProjectionPolicyEvidenceResponse[\"organizationPayloads\"] =\n [];\n for (const entry of evidence.organizationPayloads) {\n if (entry.payload !== null) {\n organizationPayloads.push({ ...entry, payload: entry.payload });\n continue;\n }\n const payload = heldDirectories.get(entry.reference.stateHash);\n if (!payload) return null;\n organizationPayloads.push({ ...entry, payload: structuredClone(payload) });\n }\n return { ...evidence, organizationPayloads };\n}\n"]}
@@ -54,37 +54,13 @@ export declare const principalPolicyCurrentResponseShape: {
54
54
  stateHash: string;
55
55
  }>>;
56
56
  currentPayload: z.ZodType<{
57
- cipherSuite: "aes-256-gcm";
58
57
  ciphertext: string;
59
- ciphertextHash: string;
60
- createdAt: string;
61
- principalId: string;
62
- principalType: "group" | "organization";
63
- stateHash: string;
64
58
  }, {
65
- cipherSuite: "aes-256-gcm";
66
59
  ciphertext: string;
67
- ciphertextHash: string;
68
- createdAt: string;
69
- principalId: string;
70
- principalType: "group" | "organization";
71
- stateHash: string;
72
60
  }, z.core.$ZodTypeInternals<{
73
- cipherSuite: "aes-256-gcm";
74
61
  ciphertext: string;
75
- ciphertextHash: string;
76
- createdAt: string;
77
- principalId: string;
78
- principalType: "group" | "organization";
79
- stateHash: string;
80
62
  }, {
81
- cipherSuite: "aes-256-gcm";
82
63
  ciphertext: string;
83
- ciphertextHash: string;
84
- createdAt: string;
85
- principalId: string;
86
- principalType: "group" | "organization";
87
- stateHash: string;
88
64
  }>>;
89
65
  currentProjection: z.ZodCustom<{
90
66
  identityBundleFingerprint: string;
@@ -277,13 +253,7 @@ export declare const PrincipalPolicyBundleResponseSchema: z.ZodType<{
277
253
  stateHash: string;
278
254
  };
279
255
  currentPayload: {
280
- cipherSuite: "aes-256-gcm";
281
256
  ciphertext: string;
282
- ciphertextHash: string;
283
- createdAt: string;
284
- principalId: string;
285
- principalType: "group" | "organization";
286
- stateHash: string;
287
257
  };
288
258
  currentProjection: {
289
259
  identityBundleFingerprint: string;
@@ -381,13 +351,7 @@ export declare const PrincipalPolicyBundleResponseSchema: z.ZodType<{
381
351
  stateHash: string;
382
352
  };
383
353
  currentPayload: {
384
- cipherSuite: "aes-256-gcm";
385
354
  ciphertext: string;
386
- ciphertextHash: string;
387
- createdAt: string;
388
- principalId: string;
389
- principalType: "group" | "organization";
390
- stateHash: string;
391
355
  };
392
356
  currentProjection: {
393
357
  identityBundleFingerprint: string;
@@ -485,13 +449,7 @@ export declare const PrincipalPolicyBundleResponseSchema: z.ZodType<{
485
449
  stateHash: string;
486
450
  };
487
451
  currentPayload: {
488
- cipherSuite: "aes-256-gcm";
489
452
  ciphertext: string;
490
- ciphertextHash: string;
491
- createdAt: string;
492
- principalId: string;
493
- principalType: "group" | "organization";
494
- stateHash: string;
495
453
  };
496
454
  currentProjection: {
497
455
  identityBundleFingerprint: string;
@@ -589,13 +547,7 @@ export declare const PrincipalPolicyBundleResponseSchema: z.ZodType<{
589
547
  stateHash: string;
590
548
  };
591
549
  currentPayload: {
592
- cipherSuite: "aes-256-gcm";
593
550
  ciphertext: string;
594
- ciphertextHash: string;
595
- createdAt: string;
596
- principalId: string;
597
- principalType: "group" | "organization";
598
- stateHash: string;
599
551
  };
600
552
  currentProjection: {
601
553
  identityBundleFingerprint: string;
@@ -64,13 +64,7 @@ export declare const PrincipalPolicyPageResponseSchema: z.ZodType<{
64
64
  stateHash: string;
65
65
  };
66
66
  currentPayload: {
67
- cipherSuite: "aes-256-gcm";
68
67
  ciphertext: string;
69
- ciphertextHash: string;
70
- createdAt: string;
71
- principalId: string;
72
- principalType: "group" | "organization";
73
- stateHash: string;
74
68
  };
75
69
  currentProjection: {
76
70
  identityBundleFingerprint: string;
@@ -172,13 +166,7 @@ export declare const PrincipalPolicyPageResponseSchema: z.ZodType<{
172
166
  stateHash: string;
173
167
  };
174
168
  currentPayload: {
175
- cipherSuite: "aes-256-gcm";
176
169
  ciphertext: string;
177
- ciphertextHash: string;
178
- createdAt: string;
179
- principalId: string;
180
- principalType: "group" | "organization";
181
- stateHash: string;
182
170
  };
183
171
  currentProjection: {
184
172
  identityBundleFingerprint: string;
@@ -280,13 +268,7 @@ export declare const PrincipalPolicyPageResponseSchema: z.ZodType<{
280
268
  stateHash: string;
281
269
  };
282
270
  currentPayload: {
283
- cipherSuite: "aes-256-gcm";
284
271
  ciphertext: string;
285
- ciphertextHash: string;
286
- createdAt: string;
287
- principalId: string;
288
- principalType: "group" | "organization";
289
- stateHash: string;
290
272
  };
291
273
  currentProjection: {
292
274
  identityBundleFingerprint: string;
@@ -388,13 +370,7 @@ export declare const PrincipalPolicyPageResponseSchema: z.ZodType<{
388
370
  stateHash: string;
389
371
  };
390
372
  currentPayload: {
391
- cipherSuite: "aes-256-gcm";
392
373
  ciphertext: string;
393
- ciphertextHash: string;
394
- createdAt: string;
395
- principalId: string;
396
- principalType: "group" | "organization";
397
- stateHash: string;
398
374
  };
399
375
  currentProjection: {
400
376
  identityBundleFingerprint: string;
@@ -537,13 +513,7 @@ export declare const PrincipalPolicyReadResponseSchema: z.ZodUnion<readonly [z.Z
537
513
  stateHash: string;
538
514
  };
539
515
  currentPayload: {
540
- cipherSuite: "aes-256-gcm";
541
516
  ciphertext: string;
542
- ciphertextHash: string;
543
- createdAt: string;
544
- principalId: string;
545
- principalType: "group" | "organization";
546
- stateHash: string;
547
517
  };
548
518
  currentProjection: {
549
519
  identityBundleFingerprint: string;
@@ -645,13 +615,7 @@ export declare const PrincipalPolicyReadResponseSchema: z.ZodUnion<readonly [z.Z
645
615
  stateHash: string;
646
616
  };
647
617
  currentPayload: {
648
- cipherSuite: "aes-256-gcm";
649
618
  ciphertext: string;
650
- ciphertextHash: string;
651
- createdAt: string;
652
- principalId: string;
653
- principalType: "group" | "organization";
654
- stateHash: string;
655
619
  };
656
620
  currentProjection: {
657
621
  identityBundleFingerprint: string;
@@ -753,13 +717,7 @@ export declare const PrincipalPolicyReadResponseSchema: z.ZodUnion<readonly [z.Z
753
717
  stateHash: string;
754
718
  };
755
719
  currentPayload: {
756
- cipherSuite: "aes-256-gcm";
757
720
  ciphertext: string;
758
- ciphertextHash: string;
759
- createdAt: string;
760
- principalId: string;
761
- principalType: "group" | "organization";
762
- stateHash: string;
763
721
  };
764
722
  currentProjection: {
765
723
  identityBundleFingerprint: string;
@@ -861,13 +819,7 @@ export declare const PrincipalPolicyReadResponseSchema: z.ZodUnion<readonly [z.Z
861
819
  stateHash: string;
862
820
  };
863
821
  currentPayload: {
864
- cipherSuite: "aes-256-gcm";
865
822
  ciphertext: string;
866
- ciphertextHash: string;
867
- createdAt: string;
868
- principalId: string;
869
- principalType: "group" | "organization";
870
- stateHash: string;
871
823
  };
872
824
  currentProjection: {
873
825
  identityBundleFingerprint: string;
@@ -183,38 +183,18 @@ export declare const PrincipalContainerGrantResponseSchema: z.ZodType<{
183
183
  containerId: string;
184
184
  }>>;
185
185
  export type PrincipalContainerGrantResponse = z.infer<typeof PrincipalContainerGrantResponseSchema>;
186
+ /**
187
+ * A payload beside its state: only the ciphertext, which the reader checks
188
+ * against the state's signed `payloadCiphertextHash` (#2903 P23).
189
+ */
186
190
  export declare const PrincipalStatePayloadResponseSchema: z.ZodType<{
187
- cipherSuite: "aes-256-gcm";
188
191
  ciphertext: string;
189
- ciphertextHash: string;
190
- createdAt: string;
191
- principalId: string;
192
- principalType: "group" | "organization";
193
- stateHash: string;
194
192
  }, {
195
- cipherSuite: "aes-256-gcm";
196
193
  ciphertext: string;
197
- ciphertextHash: string;
198
- createdAt: string;
199
- principalId: string;
200
- principalType: "group" | "organization";
201
- stateHash: string;
202
194
  }, z.core.$ZodTypeInternals<{
203
- cipherSuite: "aes-256-gcm";
204
195
  ciphertext: string;
205
- ciphertextHash: string;
206
- createdAt: string;
207
- principalId: string;
208
- principalType: "group" | "organization";
209
- stateHash: string;
210
196
  }, {
211
- cipherSuite: "aes-256-gcm";
212
197
  ciphertext: string;
213
- ciphertextHash: string;
214
- createdAt: string;
215
- principalId: string;
216
- principalType: "group" | "organization";
217
- stateHash: string;
218
198
  }>>;
219
199
  export type PrincipalStatePayloadResponse = z.infer<typeof PrincipalStatePayloadResponseSchema>;
220
200
  export declare const PrincipalMemberEnvelopeResponseSchema: z.ZodType<{
@@ -41,14 +41,12 @@ export const PrincipalContainerGrantResponseSchema = loosePlainObject({
41
41
  accessLevel: z.literal(["admin", "read", "write"]),
42
42
  containerId: z.string(),
43
43
  });
44
+ /**
45
+ * A payload beside its state: only the ciphertext, which the reader checks
46
+ * against the state's signed `payloadCiphertextHash` (#2903 P23).
47
+ */
44
48
  export const PrincipalStatePayloadResponseSchema = loosePlainObject({
45
- cipherSuite: z.literal("aes-256-gcm"),
46
49
  ciphertext: z.string(),
47
- ciphertextHash: z.string(),
48
- createdAt: z.string(),
49
- principalId: z.string(),
50
- principalType: z.literal(["group", "organization"]),
51
- stateHash: z.string(),
52
50
  });
53
51
  export const PrincipalMemberEnvelopeResponseSchema = loosePlainObject({
54
52
  kemCipherText: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"principalSnapshot.js","sourceRoot":"","sources":["principalSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,6CAA6C,GAAG,gBAAgB,CAAC;IAC5E,QAAQ,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBA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AAE,cAAc,CAAC,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,4CAA4C,GAAG,gBAAgB,CAAC;IAC3E,MAAM,EAAE,WAAW,CAAC,qCAAqC,CAAC;IAC1D,UAAU,EAAE,WAAW,CAAC,uCAAuC,CAAC;IAChE,KAAK,EAAE,4BAA4B;CACpC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,qCAAqC,GAAG,gBAAgB,CAAC;IACpE,aAAa,EAAE,WAAW,CAAC,qCAAqC,CAAC;IACjE,iBAAiB,EAAE,WAAW,CAAC,uCAAuC,CAAC;IACvE,YAAY,EAAE,4BAA4B;IAC1C,cAAc,EAAE,WAAW,CAAC,4CAA4C,CAAC;CAC1E,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAAc;IAEd,OAAO,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,yCAAyC,CACvD,KAAc;IAEd,OAAO,6CAA6C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,KAAc;IAEd,OAAO,4CAA4C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n boundedPositiveIntegerSchema,\n loosePlainObject,\n nonNegativeIntegerSchema,\n sha256HexStringSchema,\n} from \"../schema\";\n\nexport const PrincipalStateExternalAuthorityResponseSchema = loosePlainObject({\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n principalId: z.string(),\n principalType: z.literal(\"group\"),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateExternalAuthorityResponse = z.infer<\n typeof PrincipalStateExternalAuthorityResponseSchema\n>;\n\nexport const PrincipalStateResponseSchema = loosePlainObject({\n createdAt: z.string(),\n encapsulationPublicKey: z.string(),\n externalAuthority: PrincipalStateExternalAuthorityResponseSchema.nullable(),\n grantCount: nonNegativeIntegerSchema,\n grantRoot: z.string(),\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n memberCount: nonNegativeIntegerSchema,\n memberEnvelopesRoot: z.string(),\n membershipMode: z.literal(\"projection\"),\n membershipRoot: z.string(),\n payloadCiphertextHash: z.string(),\n prevStateHash: z.string().nullable(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n projectionRoot: z.string(),\n signature: z.string(),\n signedAt: z.string(),\n signerUserId: z.string(),\n signerUserKeyFingerprint: z.string(),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateResponse = z.infer<\n typeof PrincipalStateResponseSchema\n>;\n\nexport const PrincipalProjectionMemberResponseSchema = loosePlainObject({\n identityBundleFingerprint: sha256HexStringSchema,\n role: z.literal([\"member\", \"admin\"]),\n userId: z.string(),\n});\n\nexport type PrincipalProjectionMemberResponse = z.infer<\n typeof PrincipalProjectionMemberResponseSchema\n>;\n\nexport const PrincipalContainerGrantResponseSchema = loosePlainObject({\n accessLevel: z.literal([\"admin\", \"read\", \"write\"]),\n containerId: z.string(),\n});\n\nexport type PrincipalContainerGrantResponse = z.infer<\n typeof PrincipalContainerGrantResponseSchema\n>;\n\nexport const PrincipalStatePayloadResponseSchema = loosePlainObject({\n cipherSuite: z.literal(\"aes-256-gcm\"),\n ciphertext: z.string(),\n ciphertextHash: z.string(),\n createdAt: z.string(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type PrincipalStatePayloadResponse = z.infer<\n typeof PrincipalStatePayloadResponseSchema\n>;\n\nexport const PrincipalMemberEnvelopeResponseSchema = loosePlainObject({\n kemCipherText: z.string(),\n memberKeyFingerprint: z.string(),\n userId: z.string(),\n wrappedKey: z.string(),\n});\n\nexport type PrincipalMemberEnvelopeResponse = z.infer<\n typeof PrincipalMemberEnvelopeResponseSchema\n>;\n\nexport const CurrentPrincipalMemberEnvelopesResponseSchema = loosePlainObject({\n envelopes: arraySchema(PrincipalMemberEnvelopeResponseSchema),\n epoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type CurrentPrincipalMemberEnvelopesResponse = z.infer<\n typeof CurrentPrincipalMemberEnvelopesResponseSchema\n>;\n\nexport const PrincipalPolicyStateChainEntryResponseSchema = loosePlainObject({\n grants: arraySchema(PrincipalContainerGrantResponseSchema),\n projection: arraySchema(PrincipalProjectionMemberResponseSchema),\n state: PrincipalStateResponseSchema,\n});\n\nexport type PrincipalPolicyStateChainEntryResponse = z.infer<\n typeof PrincipalPolicyStateChainEntryResponseSchema\n>;\n\nexport const PrincipalPolicySnapshotResponseSchema = loosePlainObject({\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicySnapshotResponse = z.infer<\n typeof PrincipalPolicySnapshotResponseSchema\n>;\n\nexport function isPrincipalStateResponse(\n value: unknown,\n): value is PrincipalStateResponse {\n return PrincipalStateResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalStatePayloadResponse(\n value: unknown,\n): value is PrincipalStatePayloadResponse {\n return PrincipalStatePayloadResponseSchema.safeParse(value).success;\n}\n\nexport function isCurrentPrincipalMemberEnvelopesResponse(\n value: unknown,\n): value is CurrentPrincipalMemberEnvelopesResponse {\n return CurrentPrincipalMemberEnvelopesResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStateChainEntryResponse(\n value: unknown,\n): value is PrincipalPolicyStateChainEntryResponse {\n return PrincipalPolicyStateChainEntryResponseSchema.safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"principalSnapshot.js","sourceRoot":"","sources":["principalSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,4BAA4B,EAC5B,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,6CAA6C,GAAG,gBAAgB,CAAC;IAC5E,QAAQ,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;CAC/D,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE;IAClC,iBAAiB,EAAE,6CAA6C,CAAC,QAAQ,EAAE;IAC3E,UAAU,EAAE,wBAAwB;IACpC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,4BAA4B,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAC/D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,w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AC,KAAK,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,yCAAyC,CACvD,KAAc;IAEd,OAAO,6CAA6C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,KAAc;IAEd,OAAO,4CAA4C,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/E,CAAC","sourcesContent":["import { z } from \"zod\";\nimport {\n arraySchema,\n boundedPositiveIntegerSchema,\n loosePlainObject,\n nonNegativeIntegerSchema,\n sha256HexStringSchema,\n} from \"../schema\";\n\nexport const PrincipalStateExternalAuthorityResponseSchema = loosePlainObject({\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n principalId: z.string(),\n principalType: z.literal(\"group\"),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateExternalAuthorityResponse = z.infer<\n typeof PrincipalStateExternalAuthorityResponseSchema\n>;\n\nexport const PrincipalStateResponseSchema = loosePlainObject({\n createdAt: z.string(),\n encapsulationPublicKey: z.string(),\n externalAuthority: PrincipalStateExternalAuthorityResponseSchema.nullable(),\n grantCount: nonNegativeIntegerSchema,\n grantRoot: z.string(),\n keyEpoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n keyFingerprint: z.string(),\n memberCount: nonNegativeIntegerSchema,\n memberEnvelopesRoot: z.string(),\n membershipMode: z.literal(\"projection\"),\n membershipRoot: z.string(),\n payloadCiphertextHash: z.string(),\n prevStateHash: z.string().nullable(),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n projectionRoot: z.string(),\n signature: z.string(),\n signedAt: z.string(),\n signerUserId: z.string(),\n signerUserKeyFingerprint: z.string(),\n stateHash: z.string(),\n version: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n});\n\nexport type PrincipalStateResponse = z.infer<\n typeof PrincipalStateResponseSchema\n>;\n\nexport const PrincipalProjectionMemberResponseSchema = loosePlainObject({\n identityBundleFingerprint: sha256HexStringSchema,\n role: z.literal([\"member\", \"admin\"]),\n userId: z.string(),\n});\n\nexport type PrincipalProjectionMemberResponse = z.infer<\n typeof PrincipalProjectionMemberResponseSchema\n>;\n\nexport const PrincipalContainerGrantResponseSchema = loosePlainObject({\n accessLevel: z.literal([\"admin\", \"read\", \"write\"]),\n containerId: z.string(),\n});\n\nexport type PrincipalContainerGrantResponse = z.infer<\n typeof PrincipalContainerGrantResponseSchema\n>;\n\n/**\n * A payload beside its state: only the ciphertext, which the reader checks\n * against the state's signed `payloadCiphertextHash` (#2903 P23).\n */\nexport const PrincipalStatePayloadResponseSchema = loosePlainObject({\n ciphertext: z.string(),\n});\n\nexport type PrincipalStatePayloadResponse = z.infer<\n typeof PrincipalStatePayloadResponseSchema\n>;\n\nexport const PrincipalMemberEnvelopeResponseSchema = loosePlainObject({\n kemCipherText: z.string(),\n memberKeyFingerprint: z.string(),\n userId: z.string(),\n wrappedKey: z.string(),\n});\n\nexport type PrincipalMemberEnvelopeResponse = z.infer<\n typeof PrincipalMemberEnvelopeResponseSchema\n>;\n\nexport const CurrentPrincipalMemberEnvelopesResponseSchema = loosePlainObject({\n envelopes: arraySchema(PrincipalMemberEnvelopeResponseSchema),\n epoch: boundedPositiveIntegerSchema(Number.MAX_SAFE_INTEGER),\n principalId: z.string(),\n principalType: z.literal([\"group\", \"organization\"]),\n stateHash: z.string(),\n});\n\nexport type CurrentPrincipalMemberEnvelopesResponse = z.infer<\n typeof CurrentPrincipalMemberEnvelopesResponseSchema\n>;\n\nexport const PrincipalPolicyStateChainEntryResponseSchema = loosePlainObject({\n grants: arraySchema(PrincipalContainerGrantResponseSchema),\n projection: arraySchema(PrincipalProjectionMemberResponseSchema),\n state: PrincipalStateResponseSchema,\n});\n\nexport type PrincipalPolicyStateChainEntryResponse = z.infer<\n typeof PrincipalPolicyStateChainEntryResponseSchema\n>;\n\nexport const PrincipalPolicySnapshotResponseSchema = loosePlainObject({\n currentGrants: arraySchema(PrincipalContainerGrantResponseSchema),\n currentProjection: arraySchema(PrincipalProjectionMemberResponseSchema),\n currentState: PrincipalStateResponseSchema,\n previousStates: arraySchema(PrincipalPolicyStateChainEntryResponseSchema),\n});\n\nexport type PrincipalPolicySnapshotResponse = z.infer<\n typeof PrincipalPolicySnapshotResponseSchema\n>;\n\nexport function isPrincipalStateResponse(\n value: unknown,\n): value is PrincipalStateResponse {\n return PrincipalStateResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalStatePayloadResponse(\n value: unknown,\n): value is PrincipalStatePayloadResponse {\n return PrincipalStatePayloadResponseSchema.safeParse(value).success;\n}\n\nexport function isCurrentPrincipalMemberEnvelopesResponse(\n value: unknown,\n): value is CurrentPrincipalMemberEnvelopesResponse {\n return CurrentPrincipalMemberEnvelopesResponseSchema.safeParse(value).success;\n}\n\nexport function isPrincipalPolicyStateChainEntryResponse(\n value: unknown,\n): value is PrincipalPolicyStateChainEntryResponse {\n return PrincipalPolicyStateChainEntryResponseSchema.safeParse(value).success;\n}\n"]}