@tearleads/client-sdk 0.1.75 → 0.1.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/data/containers/shared/mutationAcknowledgement.d.ts +38 -0
  2. package/data/{containers → persistence/container-contents}/containerBinding.js +1 -1
  3. package/data/persistence/container-contents/containerContentsPersistence.js +2 -2
  4. package/data/persistence/container-contents/containerContentsPersistence.js.map +1 -1
  5. package/data/persistence/container-contents/containerContentsPersistenceTypes.d.ts +2 -2
  6. package/data/persistence/container-contents/containerContentsPersistenceTypes.js.map +1 -1
  7. package/data/persistence/container-contents/containerDeletionPersistence.js +2 -2
  8. package/data/persistence/container-contents/containerDeletionPersistence.js.map +1 -1
  9. package/data/persistence/container-contents/containerHydrationPersistence.js +2 -2
  10. package/data/persistence/container-contents/containerHydrationPersistence.js.map +1 -1
  11. package/data/persistence/container-contents/containerMetadataMutationPersistence.js +2 -2
  12. package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
  13. package/data/persistence/container-contents/containerMetadataRows.js +1 -1
  14. package/data/persistence/container-contents/containerMetadataRows.js.map +1 -1
  15. package/data/persistence/container-contents/containerRebindPersistence.js.map +1 -1
  16. package/data/persistence/container-contents/containerReconcilePersistence.js +2 -2
  17. package/data/persistence/container-contents/containerReconcilePersistence.js.map +1 -1
  18. package/data/persistence/container-contents/containerStructuralRepair.js +1 -1
  19. package/data/persistence/container-contents/containerStructuralRepair.js.map +1 -1
  20. package/data/persistence/container-contents/dormantMetadataSweep.js +1 -1
  21. package/data/persistence/container-contents/dormantMetadataSweep.js.map +1 -1
  22. package/data/persistence/documents/internal/containerDocumentTombstoneHolds.js +1 -1
  23. package/data/persistence/documents/internal/containerDocumentTombstoneHolds.js.map +1 -1
  24. package/data/persistence/documents/internal/containerDocumentTombstones.js +1 -1
  25. package/data/persistence/documents/internal/containerDocumentTombstones.js.map +1 -1
  26. package/data/persistence/documents/internal/discoveredDocumentPlacement.js +1 -1
  27. package/data/persistence/documents/internal/discoveredDocumentPlacement.js.map +1 -1
  28. package/data/principals/currentPolicyReferenceResolver.d.ts +3 -0
  29. package/index.d.ts +2 -2
  30. package/index.js +2 -2
  31. package/index.js.map +1 -1
  32. package/package.json +1 -1
  33. package/stores/container-contents/systemContainers/systemContainerIcon.js +1 -1
  34. package/stores/container-contents/systemContainers/systemContainerIcon.js.map +1 -1
  35. package/workflows/container-contents/container-state/create/createChild.js +1 -1
  36. package/workflows/container-contents/container-state/create/createChild.js.map +1 -1
  37. package/workflows/container-contents/container-state/purge/purgeTree.js +1 -1
  38. package/workflows/container-contents/container-state/purge/purgeTree.js.map +1 -1
  39. package/workflows/container-contents/container-state/remote.js +1 -1
  40. package/workflows/container-contents/container-state/remote.js.map +1 -1
  41. package/workflows/container-contents/container-state/share/groupGrantVerification.js +1 -1
  42. package/workflows/container-contents/container-state/share/groupGrantVerification.js.map +1 -1
  43. package/workflows/container-contents/container-state/share/groupShareEpoch.js +1 -1
  44. package/workflows/container-contents/container-state/share/groupShareEpoch.js.map +1 -1
  45. package/workflows/container-contents/container-state/types.js.map +1 -1
  46. package/workflows/container-contents/containerPersistence.d.ts +3 -3
  47. package/workflows/container-contents/containerPersistence.js +1 -1
  48. package/workflows/container-contents/containerPersistence.js.map +1 -1
  49. package/workflows/container-contents/documentLinks/documentLinkIntent.js +1 -1
  50. package/workflows/container-contents/documentLinks/documentLinkIntent.js.map +1 -1
  51. package/workflows/container-contents/documentLinks/index.js +1 -1
  52. package/workflows/container-contents/documentLinks/index.js.map +1 -1
  53. package/workflows/container-contents/documentMove/documentMoveIntent.js +1 -1
  54. package/workflows/container-contents/documentMove/documentMoveIntent.js.map +1 -1
  55. package/workflows/container-contents/documentMove/documentMoveIntentSettlement.js +2 -2
  56. package/workflows/container-contents/documentMove/documentMoveIntentSettlement.js.map +1 -1
  57. package/workflows/container-contents/documentQueries/documentSubtreeQueries.js +1 -1
  58. package/workflows/container-contents/documentQueries/documentSubtreeQueries.js.map +1 -1
  59. package/workflows/container-contents/documentQueries/index.js +3 -3
  60. package/workflows/container-contents/documentQueries/index.js.map +1 -1
  61. package/workflows/container-contents/documentQueries/pendingDownloads.js +1 -1
  62. package/workflows/container-contents/documentQueries/pendingDownloads.js.map +1 -1
  63. package/workflows/container-contents/index.d.ts +1 -1
  64. package/workflows/container-contents/index.js +1 -1
  65. package/workflows/container-contents/index.js.map +1 -1
  66. package/workflows/container-contents/info/blobInfo.js +1 -1
  67. package/workflows/container-contents/info/blobInfo.js.map +1 -1
  68. package/workflows/container-contents/info/containerInfo.js +2 -2
  69. package/workflows/container-contents/info/containerInfo.js.map +1 -1
  70. package/{data/containers → workflows/container-contents/metadata}/containerMetadataDocument.d.ts +1 -1
  71. package/{data/containers → workflows/container-contents/metadata}/containerMetadataDocument.js +2 -2
  72. package/workflows/container-contents/metadata/containerMetadataDocument.js.map +1 -0
  73. package/workflows/container-contents/metadata/metadataMutationPreparation.js +1 -1
  74. package/workflows/container-contents/metadata/metadataMutationPreparation.js.map +1 -1
  75. package/workflows/container-contents/metadata/metadataPersistence.js +1 -1
  76. package/workflows/container-contents/metadata/metadataPersistence.js.map +1 -1
  77. package/workflows/container-contents/metadata/metadataRecord.js.map +1 -1
  78. package/workflows/container-contents/metadata/metadataStateIsolation.js +1 -1
  79. package/workflows/container-contents/metadata/metadataStateIsolation.js.map +1 -1
  80. package/workflows/container-contents/metadata/metadataSyncSettlement.js +1 -1
  81. package/workflows/container-contents/metadata/metadataSyncSettlement.js.map +1 -1
  82. package/workflows/container-contents/metadata/metadataTypes.d.ts +2 -2
  83. package/workflows/container-contents/metadata/metadataTypes.js.map +1 -1
  84. package/workflows/container-contents/recovery/folderRecovery.js +1 -1
  85. package/workflows/container-contents/recovery/folderRecovery.js.map +1 -1
  86. package/workflows/container-contents/remoteHydration/destination/replacementBinding.js +1 -1
  87. package/workflows/container-contents/remoteHydration/destination/replacementBinding.js.map +1 -1
  88. package/workflows/container-contents/remoteHydration/destination/verifiedDestination.js +1 -1
  89. package/workflows/container-contents/remoteHydration/destination/verifiedDestination.js.map +1 -1
  90. package/workflows/container-contents/remoteHydration/heldContainerRebind.js +1 -1
  91. package/workflows/container-contents/remoteHydration/heldContainerRebind.js.map +1 -1
  92. package/workflows/container-contents/remoteHydration/reattachMetadata.js +1 -1
  93. package/workflows/container-contents/remoteHydration/reattachMetadata.js.map +1 -1
  94. package/workflows/container-contents/remoteHydration/remoteContainers/insertRemoteContainer.js +2 -2
  95. package/workflows/container-contents/remoteHydration/remoteContainers/insertRemoteContainer.js.map +1 -1
  96. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js +1 -1
  97. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js.map +1 -1
  98. package/workflows/container-contents/remoteHydration/types.d.ts +1 -1
  99. package/workflows/container-contents/remoteHydration/types.js.map +1 -1
  100. package/workflows/container-contents/storedContainerState.js +1 -1
  101. package/workflows/container-contents/storedContainerState.js.map +1 -1
  102. package/workflows/containers/child/mutationSubmit.d.ts +76 -0
  103. package/workflows/containers/child/rekey/carriedDescendantRekeys.d.ts +70 -0
  104. package/workflows/containers/child/share/index.d.ts +1 -38
  105. package/workflows/containers/child/share/index.js +1 -205
  106. package/workflows/containers/child/share/index.js.map +1 -1
  107. package/workflows/containers/child/share/shareAncestorRepair.d.ts +37 -0
  108. package/workflows/containers/child/share/shareProjection.d.ts +7 -0
  109. package/workflows/containers/index.d.ts +3 -2
  110. package/workflows/containers/index.js +4 -2
  111. package/workflows/containers/index.js.map +1 -1
  112. package/workflows/organizations/currentOrganizationAuthority.d.ts +21 -0
  113. package/workflows/organizations/groupMetadata/groupMetadataAccess.js +1 -1
  114. package/workflows/organizations/groupMetadata/groupMetadataAccess.js.map +1 -1
  115. package/workflows/organizations/groupMetadata/groupMetadataRuntime.d.ts +30 -0
  116. package/workflows/{containers/child/share → organizations/groupShare}/currentShareGrantMutation.js +6 -6
  117. package/workflows/organizations/groupShare/currentShareGrantMutation.js.map +1 -0
  118. package/workflows/organizations/groupShare/currentSharePrincipalPolicy.d.ts +30 -0
  119. package/workflows/{containers/child/share → organizations/groupShare}/currentSharePrincipalPolicy.js +10 -10
  120. package/workflows/organizations/groupShare/currentSharePrincipalPolicy.js.map +1 -0
  121. package/workflows/organizations/groupShare/index.d.ts +4 -0
  122. package/workflows/organizations/groupShare/index.js +7 -0
  123. package/workflows/organizations/groupShare/index.js.map +1 -0
  124. package/workflows/organizations/groupShare/runtimeCurrentGroupShare.d.ts +4 -0
  125. package/workflows/{containers/child/share → organizations/groupShare}/runtimeCurrentGroupShare.js +6 -8
  126. package/workflows/organizations/groupShare/runtimeCurrentGroupShare.js.map +1 -0
  127. package/workflows/{containers/child/share → organizations/groupShare}/sharePrincipalPolicy.d.ts +9 -9
  128. package/workflows/{containers/child/share → organizations/groupShare}/sharePrincipalPolicy.js +13 -13
  129. package/workflows/organizations/groupShare/sharePrincipalPolicy.js.map +1 -0
  130. package/workflows/organizations/groupShare/shareWithGroup.d.ts +44 -0
  131. package/workflows/organizations/groupShare/shareWithGroup.js +210 -0
  132. package/workflows/organizations/groupShare/shareWithGroup.js.map +1 -0
  133. package/workflows/organizations/index.d.ts +1 -0
  134. package/workflows/organizations/index.js +1 -0
  135. package/workflows/organizations/index.js.map +1 -1
  136. package/workflows/organizations/principalMutations/currentPrincipalMutationLease.d.ts +16 -0
  137. package/workflows/organizations/readModel/localReadModelDetails.js +1 -1
  138. package/workflows/organizations/readModel/localReadModelDetails.js.map +1 -1
  139. package/workflows/principals/runtimePolicyRecovery.d.ts +42 -0
  140. package/workflows/registration/bootstrapRootContainer.js +1 -1
  141. package/workflows/registration/bootstrapRootContainer.js.map +1 -1
  142. package/workflows/registration/provisioningBootstrapBuilders.js +1 -1
  143. package/workflows/registration/provisioningBootstrapBuilders.js.map +1 -1
  144. package/workflows/registration/rootMetadataBootstrap.js +1 -1
  145. package/workflows/registration/rootMetadataBootstrap.js.map +1 -1
  146. package/workflows/sync/remoteReset.js +1 -1
  147. package/workflows/sync/remoteReset.js.map +1 -1
  148. package/data/containers/containerMetadataDocument.js.map +0 -1
  149. package/workflows/containers/child/share/currentShareGrantMutation.js.map +0 -1
  150. package/workflows/containers/child/share/currentSharePrincipalPolicy.js.map +0 -1
  151. package/workflows/containers/child/share/runtimeCurrentGroupShare.js.map +0 -1
  152. package/workflows/containers/child/share/sharePrincipalPolicy.js.map +0 -1
  153. /package/data/{containers → persistence/container-contents}/containerBinding.d.ts +0 -0
  154. /package/data/{containers → persistence/container-contents}/containerBinding.js.map +0 -0
  155. /package/data/persistence/{containers → container-contents}/containerPersistence.d.ts +0 -0
  156. /package/data/persistence/{containers → container-contents}/containerPersistence.js +0 -0
  157. /package/data/persistence/{containers → container-contents}/containerPersistence.js.map +0 -0
  158. /package/data/persistence/{containers → container-contents}/containerSyncWatermarkPersistence.d.ts +0 -0
  159. /package/data/persistence/{containers → container-contents}/containerSyncWatermarkPersistence.js +0 -0
  160. /package/data/persistence/{containers → container-contents}/containerSyncWatermarkPersistence.js.map +0 -0
  161. /package/data/persistence/{containers → container-contents}/documentContainerProjectionPersistence.js +0 -0
  162. /package/data/persistence/{containers → container-contents}/documentContainerProjectionPersistence.js.map +0 -0
  163. /package/data/persistence/{containers → container-contents}/documentPlacement.js +0 -0
  164. /package/data/persistence/{containers → container-contents}/documentPlacement.js.map +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"sharePrincipalPolicy.js","sourceRoot":"","sources":["sharePrincipalPolicy.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,GAIxB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,uCAAuC,EAAE,MAAM,qDAAqD,CAAC;AAC9G,OAAO,EAAE,kCAAkC,EAAE,MAAM,mFAAmF,CAAC;AACvI,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAC3H,OAAO,EAAE,yBAAyB,EAAE,MAAM,yEAAyE,CAAC;AACpH,OAAO,EAAE,qCAAqC,E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,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;QAC9B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,MAAM,EAAE,QAAQ,CAAC,KAAK;KACvB,CAAC;AACJ,CAAC","sourcesContent":["import type { ApiClient } from \"@tearleads/api-client\";\nimport {\n KeyingVerificationError,\n type PrincipalPolicyCheckpoint,\n type ReferencedPrincipalHead,\n type VerifiedPrincipalPolicy,\n} from \"@tearleads/crypto\";\nimport type { CommitOrganizationGroupPolicyRequest } from \"@tearleads/validators/request\";\nimport type {\n CommitOrganizationGroupPolicyResponse,\n PrincipalPolicyBundleResponse,\n} from \"@tearleads/validators/response\";\nimport type { ContainerShareApi } from \"../../../../data/containers/shared/types\";\nimport { throwKeyingVerificationErrorWithContext } from \"../../../../data/keyingProjectionVerification/error\";\nimport { advanceKeyingCheckpointsAtomically } from \"../../../../data/persistence/keyingCheckpoints/keyingCheckpointAdvancePersistence\";\nimport { loadPrincipalPolicyCheckpoint } from \"../../../../data/persistence/keyingCheckpoints/keyingCheckpointPersistence\";\nimport { savePrincipalPolicyBundle } from \"../../../../data/persistence/principalPolicy/principalPolicyPersistence\";\nimport { loadPrincipalPolicyBundleForReference } from \"../../../../data/persistence/principalPolicy/principalPolicyReferencePersistence\";\nimport { retainVerifiedPrincipalPolicyBundle } from \"../../../../data/persistence/principalPolicy/verifiedPrincipalPolicyRetentionPersistence\";\nimport {\n principalHeadMatchesReference,\n requireOrganizationGroupHead,\n} from \"../../../../data/principals/organizationAuthorityDescriptor\";\nimport {\n principalPolicyReferenceFromBundle,\n verifyPrincipalPolicyBundleWithExternalOrganizationAdmins,\n} from \"../../../../data/principals/principalPolicyAdminSigners\";\nimport type { ExecSql } from \"../../../../data/sqlite/sqlSchema\";\nimport type { TrustedUserIdentityResolver } from \"../../../../data/trustedUserIdentity\";\nimport { assertGroupMetadataBinding } from \"../../../organizations/groupMetadata/groupMetadataBinding\";\nimport {\n type GroupPolicyNameReader,\n groupPolicyNameMismatch,\n} from \"../../../organizations/principalPolicy/principalPolicyRequest\";\nimport type { CurrentPrincipalPolicyReader } from \"../../../principals/currentPrincipalPolicyReader\";\nimport {\n externalAdminPolicyPersistenceEntries,\n loadOrganizationExternalAdminPolicy,\n type VerifiedExternalAdminPolicy,\n} from \"../../../principals/externalAdminPolicy\";\nimport {\n collectPrincipalPolicySignerPublicKeys,\n type PrincipalPolicySignerPublicKeyLoadErrorCode,\n} from \"../../../principals/policyVerification\";\n\nexport interface ContainerManagedPrincipalShareApi\n extends ContainerShareApi,\n CurrentPrincipalPolicyReader,\n Pick<\n ApiClient,\n \"evictContainerWriterProjection\" | \"getContainerWriterProjectionResult\"\n > {\n readonly recoverPendingPrincipalMutation?:\n | ((organizationId: string) => Promise<void>)\n | undefined;\n commitOrganizationGroupPolicy: (\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n ) => Promise<CommitOrganizationGroupPolicyResponse | null>;\n}\n\nexport interface VerifiedSharePrincipalPolicy {\n readonly bundle: PrincipalPolicyBundleResponse;\n readonly checkpointPolicies: readonly VerifiedPrincipalPolicy[];\n readonly dependencyBundles: readonly PrincipalPolicyBundleResponse[];\n readonly organizationId: string;\n readonly policy: VerifiedPrincipalPolicy;\n}\n\nasync function retainVerifiedSharePolicies(input: {\n bundle: PrincipalPolicyBundleResponse;\n execSql: ExecSql;\n organizationId: string;\n organizationPolicy: VerifiedExternalAdminPolicy | null;\n policy: VerifiedPrincipalPolicy;\n stillCurrent?: (() => boolean) | undefined;\n}): Promise<VerifiedPrincipalPolicy[]> {\n const retainedAt = new Date().toISOString();\n if (input.organizationPolicy) {\n for (const entry of externalAdminPolicyPersistenceEntries(\n input.organizationPolicy,\n )) {\n await retainVerifiedPrincipalPolicyBundle({\n ...entry,\n execSql: input.execSql,\n organizationId: input.organizationId,\n stillCurrent: input.stillCurrent,\n updatedAt: retainedAt,\n });\n }\n }\n await retainVerifiedPrincipalPolicyBundle({\n bundle: input.bundle,\n execSql: input.execSql,\n organizationId: input.organizationId,\n policy: input.policy,\n stillCurrent: input.stillCurrent,\n updatedAt: retainedAt,\n });\n return [\n ...(input.organizationPolicy\n ? externalAdminPolicyPersistenceEntries(input.organizationPolicy).map(\n (entry) => entry.policy,\n )\n : []),\n input.policy,\n ];\n}\n\n/**\n * Commits the verification a loadVerifiedGroupSharePrincipalPolicy call\n * deferred: advances the keying checkpoints for the verified policies and\n * caches the dependency bundles they were verified against.\n */\nexport async function advanceVerifiedSharePolicies(\n execSql: ExecSql,\n verified: Pick<\n VerifiedSharePrincipalPolicy,\n \"checkpointPolicies\" | \"dependencyBundles\" | \"organizationId\"\n >,\n stillCurrent?: (() => boolean) | undefined,\n): Promise<void> {\n await advanceKeyingCheckpointsAtomically({\n access: [],\n execSql,\n organizationId: verified.organizationId,\n policies: verified.checkpointPolicies,\n stillCurrent,\n });\n if (stillCurrent?.() === false) return;\n for (const bundle of verified.dependencyBundles) {\n await savePrincipalPolicyBundle(\n execSql,\n bundle,\n new Date().toISOString(),\n verified.organizationId,\n { stillCurrent },\n );\n if (stillCurrent?.() === false) return;\n }\n}\n\nfunction assertGroupPolicyTarget(\n bundle: PrincipalPolicyBundleResponse,\n groupId: string,\n): void {\n if (\n bundle.currentState.principalType !== \"group\" ||\n bundle.currentState.principalId !== groupId\n ) {\n throw new Error(\"Container share principal policy target mismatch\");\n }\n}\n\nfunction signerPublicKeyLoadErrorMessage(\n code: PrincipalPolicySignerPublicKeyLoadErrorCode,\n): string {\n switch (code) {\n case \"fingerprint-mismatch\":\n return \"principal policy signer key fingerprint mismatch\";\n case \"not-found\":\n return \"principal policy signer key could not be loaded\";\n }\n}\n\nasync function loadGroupSharePolicyBundle(input: {\n apiClient: ContainerManagedPrincipalShareApi;\n execSql: ExecSql;\n expectedGroupHead?: ReferencedPrincipalHead | undefined;\n groupId: string;\n localCheckpoint: PrincipalPolicyCheckpoint | null;\n}): Promise<PrincipalPolicyBundleResponse> {\n if (\n input.expectedGroupHead &&\n (input.expectedGroupHead.principalType !== \"group\" ||\n input.expectedGroupHead.principalId !== input.groupId)\n ) {\n throw new Error(\"Container share expected group policy target mismatch\");\n }\n const bundleFromCache = input.expectedGroupHead\n ? await loadPrincipalPolicyBundleForReference(\n input.execSql,\n input.expectedGroupHead,\n input.localCheckpoint,\n )\n : null;\n let bundle = bundleFromCache;\n bundle ??= await input.apiClient.getCurrentPrincipalPolicy(\n \"group\",\n input.groupId,\n );\n if (!bundle) {\n throw new Error(\"Container share principal policy could not be loaded\");\n }\n assertGroupPolicyTarget(bundle, input.groupId);\n if (\n input.expectedGroupHead &&\n !principalHeadMatchesReference(\n principalPolicyReferenceFromBundle(bundle),\n input.expectedGroupHead,\n )\n ) {\n throw new Error(\n \"Container share group policy does not match the signed organization directory\",\n );\n }\n return bundle;\n}\n\n/**\n * The chosen group label does not match the name in the group's verified\n * policy. A KeyingVerificationError (so it is reported as an incident), with\n * its own class so a caller can tell this refusal from every other\n * `object_mismatch` and say what happened.\n */\nexport class GroupShareNameMismatchError extends KeyingVerificationError {\n constructor(message: string) {\n super(\"object_mismatch\", message);\n this.name = \"GroupShareNameMismatchError\";\n }\n}\n\n/**\n * The share picker labels groups from the organization read model, which a\n * compromised server can relabel, so the name the user chose must equal the\n * name committed in the target's verified policy. Names compare by their\n * canonical key so look-alike spellings count as the same name. Uniqueness of\n * signed names within an organization is enforced where names enter — group\n * creation verifies every group in the signed directory — so a single\n * verified match identifies the group.\n */\nasync function assertShareGroupName(input: {\n readEncryptedName?: GroupPolicyNameReader | undefined;\n bundle: PrincipalPolicyBundleResponse;\n expectedGroupName: string;\n}): Promise<void> {\n // The label comes from the untrusted read model. Signed names never carry\n // an invisible code point, so a label that does is a look-alike that would\n // only match after canonicalization strips it; refuse it outright.\n const mismatch = await groupPolicyNameMismatch(\n input.bundle,\n input.expectedGroupName,\n input.readEncryptedName,\n );\n if (mismatch === \"forbidden_characters\") {\n throw new GroupShareNameMismatchError(\n \"Container share group name contains control or format characters\",\n );\n }\n if (mismatch === \"name_mismatch\") {\n throw new GroupShareNameMismatchError(\n \"Container share group name does not match the signed group policy\",\n );\n }\n}\n\nexport async function loadVerifiedGroupSharePrincipalPolicy(input: {\n readEncryptedName?: GroupPolicyNameReader | undefined;\n apiClient: ContainerManagedPrincipalShareApi;\n execSql: ExecSql;\n expectedGroupHead?: ReferencedPrincipalHead | undefined;\n /**\n * The display name the user chose the group by. The read model that labels\n * groups is a server projection; only the name committed in the signed\n * group payload can confirm the share lands on the group the user saw.\n */\n expectedGroupName?: string | undefined;\n groupId: string;\n organizationId: string;\n resolveTrustedUserIdentity: TrustedUserIdentityResolver;\n stillCurrent?: (() => boolean) | undefined;\n}): Promise<VerifiedSharePrincipalPolicy> {\n const organizationAdminPolicy = await loadOrganizationExternalAdminPolicy({\n currentPolicyReader: input.apiClient,\n execSql: input.execSql,\n organizationId: input.organizationId,\n resolveTrustedUserIdentity: input.resolveTrustedUserIdentity,\n stillCurrent: input.stillCurrent,\n });\n if (!organizationAdminPolicy) {\n throw new Error(\"Organization admin authority could not be verified\");\n }\n const committedGroupHead = requireOrganizationGroupHead(\n organizationAdminPolicy.descriptor,\n input.groupId,\n );\n if (\n input.expectedGroupHead &&\n !principalHeadMatchesReference(input.expectedGroupHead, committedGroupHead)\n ) {\n throw new Error(\n \"Container share expected group head conflicts with the signed organization directory\",\n );\n }\n const localCheckpoint = await loadPrincipalPolicyCheckpoint(\n input.execSql,\n \"group\",\n input.groupId,\n );\n const bundle = await loadGroupSharePolicyBundle({\n ...input,\n expectedGroupHead: committedGroupHead,\n localCheckpoint,\n });\n const signerPublicKeys = await collectPrincipalPolicySignerPublicKeys({\n bundle,\n resolveTrustedUserIdentity: input.resolveTrustedUserIdentity,\n });\n if (\"error\" in signerPublicKeys) {\n throw new Error(signerPublicKeyLoadErrorMessage(signerPublicKeys.error));\n }\n\n const verified =\n await verifyPrincipalPolicyBundleWithExternalOrganizationAdmins({\n bundle,\n expectedReference: committedGroupHead,\n loadExternalAuthority: async () =>\n organizationAdminPolicy.externalAuthority,\n localCheckpoint,\n signerPublicKeys: signerPublicKeys.signerPublicKeys,\n });\n if (!verified.ok) {\n throwKeyingVerificationErrorWithContext(\n verified.error,\n \"Container share principal policy verification failed\",\n );\n }\n assertGroupMetadataBinding(bundle, organizationAdminPolicy.descriptor);\n if (input.expectedGroupName !== undefined) {\n await assertShareGroupName({\n readEncryptedName: input.readEncryptedName,\n bundle,\n expectedGroupName: input.expectedGroupName,\n });\n }\n\n const checkpointPolicies = await retainVerifiedSharePolicies({\n bundle,\n execSql: input.execSql,\n organizationId: input.organizationId,\n organizationPolicy: organizationAdminPolicy,\n policy: verified.value,\n stillCurrent: input.stillCurrent,\n });\n return {\n bundle,\n checkpointPolicies,\n dependencyBundles: externalAdminPolicyPersistenceEntries(\n organizationAdminPolicy,\n ).map((entry) => entry.bundle),\n organizationId: input.organizationId,\n policy: verified.value,\n };\n}\n"]}