@tearleads/client-sdk 0.1.248 → 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.
- package/client/organizations/index.js +5 -3
- package/client/organizations/index.js.map +1 -1
- package/client/organizations/organizationGroupPresentation.d.ts +1 -1
- package/client/organizations/organizationGroupPresentation.js.map +1 -1
- package/client/organizations/organizationLeaveRequestVerifier.js +21 -0
- package/client/organizations/organizationLeaveRequestVerifier.js.map +1 -0
- package/client/organizations/{organizationReadModels.d.ts → organizationReadModelCoordinator.d.ts} +18 -16
- package/client/organizations/organizationReadModelCoordinator.js +2 -0
- package/client/organizations/organizationReadModelCoordinator.js.map +1 -0
- package/client/organizations/organizationReadModelPresentation.js +51 -0
- package/client/organizations/organizationReadModelPresentation.js.map +1 -0
- package/client/organizations/organizationReadModelScopes.js +37 -0
- package/client/organizations/organizationReadModelScopes.js.map +1 -0
- package/client/organizations/organizationReadModels.js +131 -88
- package/client/organizations/organizationReadModels.js.map +1 -1
- package/client/organizations/organizationsTypes.d.ts +13 -5
- package/client/organizations/organizationsTypes.js.map +1 -1
- package/client/organizations/principalMutations.d.ts +18 -2
- package/client/organizations/principalMutations.js +29 -15
- package/client/organizations/principalMutations.js.map +1 -1
- package/client/runtime/principalMutationApi.d.ts +2 -0
- package/client/runtime/principalMutationApi.js +2 -0
- package/client/runtime/principalMutationApi.js.map +1 -1
- package/client/runtime/principalMutationDispatch.js +47 -10
- package/client/runtime/principalMutationDispatch.js.map +1 -1
- package/client/runtime/workflowRuntime.js +5 -4
- package/client/runtime/workflowRuntime.js.map +1 -1
- package/data/containers/shared/mutationRequestOptions.d.ts +2 -0
- package/data/containers/shared/mutationRequestOptions.js.map +1 -1
- package/data/containers/shared/types.d.ts +12 -2
- package/data/containers/shared/types.js.map +1 -1
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js +1 -4
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelRepository.js +20 -2
- package/data/persistence/organizations/organizationReadModelRepository.js.map +1 -1
- package/data/persistence/principalPolicy/heldOrganizationDirectories.js +6 -1
- package/data/persistence/principalPolicy/heldOrganizationDirectories.js.map +1 -1
- package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js +1 -1
- package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js.map +1 -1
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js +1 -5
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js.map +1 -1
- package/data/principals/organizationGroupDirectoryRequest.js +0 -2
- package/data/principals/organizationGroupDirectoryRequest.js.map +1 -1
- package/data/principals/organizationPolicyRequest.js +0 -2
- package/data/principals/organizationPolicyRequest.js.map +1 -1
- package/data/principals/principalPolicyRequest.js +0 -2
- package/data/principals/principalPolicyRequest.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +4 -59
- package/internal/api-client/client/apiClientContext.d.ts +0 -30
- package/internal/api-client/client/containerMutations.d.ts +2 -2
- package/internal/api-client/client/containerMutations.js +2 -1
- package/internal/api-client/client/containerMutations.js.map +1 -1
- package/internal/api-client/client/documents.d.ts +0 -12
- package/internal/api-client/client/principalPolicies.d.ts +3 -18
- package/internal/api-client/client/writerProjections.d.ts +0 -12
- package/internal/api-client/heldDirectoryCitations.d.ts +8 -4
- package/internal/api-client/heldDirectoryCitations.js +6 -10
- package/internal/api-client/heldDirectoryCitations.js.map +1 -1
- package/internal/api-client/organizationPolicyHistory.d.ts +0 -6
- package/internal/api-client/principalPolicyRequests.d.ts +2 -18
- package/internal/api-client/principalPolicyRequests.js +6 -4
- package/internal/api-client/principalPolicyRequests.js.map +1 -1
- package/internal/api-client/routes/containers/mutations.js +3 -3
- package/internal/api-client/routes/containers/mutations.js.map +1 -1
- package/internal/api-client/routes/organizations/createGroup.js +3 -5
- package/internal/api-client/routes/organizations/createGroup.js.map +1 -1
- package/internal/api-client/routes/principals/policy.js +2 -5
- package/internal/api-client/routes/principals/policy.js.map +1 -1
- package/internal/api-client/types.d.ts +6 -0
- package/internal/api-client/types.js.map +1 -1
- package/internal/api-client/verifiedManifestCitations.js +3 -3
- package/internal/api-client/verifiedManifestCitations.js.map +1 -1
- package/internal/crypto/index.d.ts +1 -1
- package/internal/crypto/index.js.map +1 -1
- package/internal/crypto/keying/principalPolicyPayload.js +2 -12
- package/internal/crypto/keying/principalPolicyPayload.js.map +1 -1
- package/internal/crypto/keying/principalPolicyTypes.d.ts +5 -6
- package/internal/crypto/keying/principalPolicyTypes.js.map +1 -1
- package/internal/crypto/principalState.d.ts +1 -1
- package/internal/crypto/principalState.js.map +1 -1
- package/internal/crypto/principalStateTypes.d.ts +0 -1
- package/internal/crypto/principalStateTypes.js.map +1 -1
- package/internal/validators/operation/auth.d.ts +0 -24
- package/internal/validators/operation/containerMutations.d.ts +20 -3
- package/internal/validators/operation/containerMutations.js +18 -20
- package/internal/validators/operation/containerMutations.js.map +1 -1
- package/internal/validators/operation/documentMutations.d.ts +0 -48
- package/internal/validators/operation/index.d.ts +1 -1
- package/internal/validators/operation/index.js +1 -1
- package/internal/validators/operation/index.js.map +1 -1
- package/internal/validators/operation/organizationPolicyHistory.d.ts +0 -24
- package/internal/validators/operation/organizations.d.ts +17 -49
- package/internal/validators/operation/organizations.js +4 -2
- package/internal/validators/operation/organizations.js.map +1 -1
- package/internal/validators/operation/principals.d.ts +17 -57
- package/internal/validators/operation/principals.js +5 -2
- package/internal/validators/operation/principals.js.map +1 -1
- package/internal/validators/operation/writerProjections.d.ts +0 -48
- package/internal/validators/request/index.d.ts +1 -1
- package/internal/validators/request/index.js +1 -1
- package/internal/validators/request/index.js.map +1 -1
- package/internal/validators/request/organization.d.ts +15 -32
- package/internal/validators/request/organization.js +8 -0
- package/internal/validators/request/organization.js.map +1 -1
- package/internal/validators/request/organizationProvisioning.d.ts +0 -72
- package/internal/validators/request/principal.d.ts +4 -48
- package/internal/validators/request/principal.js +4 -2
- package/internal/validators/request/principal.js.map +1 -1
- package/internal/validators/request/registration.d.ts +0 -24
- package/internal/validators/response/areas/organizations.d.ts +3 -2
- package/internal/validators/response/areas/organizations.js +3 -2
- package/internal/validators/response/areas/organizations.js.map +1 -1
- package/internal/validators/response/areas/principals.d.ts +1 -1
- package/internal/validators/response/areas/principals.js +1 -1
- package/internal/validators/response/areas/principals.js.map +1 -1
- package/internal/validators/response/committedReadModel.d.ts +697 -0
- package/internal/validators/response/committedReadModel.js +52 -0
- package/internal/validators/response/committedReadModel.js.map +1 -0
- package/internal/validators/response/container.d.ts +52 -48
- package/internal/validators/response/container.js +3 -3
- package/internal/validators/response/container.js.map +1 -1
- package/internal/validators/response/documentMutation.d.ts +0 -96
- package/internal/validators/response/organization.d.ts +0 -191
- package/internal/validators/response/organization.js +0 -7
- package/internal/validators/response/organization.js.map +1 -1
- package/internal/validators/response/organizationPolicyHistory.d.ts +0 -24
- package/internal/validators/response/organizationReadModel.d.ts +167 -0
- package/internal/validators/response/organizationReadModel.js +5 -0
- package/internal/validators/response/organizationReadModel.js.map +1 -1
- package/internal/validators/response/policyEvidenceWire.d.ts +5 -3
- package/internal/validators/response/policyEvidenceWire.js +6 -4
- package/internal/validators/response/policyEvidenceWire.js.map +1 -1
- package/internal/validators/response/principal.d.ts +0 -451
- package/internal/validators/response/principal.js +0 -8
- package/internal/validators/response/principal.js.map +1 -1
- package/internal/validators/response/principalPolicyPage.d.ts +0 -48
- package/internal/validators/response/principalSnapshot.d.ts +4 -24
- package/internal/validators/response/principalSnapshot.js +4 -6
- package/internal/validators/response/principalSnapshot.js.map +1 -1
- package/internal/validators/response/projectionPolicyEvidence.d.ts +0 -48
- package/package.json +1 -1
- package/workflows/container-contents/container-state/organizationHost.d.ts +9 -0
- package/workflows/container-contents/container-state/organizationHost.js.map +1 -1
- package/workflows/container-contents/container-state/remote.js +6 -0
- package/workflows/container-contents/container-state/remote.js.map +1 -1
- package/workflows/containers/child/share/index.d.ts +4 -2
- package/workflows/containers/child/share/index.js +37 -20
- package/workflows/containers/child/share/index.js.map +1 -1
- package/workflows/organizations/containerContentsHost.js +20 -1
- package/workflows/organizations/containerContentsHost.js.map +1 -1
- package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js +5 -1
- package/workflows/organizations/groupPolicy/commitCurrentGroupPolicyMutation.js.map +1 -1
- package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js +1 -6
- package/workflows/organizations/groupPolicy/currentPolicyMutationAcknowledgement.js.map +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js +1 -6
- package/workflows/organizations/groupPolicy/groupPolicyMutationAcknowledgement.js.map +1 -1
- package/workflows/organizations/groups/createCurrentOrganizationGroup.js +8 -1
- package/workflows/organizations/groups/createCurrentOrganizationGroup.js.map +1 -1
- package/workflows/organizations/index.d.ts +1 -0
- package/workflows/organizations/index.js +1 -0
- package/workflows/organizations/index.js.map +1 -1
- package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js +4 -6
- package/workflows/organizations/policyHistory/organizationPolicyHistoryVerification.js.map +1 -1
- package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js +1 -7
- package/workflows/organizations/principalPolicy/principalPolicyReceiptArtifacts.js.map +1 -1
- package/workflows/organizations/readModel/committedReadModel.d.ts +66 -0
- package/workflows/organizations/readModel/committedReadModel.js +150 -0
- package/workflows/organizations/readModel/committedReadModel.js.map +1 -0
- package/workflows/organizations/readModel/readModelProjection.d.ts +15 -2
- package/workflows/organizations/readModel/readModelProjection.js +26 -4
- package/workflows/organizations/readModel/readModelProjection.js.map +1 -1
- package/workflows/principals/policyCache/principalPolicyCacheValidation.js +0 -13
- package/workflows/principals/policyCache/principalPolicyCacheValidation.js.map +1 -1
- package/workflows/principals/publicHistory/publicProjectionDirectory.js +4 -5
- package/workflows/principals/publicHistory/publicProjectionDirectory.js.map +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -6
- package/workflows/registration/registrationPrincipalPolicyPersistence.js +1 -7
- package/workflows/registration/registrationPrincipalPolicyPersistence.js.map +1 -1
|
@@ -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;
|
|
@@ -463,6 +445,7 @@ export declare class PrincipalPolicyRequests {
|
|
|
463
445
|
version: number;
|
|
464
446
|
};
|
|
465
447
|
};
|
|
448
|
+
readModel?: unknown;
|
|
466
449
|
}>>;
|
|
467
450
|
deleteResult(organizationId: string, groupId: string, input: DeleteOrganizationGroupRequest, options?: RequestResultOptions): Promise<RequestResult<{
|
|
468
451
|
deleted: true;
|
|
@@ -603,5 +586,6 @@ export declare class PrincipalPolicyRequests {
|
|
|
603
586
|
version: number;
|
|
604
587
|
};
|
|
605
588
|
} | undefined;
|
|
589
|
+
readModel?: unknown;
|
|
606
590
|
}>>;
|
|
607
591
|
}
|
|
@@ -68,14 +68,15 @@ export class PrincipalPolicyRequests {
|
|
|
68
68
|
}).finally(() => this.cache.delete(key));
|
|
69
69
|
}
|
|
70
70
|
createResult(organizationId, input, options = {}) {
|
|
71
|
+
const { readModelCursor, ...requestOptions } = options;
|
|
71
72
|
return this.groupMutation(organizationId, input.groupId, () => principalHistoryRequest(this.runtime, {
|
|
72
|
-
path: createOrganizationGroup.path(organizationId),
|
|
73
|
+
path: createOrganizationGroup.path(organizationId, readModelCursor),
|
|
73
74
|
validator: createOrganizationGroup.isResponse,
|
|
74
75
|
method: createOrganizationGroup.method,
|
|
75
76
|
body: JSON.stringify(input),
|
|
76
77
|
options: {
|
|
77
78
|
expectedPaymentRequiredOrganizationId: organizationId,
|
|
78
|
-
...
|
|
79
|
+
...requestOptions,
|
|
79
80
|
},
|
|
80
81
|
operation: createOrganizationGroupOperation,
|
|
81
82
|
}));
|
|
@@ -110,17 +111,18 @@ export class PrincipalPolicyRequests {
|
|
|
110
111
|
async commitResult(organizationId, groupId, input, options = {}) {
|
|
111
112
|
const groupKey = JSON.stringify(["group", groupId]);
|
|
112
113
|
const organizationKey = JSON.stringify(["organization", organizationId]);
|
|
114
|
+
const { readModelCursor, ...requestOptions } = options;
|
|
113
115
|
this.cache.delete(groupKey);
|
|
114
116
|
this.cache.delete(organizationKey);
|
|
115
117
|
try {
|
|
116
118
|
return await principalHistoryRequest(this.runtime, {
|
|
117
|
-
path: commitOrganizationGroupPolicy.path(organizationId, groupId),
|
|
119
|
+
path: commitOrganizationGroupPolicy.path(organizationId, groupId, readModelCursor),
|
|
118
120
|
validator: commitOrganizationGroupPolicy.isResponse,
|
|
119
121
|
method: commitOrganizationGroupPolicy.method,
|
|
120
122
|
body: JSON.stringify(input),
|
|
121
123
|
options: {
|
|
122
124
|
expectedPaymentRequiredOrganizationId: organizationId,
|
|
123
|
-
...
|
|
125
|
+
...requestOptions,
|
|
124
126
|
},
|
|
125
127
|
operation: commitOrganizationGroupPolicyOperation,
|
|
126
128
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principalPolicyRequests.js","sourceRoot":"","sources":["principalPolicyRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,gCAAgC,EAChC,gCAAgC,EAChC,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAazC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,2BAA2B,EAG3B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACL,6BAA6B,EAC7B,2BAA2B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AAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC3B,OAAO,EAAE;oBACP,qCAAqC,EAAE,cAAc;oBACrD,GAAG,OAAO;iBACX;gBACD,SAAS,EAAE,sCAAsC;aAClD,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YACnC,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n createOrganizationGroupOperation,\n deleteOrganizationGroupOperation,\n getPrincipalMemberEnvelopesOperation,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\nimport type {\n CommitOrganizationGroupPolicyRequest,\n CreateOrganizationGroupWithPolicyRequest,\n DeleteOrganizationGroupRequest,\n OrganizationPrincipalPolicyRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n CurrentPrincipalMemberEnvelopesResponse,\n PrincipalPolicyBundleResponse,\n} from \"@tearleads/validators/response\";\nimport type { BoundedCache } from \"./ApiCache\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport {\n collectPrincipalPolicyPages,\n type PrincipalPolicyDiscoveryOptions,\n type PrincipalPolicyPageReadOptions,\n readPrincipalPolicyDiscovery,\n readPrincipalPolicyPages,\n} from \"./principalPolicyPages\";\nimport { readProjectionPolicyHistoryPages } from \"./projectionPolicyHistoryPages\";\nimport { dedupedRequest } from \"./requestInternals\";\nimport { createOrganizationGroup } from \"./routes/organizations/createGroup\";\nimport { deleteOrganizationGroup } from \"./routes/organizations/deleteGroup\";\nimport {\n commitOrganizationGroupPolicy,\n getPrincipalMemberEnvelopes,\n putPrincipalPolicy,\n} from \"./routes/principals/policy\";\nimport type { RequestResult, RequestResultOptions } from \"./types\";\n\nexport class PrincipalPolicyRequests {\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly cache: BoundedCache<\n Promise<PrincipalPolicyBundleResponse | null>\n >,\n private readonly clearWriterProjectionCaches: () => void,\n ) {}\n\n publicPages(\n source: Parameters<typeof readProjectionPolicyHistoryPages>[1],\n options: Parameters<typeof readProjectionPolicyHistoryPages>[2] = {},\n ) {\n return readProjectionPolicyHistoryPages(this.runtime, source, options);\n }\n\n pages(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions = {},\n ) {\n return readPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n discover(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyDiscoveryOptions = {},\n ) {\n return readPrincipalPolicyDiscovery(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n /**\n * Every member envelope of one named state. A response that fails its\n * schema, or names another state, is a `shape` failure the caller can treat\n * as tampering; an unknown state is an HTTP 404.\n */\n memberEnvelopes(\n principalType: \"group\" | \"organization\",\n principalId: string,\n stateHash: string,\n ): Promise<RequestResult<CurrentPrincipalMemberEnvelopesResponse>> {\n return principalHistoryRequest(this.runtime, {\n path: getPrincipalMemberEnvelopes.path(\n principalType,\n principalId,\n stateHash,\n ),\n validator: (value): value is CurrentPrincipalMemberEnvelopesResponse =>\n getPrincipalMemberEnvelopes.isResponse(value) &&\n value.principalType === principalType &&\n value.principalId === principalId &&\n value.stateHash === stateHash,\n method: getPrincipalMemberEnvelopes.method,\n options: { reportErrors: false },\n operation: getPrincipalMemberEnvelopesOperation,\n });\n }\n\n get(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions = {},\n ) {\n const request = () =>\n collectPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n const key = JSON.stringify([principalType, principalId]);\n // Cancellation, reporting and renewal preferences belong to their caller.\n return Object.keys(options).length > 0\n ? request()\n : dedupedRequest(this.cache, key, request);\n }\n\n put(...args: Parameters<PrincipalPolicyRequests[\"putResult\"]>) {\n return this.putResult(...args).then((result) =>\n result.ok ? result.data : null,\n );\n }\n\n putResult(\n principalType: \"organization\",\n principalId: string,\n input: OrganizationPrincipalPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const key = JSON.stringify([principalType, principalId]);\n this.cache.delete(key);\n return principalHistoryRequest(this.runtime, {\n path: putPrincipalPolicy.path(principalType, principalId),\n validator: putPrincipalPolicy.isResponse,\n method: putPrincipalPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: principalId,\n ...options,\n },\n operation: putPrincipalPolicyOperation,\n }).finally(() => this.cache.delete(key));\n }\n\n createResult(\n organizationId: string,\n input: CreateOrganizationGroupWithPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, input.groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: createOrganizationGroup.path(organizationId),\n validator: createOrganizationGroup.isResponse,\n method: createOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: createOrganizationGroupOperation,\n }),\n );\n }\n\n deleteResult(\n organizationId: string,\n groupId: string,\n input: DeleteOrganizationGroupRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: deleteOrganizationGroup.path(organizationId, groupId),\n validator: deleteOrganizationGroup.isResponse,\n method: deleteOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: deleteOrganizationGroupOperation,\n }),\n );\n }\n\n private async groupMutation<T>(\n organizationId: string,\n groupId: string,\n request: () => Promise<T>,\n ): Promise<T> {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await request();\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n\n async commitResult(\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await principalHistoryRequest(this.runtime, {\n path: commitOrganizationGroupPolicy.path(organizationId, groupId),\n validator: commitOrganizationGroupPolicy.isResponse,\n method: commitOrganizationGroupPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: commitOrganizationGroupPolicyOperation,\n });\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"principalPolicyRequests.js","sourceRoot":"","sources":["principalPolicyRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,gCAAgC,EAChC,gCAAgC,EAChC,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAazC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,2BAA2B,EAG3B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,OAAO,uBAAuB;IAEf;IACA;IAGA;IALnB,YAC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nD,MAAM,EAAE,6BAA6B,CAAC,MAAM;gBAC5C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC3B,OAAO,EAAE;oBACP,qCAAqC,EAAE,cAAc;oBACrD,GAAG,cAAc;iBAClB;gBACD,SAAS,EAAE,sCAAsC;aAClD,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YACnC,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n createOrganizationGroupOperation,\n deleteOrganizationGroupOperation,\n getPrincipalMemberEnvelopesOperation,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\nimport type {\n CommitOrganizationGroupPolicyRequest,\n CreateOrganizationGroupWithPolicyRequest,\n DeleteOrganizationGroupRequest,\n OrganizationPrincipalPolicyRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n CurrentPrincipalMemberEnvelopesResponse,\n PrincipalPolicyBundleResponse,\n} from \"@tearleads/validators/response\";\nimport type { BoundedCache } from \"./ApiCache\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport {\n collectPrincipalPolicyPages,\n type PrincipalPolicyDiscoveryOptions,\n type PrincipalPolicyPageReadOptions,\n readPrincipalPolicyDiscovery,\n readPrincipalPolicyPages,\n} from \"./principalPolicyPages\";\nimport { readProjectionPolicyHistoryPages } from \"./projectionPolicyHistoryPages\";\nimport { dedupedRequest } from \"./requestInternals\";\nimport { createOrganizationGroup } from \"./routes/organizations/createGroup\";\nimport { deleteOrganizationGroup } from \"./routes/organizations/deleteGroup\";\nimport {\n commitOrganizationGroupPolicy,\n getPrincipalMemberEnvelopes,\n putPrincipalPolicy,\n} from \"./routes/principals/policy\";\nimport type { RequestResult, RequestResultOptions } from \"./types\";\n\nexport class PrincipalPolicyRequests {\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly cache: BoundedCache<\n Promise<PrincipalPolicyBundleResponse | null>\n >,\n private readonly clearWriterProjectionCaches: () => void,\n ) {}\n\n publicPages(\n source: Parameters<typeof readProjectionPolicyHistoryPages>[1],\n options: Parameters<typeof readProjectionPolicyHistoryPages>[2] = {},\n ) {\n return readProjectionPolicyHistoryPages(this.runtime, source, options);\n }\n\n pages(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions = {},\n ) {\n return readPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n discover(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyDiscoveryOptions = {},\n ) {\n return readPrincipalPolicyDiscovery(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n /**\n * Every member envelope of one named state. A response that fails its\n * schema, or names another state, is a `shape` failure the caller can treat\n * as tampering; an unknown state is an HTTP 404.\n */\n memberEnvelopes(\n principalType: \"group\" | \"organization\",\n principalId: string,\n stateHash: string,\n ): Promise<RequestResult<CurrentPrincipalMemberEnvelopesResponse>> {\n return principalHistoryRequest(this.runtime, {\n path: getPrincipalMemberEnvelopes.path(\n principalType,\n principalId,\n stateHash,\n ),\n validator: (value): value is CurrentPrincipalMemberEnvelopesResponse =>\n getPrincipalMemberEnvelopes.isResponse(value) &&\n value.principalType === principalType &&\n value.principalId === principalId &&\n value.stateHash === stateHash,\n method: getPrincipalMemberEnvelopes.method,\n options: { reportErrors: false },\n operation: getPrincipalMemberEnvelopesOperation,\n });\n }\n\n get(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions = {},\n ) {\n const request = () =>\n collectPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n const key = JSON.stringify([principalType, principalId]);\n // Cancellation, reporting and renewal preferences belong to their caller.\n return Object.keys(options).length > 0\n ? request()\n : dedupedRequest(this.cache, key, request);\n }\n\n put(...args: Parameters<PrincipalPolicyRequests[\"putResult\"]>) {\n return this.putResult(...args).then((result) =>\n result.ok ? result.data : null,\n );\n }\n\n putResult(\n principalType: \"organization\",\n principalId: string,\n input: OrganizationPrincipalPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const key = JSON.stringify([principalType, principalId]);\n this.cache.delete(key);\n return principalHistoryRequest(this.runtime, {\n path: putPrincipalPolicy.path(principalType, principalId),\n validator: putPrincipalPolicy.isResponse,\n method: putPrincipalPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: principalId,\n ...options,\n },\n operation: putPrincipalPolicyOperation,\n }).finally(() => this.cache.delete(key));\n }\n\n createResult(\n organizationId: string,\n input: CreateOrganizationGroupWithPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const { readModelCursor, ...requestOptions } = options;\n return this.groupMutation(organizationId, input.groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: createOrganizationGroup.path(organizationId, readModelCursor),\n validator: createOrganizationGroup.isResponse,\n method: createOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...requestOptions,\n },\n operation: createOrganizationGroupOperation,\n }),\n );\n }\n\n deleteResult(\n organizationId: string,\n groupId: string,\n input: DeleteOrganizationGroupRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: deleteOrganizationGroup.path(organizationId, groupId),\n validator: deleteOrganizationGroup.isResponse,\n method: deleteOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: deleteOrganizationGroupOperation,\n }),\n );\n }\n\n private async groupMutation<T>(\n organizationId: string,\n groupId: string,\n request: () => Promise<T>,\n ): Promise<T> {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await request();\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n\n async commitResult(\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n const { readModelCursor, ...requestOptions } = options;\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await principalHistoryRequest(this.runtime, {\n path: commitOrganizationGroupPolicy.path(\n organizationId,\n groupId,\n readModelCursor,\n ),\n validator: commitOrganizationGroupPolicy.isResponse,\n method: commitOrganizationGroupPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...requestOptions,\n },\n operation: commitOrganizationGroupPolicyOperation,\n });\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContainerOperation, createContainerWithMetadataDocumentOperation, deleteContainerOperation, isContainerMutationOperationRequest, isContainerMutationOperationResponse, isContainerRotationOperationRequest, isContainerRotationOperationResponse, isCreateContainerWithMetadataDocumentOperationRequest, isCreateContainerWithMetadataDocumentOperationResponse, isDeleteContainerOperationResponse, moveContainerOperation, operationRequestPath, operationRequestPathWithQuery, reciteContainerOperation, rekeyContainerOperation, revokeContainerOperation, shareContainerOperation, } from "../../../validators/operation/index.js";
|
|
1
|
+
import { createContainerOperation, createContainerWithMetadataDocumentOperation, deleteContainerOperation, isContainerMutationOperationRequest, isContainerMutationOperationResponse, isContainerRotationOperationRequest, isContainerRotationOperationResponse, isCreateContainerWithMetadataDocumentOperationRequest, isCreateContainerWithMetadataDocumentOperationResponse, isDeleteContainerOperationResponse, isShareContainerOperationResponse, moveContainerOperation, operationRequestPath, operationRequestPathWithQuery, reciteContainerOperation, rekeyContainerOperation, revokeContainerOperation, shareContainerOperation, } from "../../../validators/operation/index.js";
|
|
2
2
|
import { isContainerReciteRequest } from "../../../validators/request/index.js";
|
|
3
3
|
import { isContainerReciteResponse } from "../../../validators/response/index.js";
|
|
4
4
|
export const containerRecite = {
|
|
@@ -24,9 +24,9 @@ function containerMutationPath(operation, containerId) {
|
|
|
24
24
|
}
|
|
25
25
|
export const containerShare = {
|
|
26
26
|
isRequest: isContainerMutationOperationRequest,
|
|
27
|
-
isResponse:
|
|
27
|
+
isResponse: isShareContainerOperationResponse,
|
|
28
28
|
method: shareContainerOperation.method,
|
|
29
|
-
path: (containerId) =>
|
|
29
|
+
path: (containerId, readModelCursor) => operationRequestPathWithQuery(shareContainerOperation, { containerId }, { readModelCursor }),
|
|
30
30
|
};
|
|
31
31
|
export const containerRevoke = {
|
|
32
32
|
isRequest: isContainerRotationOperationRequest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,4CAA4C,EAC5C,wBAAwB,EACxB,mCAAmC,EACnC,oCAAoC,EACpC,mCAAmC,EACnC,oCAAoC,EACpC,qDAAqD,EACrD,sDAAsD,EACtD,kCAAkC,EAClC,sBAAsB,EACtB,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,wBAAwB;IACnC,UAAU,EAAE,yBAAyB;IACrC,MAAM,EAAE,wBAAwB,CAAC,MAAM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,CAAC,WAAmB,EAAE,EAAE,CAC5B,qBAAqB,CAAC,uBAAuB,EAAE,WAAW,CAAC;CACrD,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS,EAAE,mCAAmC;IAC9C,UAAU,EAAE,oCAAoC;IAChD,MAAM,EAAE,sBAAsB,CAAC,MAAM;IACrC,IAAI,EAAE,CAAC,WAAmB,EAAE,EAAE,CAC5B,qBAAqB,CAAC,sBAAsB,EAAE,WAAW,CAAC;CACpD,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,UAAU,EAAE,kCAAkC;IAC9C,MAAM,EAAE,wBAAwB,CAAC,MAAM;IACvC,IAAI,EAAE,CAAC,WAAmB,EAAE,kBAA2B,EAAE,EAAE,CACzD,6BAA6B,CAC3B,wBAAwB,EACxB,EAAE,WAAW,EAAE,EACf,EAAE,kBAAkB,EAAE,CACvB;CACK,CAAC","sourcesContent":["import {\n createContainerOperation,\n createContainerWithMetadataDocumentOperation,\n deleteContainerOperation,\n isContainerMutationOperationRequest,\n isContainerMutationOperationResponse,\n isContainerRotationOperationRequest,\n isContainerRotationOperationResponse,\n isCreateContainerWithMetadataDocumentOperationRequest,\n isCreateContainerWithMetadataDocumentOperationResponse,\n isDeleteContainerOperationResponse,\n isShareContainerOperationResponse,\n moveContainerOperation,\n operationRequestPath,\n operationRequestPathWithQuery,\n reciteContainerOperation,\n rekeyContainerOperation,\n revokeContainerOperation,\n shareContainerOperation,\n} from \"@tearleads/validators/operation\";\nimport { isContainerReciteRequest } from \"@tearleads/validators/request\";\nimport { isContainerReciteResponse } from \"@tearleads/validators/response\";\n\nexport const containerRecite = {\n isRequest: isContainerReciteRequest,\n isResponse: isContainerReciteResponse,\n method: reciteContainerOperation.method,\n path: (containerId: string) =>\n operationRequestPath(reciteContainerOperation, { containerId }),\n} as const;\n\nexport const containerCreate = {\n isRequest: isContainerMutationOperationRequest,\n isResponse: isContainerMutationOperationResponse,\n method: createContainerOperation.method,\n path: operationRequestPath(createContainerOperation, {}),\n} as const;\n\nexport const containerCreateWithMetadataDocument = {\n isRequest: isCreateContainerWithMetadataDocumentOperationRequest,\n isResponse: isCreateContainerWithMetadataDocumentOperationResponse,\n method: createContainerWithMetadataDocumentOperation.method,\n path: operationRequestPath(createContainerWithMetadataDocumentOperation, {}),\n} as const;\n\nfunction containerMutationPath(\n operation:\n | typeof moveContainerOperation\n | typeof rekeyContainerOperation\n | typeof revokeContainerOperation,\n containerId: string,\n) {\n return operationRequestPath(operation, { containerId });\n}\n\nexport const containerShare = {\n isRequest: isContainerMutationOperationRequest,\n isResponse: isShareContainerOperationResponse,\n method: shareContainerOperation.method,\n path: (containerId: string, readModelCursor?: string) =>\n operationRequestPathWithQuery(\n shareContainerOperation,\n { containerId },\n { readModelCursor },\n ),\n} as const;\n\nexport const containerRevoke = {\n isRequest: isContainerRotationOperationRequest,\n isResponse: isContainerRotationOperationResponse,\n method: revokeContainerOperation.method,\n path: (containerId: string) =>\n containerMutationPath(revokeContainerOperation, containerId),\n} as const;\n\nexport const containerRekey = {\n isRequest: isContainerRotationOperationRequest,\n isResponse: isContainerRotationOperationResponse,\n method: rekeyContainerOperation.method,\n path: (containerId: string) =>\n containerMutationPath(rekeyContainerOperation, containerId),\n} as const;\n\nexport const containerMove = {\n isRequest: isContainerRotationOperationRequest,\n isResponse: isContainerRotationOperationResponse,\n method: moveContainerOperation.method,\n path: (containerId: string) =>\n containerMutationPath(moveContainerOperation, containerId),\n} as const;\n\nexport const containerDelete = {\n isResponse: isDeleteContainerOperationResponse,\n method: deleteContainerOperation.method,\n path: (containerId: string, requiredAncestorId?: string) =>\n operationRequestPathWithQuery(\n deleteContainerOperation,\n { containerId },\n { requiredAncestorId },\n ),\n} as const;\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { createOrganizationGroupOperation, isCreateOrganizationGroupOperationRequest, isCreateOrganizationGroupOperationResponse,
|
|
1
|
+
import { createOrganizationGroupOperation, isCreateOrganizationGroupOperationRequest, isCreateOrganizationGroupOperationResponse, operationRequestPathWithQuery, } from "../../../validators/operation/index.js";
|
|
2
2
|
export const createOrganizationGroup = {
|
|
3
3
|
isRequest: isCreateOrganizationGroupOperationRequest,
|
|
4
4
|
isResponse: isCreateOrganizationGroupOperationResponse,
|
|
5
5
|
method: createOrganizationGroupOperation.method,
|
|
6
|
-
path(organizationId) {
|
|
7
|
-
return
|
|
8
|
-
organizationId,
|
|
9
|
-
});
|
|
6
|
+
path(organizationId, readModelCursor) {
|
|
7
|
+
return operationRequestPathWithQuery(createOrganizationGroupOperation, { organizationId }, { readModelCursor });
|
|
10
8
|
},
|
|
11
9
|
};
|
|
12
10
|
//# sourceMappingURL=createGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGroup.js","sourceRoot":"","sources":["createGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,yCAAyC,EACzC,0CAA0C,EAC1C,
|
|
1
|
+
{"version":3,"file":"createGroup.js","sourceRoot":"","sources":["createGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,yCAAyC,EACzC,0CAA0C,EAC1C,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,yCAAyC;IACpD,UAAU,EAAE,0CAA0C;IACtD,MAAM,EAAE,gCAAgC,CAAC,MAAM;IAC/C,IAAI,CAAC,cAAsB,EAAE,eAAwB;QACnD,OAAO,6BAA6B,CAClC,gCAAgC,EAChC,EAAE,cAAc,EAAE,EAClB,EAAE,eAAe,EAAE,CACpB,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import {\n createOrganizationGroupOperation,\n isCreateOrganizationGroupOperationRequest,\n isCreateOrganizationGroupOperationResponse,\n operationRequestPathWithQuery,\n} from \"@tearleads/validators/operation\";\n\nexport const createOrganizationGroup = {\n isRequest: isCreateOrganizationGroupOperationRequest,\n isResponse: isCreateOrganizationGroupOperationResponse,\n method: createOrganizationGroupOperation.method,\n path(organizationId: string, readModelCursor?: string) {\n return operationRequestPathWithQuery(\n createOrganizationGroupOperation,\n { organizationId },\n { readModelCursor },\n );\n },\n};\n"]}
|
|
@@ -3,11 +3,8 @@ export const commitOrganizationGroupPolicy = {
|
|
|
3
3
|
isRequest: isCommitOrganizationGroupPolicyOperationRequest,
|
|
4
4
|
isResponse: isCommitOrganizationGroupPolicyOperationResponse,
|
|
5
5
|
method: commitOrganizationGroupPolicyOperation.method,
|
|
6
|
-
path(organizationId, groupId) {
|
|
7
|
-
return
|
|
8
|
-
groupId,
|
|
9
|
-
organizationId,
|
|
10
|
-
});
|
|
6
|
+
path(organizationId, groupId, readModelCursor) {
|
|
7
|
+
return operationRequestPathWithQuery(commitOrganizationGroupPolicyOperation, { groupId, organizationId }, { readModelCursor });
|
|
11
8
|
},
|
|
12
9
|
};
|
|
13
10
|
export const getPrincipalPolicy = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["policy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,oCAAoC,EACpC,2BAA2B,EAC3B,+CAA+C,EAC/C,gDAAgD,EAChD,8CAA8C,EAC9C,qCAAqC,EACrC,oCAAoC,EACpC,qCAAqC,EACrC,oBAAoB,EACpB,6BAA6B,EAE7B,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,SAAS,EAAE,+CAA+C;IAC1D,UAAU,EAAE,gDAAgD;IAC5D,MAAM,EAAE,sCAAsC,CAAC,MAAM;IACrD,IAAI,CAAC,cAAsB,EAAE,OAAe;
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["policy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,oCAAoC,EACpC,2BAA2B,EAC3B,+CAA+C,E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AE;YACvD,WAAW;YACX,aAAa;SACd,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n getPrincipalMemberEnvelopesOperation,\n getPrincipalPolicyOperation,\n isCommitOrganizationGroupPolicyOperationRequest,\n isCommitOrganizationGroupPolicyOperationResponse,\n isGetPrincipalMemberEnvelopesOperationResponse,\n isGetPrincipalPolicyOperationResponse,\n isPutPrincipalPolicyOperationRequest,\n isPutPrincipalPolicyOperationResponse,\n operationRequestPath,\n operationRequestPathWithQuery,\n type PrincipalPolicyPageQuery,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\n\nexport const commitOrganizationGroupPolicy = {\n isRequest: isCommitOrganizationGroupPolicyOperationRequest,\n isResponse: isCommitOrganizationGroupPolicyOperationResponse,\n method: commitOrganizationGroupPolicyOperation.method,\n path(organizationId: string, groupId: string, readModelCursor?: string) {\n return operationRequestPathWithQuery(\n commitOrganizationGroupPolicyOperation,\n { groupId, organizationId },\n { readModelCursor },\n );\n },\n};\n\nexport const getPrincipalPolicy = {\n isResponse: isGetPrincipalPolicyOperationResponse,\n method: getPrincipalPolicyOperation.method,\n path(\n principalType: \"group\" | \"organization\",\n principalId: string,\n query: PrincipalPolicyPageQuery = {},\n ) {\n return operationRequestPathWithQuery(\n getPrincipalPolicyOperation,\n {\n principalId,\n principalType,\n },\n query,\n );\n },\n};\n\nexport const getPrincipalMemberEnvelopes = {\n isResponse: isGetPrincipalMemberEnvelopesOperationResponse,\n method: getPrincipalMemberEnvelopesOperation.method,\n path(\n principalType: \"group\" | \"organization\",\n principalId: string,\n stateHash: string,\n ) {\n return operationRequestPathWithQuery(\n getPrincipalMemberEnvelopesOperation,\n { principalId, principalType },\n { stateHash },\n );\n },\n};\n\nexport const putPrincipalPolicy = {\n isRequest: isPutPrincipalPolicyOperationRequest,\n isResponse: isPutPrincipalPolicyOperationResponse,\n method: putPrincipalPolicyOperation.method,\n path(principalType: \"organization\", principalId: string) {\n return operationRequestPath(putPrincipalPolicyOperation, {\n principalId,\n principalType,\n });\n },\n};\n"]}
|
|
@@ -22,6 +22,12 @@ export interface RequestResultOptions {
|
|
|
22
22
|
* changes which hashes the read cites, never what the read accepts.
|
|
23
23
|
*/
|
|
24
24
|
readonly projectionListing?: WriterProjectionListing | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Group creates, group policy commits and shares only: the organization
|
|
27
|
+
* read-model cursor the caller holds. The response then carries the
|
|
28
|
+
* read-model delta from it when the commit advanced from that cursor.
|
|
29
|
+
*/
|
|
30
|
+
readonly readModelCursor?: string | undefined;
|
|
25
31
|
}
|
|
26
32
|
export type OperationRequestFn = <T>(path: string, validator: (value: unknown) => value is T, method: HttpMethod, body: RequestBody | undefined, options: RequestResultOptions | undefined, failureOperation: HttpOperation) => Promise<T | null>;
|
|
27
33
|
export type OperationRequestResultFn = <T>(path: string, validator: (value: unknown) => value is T, method: HttpMethod, body: RequestBody | undefined, options: RequestResultOptions | undefined, failureOperation: HttpOperation) => Promise<RequestResult<T>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentAttributionRangesQuery,\n HttpOperation,\n HttpOperationMethod,\n} from \"@tearleads/validators/operation\";\nimport type { ReferencedPrincipalStateResponse } from \"@tearleads/validators/response\";\nimport type { ApiNetworkError } from \"./networkFailure\";\nimport type { WriterProjectionListing } from \"./verifiedManifestCitations\";\n\nexport type HttpMethod = HttpOperationMethod;\nexport type RequestBody = BodyInit;\n\nexport type ListDocumentEditAttributionRangesOptions = Omit<\n DocumentAttributionRangesQuery,\n \"cursor\"\n> & {\n cursor?: DocumentAttributionRangesQuery[\"cursor\"] | null;\n};\n\nexport interface RequestResultOptions {\n readonly signal?: AbortSignal | undefined;\n /** Expected target for a declared 402; mismatched response identities fail closed. */\n readonly expectedPaymentRequiredOrganizationId?: string | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly reportErrors?: boolean | undefined;\n /** Called after this request or a concurrent request renews the same session. */\n readonly onSessionRenewed?: (() => void) | undefined;\n readonly retryOnSessionExpired?: boolean | \"renew-only\" | undefined;\n /**\n * Writer-projection reads only: where a listing placed the container, so\n * an unplaced container can cite its listed parent's held bytes. It\n * changes which hashes the read cites, never what the read accepts.\n */\n readonly projectionListing?: WriterProjectionListing | undefined;\n}\n\nexport type OperationRequestFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<T | null>;\n\nexport type OperationRequestResultFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<RequestResult<T>>;\n\nexport type RequestFailureKind =\n | \"storage\"\n | \"http\"\n | \"network\"\n | \"json\"\n | \"shape\"\n | \"cancelled\"\n | \"outcome-unknown\";\n\nexport interface RequestFailure {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n /** Set when the fetch itself threw: what the client could observe, without secrets. */\n readonly networkError?: ApiNetworkError | undefined;\n readonly ok: false;\n readonly path: string;\n readonly report: () => void;\n readonly status: number | null;\n readonly statusText: string;\n readonly stalePrincipalHeads?: ReferencedPrincipalStateResponse[] | undefined;\n /**\n * With `container_descendant_rekeys_required`, the full owed set, parent-first;\n * with `container_descendant_rekeys_inaccessible`, its unwritable subset.\n * A hint, never authority; verify each container before signing for it.\n */\n readonly requiredContainerIds?: readonly string[] | undefined;\n}\n\nexport interface RequestSuccess<T> {\n readonly data: T;\n readonly ok: true;\n}\n\nexport type RequestResult<T> = RequestFailure | RequestSuccess<T>;\n\nexport interface ResponseRequestValidationFailureInput {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n readonly options?: RequestResultOptions | undefined;\n readonly path: string;\n readonly status: number | null;\n readonly statusText: string;\n}\n\nexport interface OperationResponseRequestFn {\n (\n path: string,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions,\n additionalSuccessStatuses: readonly number[],\n failureOperation: HttpOperation,\n ): Promise<RequestResult<Response>>;\n readonly reportFailure: (\n input: ResponseRequestValidationFailureInput,\n ) => RequestFailure;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DocumentAttributionRangesQuery,\n HttpOperation,\n HttpOperationMethod,\n} from \"@tearleads/validators/operation\";\nimport type { ReferencedPrincipalStateResponse } from \"@tearleads/validators/response\";\nimport type { ApiNetworkError } from \"./networkFailure\";\nimport type { WriterProjectionListing } from \"./verifiedManifestCitations\";\n\nexport type HttpMethod = HttpOperationMethod;\nexport type RequestBody = BodyInit;\n\nexport type ListDocumentEditAttributionRangesOptions = Omit<\n DocumentAttributionRangesQuery,\n \"cursor\"\n> & {\n cursor?: DocumentAttributionRangesQuery[\"cursor\"] | null;\n};\n\nexport interface RequestResultOptions {\n readonly signal?: AbortSignal | undefined;\n /** Expected target for a declared 402; mismatched response identities fail closed. */\n readonly expectedPaymentRequiredOrganizationId?: string | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly reportErrors?: boolean | undefined;\n /** Called after this request or a concurrent request renews the same session. */\n readonly onSessionRenewed?: (() => void) | undefined;\n readonly retryOnSessionExpired?: boolean | \"renew-only\" | undefined;\n /**\n * Writer-projection reads only: where a listing placed the container, so\n * an unplaced container can cite its listed parent's held bytes. It\n * changes which hashes the read cites, never what the read accepts.\n */\n readonly projectionListing?: WriterProjectionListing | undefined;\n /**\n * Group creates, group policy commits and shares only: the organization\n * read-model cursor the caller holds. The response then carries the\n * read-model delta from it when the commit advanced from that cursor.\n */\n readonly readModelCursor?: string | undefined;\n}\n\nexport type OperationRequestFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<T | null>;\n\nexport type OperationRequestResultFn = <T>(\n path: string,\n validator: (value: unknown) => value is T,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions | undefined,\n failureOperation: HttpOperation,\n) => Promise<RequestResult<T>>;\n\nexport type RequestFailureKind =\n | \"storage\"\n | \"http\"\n | \"network\"\n | \"json\"\n | \"shape\"\n | \"cancelled\"\n | \"outcome-unknown\";\n\nexport interface RequestFailure {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n /** Set when the fetch itself threw: what the client could observe, without secrets. */\n readonly networkError?: ApiNetworkError | undefined;\n readonly ok: false;\n readonly path: string;\n readonly report: () => void;\n readonly status: number | null;\n readonly statusText: string;\n readonly stalePrincipalHeads?: ReferencedPrincipalStateResponse[] | undefined;\n /**\n * With `container_descendant_rekeys_required`, the full owed set, parent-first;\n * with `container_descendant_rekeys_inaccessible`, its unwritable subset.\n * A hint, never authority; verify each container before signing for it.\n */\n readonly requiredContainerIds?: readonly string[] | undefined;\n}\n\nexport interface RequestSuccess<T> {\n readonly data: T;\n readonly ok: true;\n}\n\nexport type RequestResult<T> = RequestFailure | RequestSuccess<T>;\n\nexport interface ResponseRequestValidationFailureInput {\n readonly code?: string | undefined;\n readonly kind: RequestFailureKind;\n readonly message: string;\n readonly method: HttpMethod;\n readonly options?: RequestResultOptions | undefined;\n readonly path: string;\n readonly status: number | null;\n readonly statusText: string;\n}\n\nexport interface OperationResponseRequestFn {\n (\n path: string,\n method: HttpMethod,\n body: RequestBody | undefined,\n options: RequestResultOptions,\n additionalSuccessStatuses: readonly number[],\n failureOperation: HttpOperation,\n ): Promise<RequestResult<Response>>;\n readonly reportFailure: (\n input: ResponseRequestValidationFailureInput,\n ) => RequestFailure;\n}\n"]}
|
|
@@ -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
|
|
83
|
-
if (
|
|
84
|
-
held.directories.set(
|
|
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,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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,
|
|
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,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,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 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,EA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yBAAyB,EACzB,0CAA0C,EAC1C,gCAAgC,EAChC,+BAA+B,EAC/B,yBAAyB,EACzB,mCAAmC,EACnC,8BAA8B,EAC9B,+BAA+B,EAC/B,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,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.
|
|
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;
|
|
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,
|
|
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":"
|
|
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"]}
|