@tearleads/client-sdk 0.1.201 → 0.1.202
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/principalMutations.js +8 -4
- package/client/organizations/principalMutations.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/workflows/container-contents/container-state/remote.js +23 -28
- package/workflows/container-contents/container-state/remote.js.map +1 -1
- package/workflows/container-contents/container-state/types.js.map +1 -1
- package/workflows/containers/child/create/createSubmission.d.ts +6 -8
- package/workflows/containers/child/create/createSubmission.js.map +1 -1
- package/workflows/containers/child/create/index.d.ts +4 -3
- package/workflows/containers/child/create/index.js +7 -1
- package/workflows/containers/child/create/index.js.map +1 -1
- package/workflows/containers/child/move/index.d.ts +6 -10
- package/workflows/containers/child/move/index.js +5 -4
- package/workflows/containers/child/move/index.js.map +1 -1
- package/workflows/containers/child/rekey/rekeyRemote.d.ts +6 -9
- package/workflows/containers/child/rekey/rekeyRemote.js +3 -1
- package/workflows/containers/child/rekey/rekeyRemote.js.map +1 -1
- package/workflows/containers/child/revoke.d.ts +4 -9
- package/workflows/containers/child/revoke.js +3 -1
- package/workflows/containers/child/revoke.js.map +1 -1
- package/workflows/containers/child/share/index.d.ts +5 -13
- package/workflows/containers/child/share/index.js +7 -1
- package/workflows/containers/child/share/index.js.map +1 -1
- package/workflows/containers/child/share/shareAncestorRepair.js +5 -4
- package/workflows/containers/child/share/shareAncestorRepair.js.map +1 -1
- package/workflows/containers/containerMutationCollaborators.d.ts +30 -0
- package/workflows/containers/containerMutationCollaborators.js +9 -0
- package/workflows/containers/containerMutationCollaborators.js.map +1 -0
- package/workflows/containers/containerMutationService.d.ts +32 -0
- package/workflows/containers/containerMutationService.js +43 -0
- package/workflows/containers/containerMutationService.js.map +1 -0
- package/workflows/containers/index.d.ts +9 -6
- package/workflows/containers/index.js +3 -5
- package/workflows/containers/index.js.map +1 -1
- package/workflows/organizations/containerGrantRevocation.d.ts +3 -11
- package/workflows/organizations/containerGrantRevocation.js +1 -6
- package/workflows/organizations/containerGrantRevocation.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revoke.js","sourceRoot":"","sources":["revoke.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,EACxC,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAU3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC;AACrG,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,4CAA4C,CAAC;AAQpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAIL,gCAAgC,GACjC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,kEAAkE,CAAC;AAIxH,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,yCAAyC,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,SAAS,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CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/C,CAAC","sourcesContent":["import type {\n AccessEvent,\n AccessManifest,\n ContainerAccessManifestState,\n ContainerKekKeyring,\n ContainerKekPredecessorBridge,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n} from \"@tearleads/crypto\";\nimport {\n computeContainerKekKeyringHash,\n computeContainerKekPredecessorBridgeHash,\n deriveContainerKekWrappingPublicKey,\n KeyingVerificationError,\n} from \"@tearleads/crypto\";\nimport type {\n AccessManifestBundleWire,\n ContainerMutationRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n ContainerKekResponse,\n ContainerRotationResponse,\n ContainerWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport { assertContainerAuthorAccess } from \"../../../data/containers/shared/authorAccess\";\nimport {\n buildContainerCreateKeyEpoch,\n signContainerMutationEvent,\n} from \"../../../data/containers/shared/events\";\nimport { isStaleParentContainerPathFailure } from \"../../../data/containers/shared/mutationFailures\";\nimport {\n asContainerManifestBundle,\n containerKekParentRef,\n uniqueSortedManifestHashes,\n} from \"../../../data/containers/shared/projection\";\nimport type {\n ContainerMutationAuthor,\n ContainerRevokeApi,\n ContainerRevokePlan,\n ContainerRotationResult,\n MaterializedContainerRevokePlan,\n} from \"../../../data/containers/shared/types\";\nimport { readCanonicalRecord } from \"../../../data/keying/canonicalJson\";\nimport {\n type PrincipalPolicyCache,\n type ProjectionUserKeyResolver,\n type ReferencedPrincipalPolicyWarmer,\n requireProjectionUserKeyResolver,\n} from \"../../../data/keyingProjectionVerification\";\nimport { ProjectionDependencyUnavailableError } from \"../../../data/keyingProjectionVerification/dependencyUnavailable\";\nimport type { PrincipalPolicyCurrentEvidence } from \"../../../data/principals/principalPolicyEvidence\";\nimport type { SecurityIncidentReporter } from \"../../../data/shared/securityIncidents\";\nimport type { ExecSql } from \"../../../data/sqlite/sqlSchema\";\nimport { buildContainerRotationArtifacts } from \"./move/moveRotation\";\nimport {\n containerMutationRequestCore,\n previousPathRequestFields,\n} from \"./mutationRequestCore\";\nimport {\n submitAcknowledgedContainerMutation,\n submitContainerRotation,\n} from \"./mutationSubmit\";\nimport { containerWriterProjectionFromRotationPlan } from \"./rekey/rekeyProjection\";\nimport {\n type ContainerRevokeSubject,\n deriveContainerRevokeManifest,\n} from \"./revokeManifest\";\nimport { resolveRotationContext } from \"./rotation/rotationContext\";\nimport { collectContainerRevokePrincipalPolicies } from \"./rotation/rotationPrincipalPolicies\";\nimport { buildContainerRotationWraps } from \"./rotation/rotationWraps\";\nimport { refreshedPrincipalPolicies } from \"./share/sharePlanCore\";\n\nfunction buildContainerRevokeRequest(input: {\n body: ContainerRevokeAccessEventBody;\n event: AccessEvent;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n parentKek: ContainerKekResponse | null;\n predecessorBridge: ContainerKekPredecessorBridge;\n previousManifest: AccessManifestBundleWire;\n previousProjection: ContainerWriterProjectionResponse;\n principalPolicies: readonly PrincipalPolicyCurrentEvidence[];\n userRecipientKeys: readonly ContainerUserRecipientKey[];\n wraps: readonly ContainerKeyWrap[];\n}): ContainerMutationRequest {\n return {\n ...containerMutationRequestCore(\"revoke\", input),\n ...previousPathRequestFields(\n input.previousManifest,\n input.previousProjection,\n ),\n predecessorBridge: readCanonicalRecord(\n input.predecessorBridge,\n \"Container revoke predecessor bridge\",\n ),\n keyring: readCanonicalRecord(input.keyring, \"Container revoke keyring\"),\n parentKekRef: input.parentKek\n ? containerKekParentRef(input.parentKek)\n : null,\n };\n}\n\nfunction buildContainerRevokePlanResult(input: {\n body: ContainerRevokeAccessEventBody;\n containerId: string;\n containerKey: Uint8Array;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n parentKek: ContainerKekResponse | null;\n predecessorBridge: ContainerKekPredecessorBridge;\n previousManifest: AccessManifestBundleWire;\n previousProjection: ContainerWriterProjectionResponse;\n principalPolicies: readonly PrincipalPolicyCurrentEvidence[];\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}): MaterializedContainerRevokePlan {\n const plan: ContainerRevokePlan = {\n body: input.body,\n containerId: input.containerId,\n containerKeyEpochId: input.containerKeyEpochId,\n event: input.event,\n eventHash: input.eventHash,\n keyEpoch: input.keyEpoch,\n keyring: input.keyring,\n manifest: input.manifest,\n manifestHash: input.manifestHash,\n previousManifest: input.previousManifest,\n request: buildContainerRevokeRequest({\n body: input.body,\n event: input.event,\n keyEpoch: input.keyEpoch,\n keyring: input.keyring,\n manifest: input.manifest,\n manifestHash: input.manifestHash,\n parentKek: input.parentKek,\n predecessorBridge: input.predecessorBridge,\n previousManifest: input.previousManifest,\n previousProjection: input.previousProjection,\n principalPolicies: input.principalPolicies,\n userRecipientKeys: input.userRecipientKeys,\n wraps: input.wraps,\n }),\n state: input.state,\n userRecipientKeys: input.userRecipientKeys,\n wraps: input.wraps,\n };\n\n return { containerKey: input.containerKey, plan };\n}\n\n// biome-ignore lint/complexity/noExcessiveLinesPerFunction: Revoke planning has to keep the manifest, KEK, wraps, and signed event in one auditable transition.\nexport async function buildMaterializedContainerRevokePlan(input: {\n author: ContainerMutationAuthor;\n eventId?: string | undefined;\n execSql: ExecSql;\n /** Keys a batch minted above this container and has yet to commit. */\n knownContainerKeks?: ReadonlyMap<string, Uint8Array> | undefined;\n /** False for a projection re-rooted on rotations not yet acknowledged. */\n persistVerificationCheckpoints?: boolean | undefined;\n previousProjection: ContainerWriterProjectionResponse;\n /** Verified policies the path may cite before they are stored locally. */\n principalPolicyCache?: PrincipalPolicyCache | undefined;\n replacementPrincipalPolicy?: PrincipalPolicyCurrentEvidence | undefined;\n revokedSubject: ContainerRevokeSubject;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n signedAt?: string | undefined;\n stillCurrent?: (() => boolean) | undefined;\n targetSecretKey: Uint8Array;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n}): Promise<MaterializedContainerRevokePlan> {\n const resolveProjectionUserKey = requireProjectionUserKeyResolver(\n input.resolveProjectionUserKey,\n \"Remote container revoke\",\n );\n const {\n parentKek,\n parentPublicKey,\n predecessorContainerKey,\n previousState,\n target,\n } = await resolveRotationContext(input, \"revoke\");\n const principalPolicies = await collectContainerRevokePrincipalPolicies({\n execSql: input.execSql,\n persistVerificationCheckpoints: input.persistVerificationCheckpoints,\n previousProjection: input.previousProjection,\n principalPolicyCache: input.principalPolicyCache,\n resolveUserKey: resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n assertContainerAuthorAccess({\n author: input.author,\n projection: input.previousProjection,\n principalPolicies,\n minimumAccess: \"admin\",\n });\n const nextContainerKeyEpoch = target.kek.containerKeyEpoch + 1;\n const { containerKey, containerKeyEpochId, keyring, predecessorBridge } =\n await buildContainerRotationArtifacts({\n containerId: previousState.containerId,\n currentKek: target.kek,\n currentKeyMaterial: predecessorContainerKey,\n keyEpoch: nextContainerKeyEpoch,\n signedEpochIds: target.signedEpochIds,\n });\n const body: ContainerRevokeAccessEventBody = {\n eventType: \"container.revoke\",\n parentManifestHash:\n input.previousProjection.path.at(-2)?.manifestHash ?? null,\n containerKeyPublicKey: await deriveContainerKekWrappingPublicKey({\n containerId: previousState.containerId,\n keyMaterial: containerKey,\n }),\n containerKeyEpochId,\n keyringHash: await computeContainerKekKeyringHash(keyring),\n predecessorBridgeHash:\n await computeContainerKekPredecessorBridgeHash(predecessorBridge),\n subjectId: input.revokedSubject.subjectId,\n subjectType: input.revokedSubject.subjectType,\n };\n const { event, eventHash } = await signContainerMutationEvent({\n author: input.author,\n body,\n containerId: previousState.containerId,\n dependencyManifestHashes: uniqueSortedManifestHashes(\n input.previousProjection.path,\n ),\n eventId: input.eventId ?? crypto.randomUUID(),\n previousManifestHash: target.manifest.manifestHash,\n signedAt: input.signedAt ?? new Date().toISOString(),\n });\n const { manifest, manifestHash, state } = await deriveContainerRevokeManifest(\n {\n containerKeyPublicKey: body.containerKeyPublicKey,\n parentManifestHash: body.parentManifestHash,\n containerKeyEpochId,\n eventHash,\n previousManifest: target.manifest,\n revokedSubject: input.revokedSubject,\n },\n );\n const keyEpoch = buildContainerCreateKeyEpoch({\n containerId: previousState.containerId,\n containerKeyEpochId,\n eventHash,\n keyEpoch: nextContainerKeyEpoch,\n manifestHash,\n parentContainerKeyEpochId: parentKek?.containerKeyEpochId ?? null,\n });\n\n const replacementPrincipalPolicy = input.replacementPrincipalPolicy;\n if (\n replacementPrincipalPolicy &&\n (replacementPrincipalPolicy.principalType !==\n input.revokedSubject.subjectType ||\n replacementPrincipalPolicy.principalId !== input.revokedSubject.subjectId)\n ) {\n throw new Error(\"Container revoke replacement principal does not match\");\n }\n // The revoked group's successor replaces its retiring head rather than\n // dropping it: an ancestor rekeyed in the same batch cites that successor,\n // and when the group's ancestor grant is the signer's only admin path, the\n // server can authorize this revoke only through it. The new state grants\n // the group nothing here, so it still receives no wrap.\n const currentPrincipalPolicies = refreshedPrincipalPolicies({\n previousPolicies: principalPolicies,\n replacementPrincipalPolicy,\n });\n const { userRecipientKeys, wraps } = await buildContainerRotationWraps({\n containerKey,\n containerKeyEpochId,\n manifestHash,\n operationLabel: \"Container revoke\",\n parentKek,\n parentPublicKey,\n principalPolicies: currentPrincipalPolicies,\n resolveUserKey: resolveProjectionUserKey,\n state,\n });\n\n return buildContainerRevokePlanResult({\n body,\n containerId: previousState.containerId,\n containerKey,\n containerKeyEpochId,\n event,\n eventHash,\n keyEpoch,\n keyring,\n manifest,\n manifestHash,\n parentKek,\n predecessorBridge,\n previousManifest: asContainerManifestBundle(target.manifest),\n previousProjection: input.previousProjection,\n principalPolicies: currentPrincipalPolicies,\n state,\n userRecipientKeys,\n wraps,\n });\n}\n\ninterface RevokeRemoteContainerInput {\n reportSecurityIncident: SecurityIncidentReporter;\n apiClient: ContainerRevokeApi;\n author: ContainerMutationAuthor;\n containerId: string;\n eventId?: string | undefined;\n execSql: ExecSql;\n revokedSubject: ContainerRevokeSubject;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n signedAt?: string | undefined;\n stillCurrent?: (() => boolean) | undefined;\n targetSecretKey: Uint8Array;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n}\n\ntype RevokedRemoteContainer = {\n containerKey: Uint8Array;\n plan: ContainerRevokePlan;\n response: ContainerRotationResponse;\n};\n\nconst STALE_PATH = Symbol(\"stale-revoke-path\");\n\nasync function submitRevocation(\n input: RevokeRemoteContainerInput,\n plan: ContainerRevokePlan,\n carried: readonly ContainerMutationRequest[],\n): Promise<ContainerRotationResult> {\n const request = carried.length\n ? { ...plan.request, containerRekeys: [...carried] }\n : plan.request;\n const options = {\n expectedPaymentRequiredOrganizationId: input.author.organizationId,\n };\n const { revokeContainerResult } = input.apiClient;\n return submitContainerRotation({\n plain: () =>\n input.apiClient.revokeContainer(input.containerId, request, options),\n result: revokeContainerResult\n ? () =>\n revokeContainerResult.call(\n input.apiClient,\n input.containerId,\n request,\n { ...options, reportErrors: false },\n )\n : undefined,\n });\n}\n\nasync function planRevoke(input: RevokeRemoteContainerInput) {\n const previousProjection = await input.apiClient.getContainerWriterProjection(\n input.containerId,\n );\n if (!previousProjection) {\n return null;\n }\n\n const materializedPlan = await buildMaterializedContainerRevokePlan({\n author: input.author,\n eventId: input.eventId,\n execSql: input.execSql,\n previousProjection,\n revokedSubject: input.revokedSubject,\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n signedAt: input.signedAt,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n return { previousProjection, materializedPlan };\n}\n\nasync function revokeRemoteContainerOnce(\n input: RevokeRemoteContainerInput,\n retriesStalePath: boolean,\n onAccepted: () => void,\n): Promise<RevokedRemoteContainer | typeof STALE_PATH | null> {\n const planned = await planRevoke(input);\n if (!planned) return null;\n const { previousProjection, materializedPlan } = planned;\n let stalePath = false;\n const revoked = await submitAcknowledgedContainerMutation({\n onAccepted,\n reportSecurityIncident: input.reportSecurityIncident,\n recitationPolicies: [],\n apiClient: input.apiClient,\n author: input.author,\n carriedRekeys: {\n planning: {\n apiClient: input.apiClient,\n author: input.author,\n execSql: input.execSql,\n knownContainerKeks: new Map([\n [\n materializedPlan.plan.containerKeyEpochId,\n materializedPlan.containerKey,\n ],\n ]),\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n },\n rotated: () =>\n containerWriterProjectionFromRotationPlan({\n plan: materializedPlan.plan,\n previousProjection,\n }),\n },\n containerKey: materializedPlan.containerKey,\n execSql: input.execSql,\n plan: materializedPlan.plan,\n stillCurrent: input.stillCurrent,\n submit: async (carried) => {\n const result = await submitRevocation(\n input,\n materializedPlan.plan,\n carried,\n );\n if (\n !result.ok &&\n retriesStalePath &&\n isStaleParentContainerPathFailure(result)\n ) {\n stalePath = true;\n // The refused transaction rolled back. Replan it without reporting an\n // error that the caller can repair; a second refusal is terminal.\n return { ok: false, status: result.status, code: result.code };\n }\n return result;\n },\n });\n return revoked ?? (stalePath ? STALE_PATH : null);\n}\n\nasync function revokeRemoteContainerAttempt(\n input: RevokeRemoteContainerInput,\n retriesStalePath: boolean,\n): Promise<RevokedRemoteContainer | typeof STALE_PATH | null> {\n let accepted = false;\n try {\n return await revokeRemoteContainerOnce(input, retriesStalePath, () => {\n accepted = true;\n });\n } catch (error) {\n // Our own or a carried descendant's cached projection may trail a pin,\n // or its history a checkpoint pinned meanwhile (a retryable missing\n // dependency). Refresh only a refused/unsubmitted attempt, never an\n // accepted rotation.\n if (\n retriesStalePath &&\n !accepted &&\n ((error instanceof KeyingVerificationError &&\n error.code === \"rollback\") ||\n error instanceof ProjectionDependencyUnavailableError)\n )\n return STALE_PATH;\n throw error;\n }\n}\n\n/** A concurrent mutation can advance the path while a revoke is in flight. */\nexport async function revokeRemoteContainer(\n input: RevokeRemoteContainerInput,\n): Promise<RevokedRemoteContainer | null> {\n if (input.stillCurrent?.() === false) return null;\n const first = await revokeRemoteContainerAttempt(input, true);\n if (first !== STALE_PATH) return first;\n if (input.stillCurrent?.() === false) return null;\n input.apiClient.evictContainerWriterProjection?.(input.containerId);\n input.apiClient.evictWriterProjectionsCiting?.([input.containerId]);\n const second = await revokeRemoteContainerAttempt(input, false);\n return second === STALE_PATH ? null : second;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"revoke.js","sourceRoot":"","sources":["revoke.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,EACxC,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAU3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC;AACrG,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,4CAA4C,CAAC;AAQpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAIL,gCAAgC,GACjC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,oCAAoC,EAAE,MAAM,kEAAkE,CAAC;AAGxH,OAAO,EAGL,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,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D,MAAM,KAAK,GAAG,MAAM,4BAA4B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9D,IAAI,KAAK,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IACvC,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAClD,KAAK,CAAC,SAAS,CAAC,8BAA8B,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACpE,KAAK,CAAC,SAAS,CAAC,4BAA4B,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,MAAM,4BAA4B,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChE,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/C,CAAC","sourcesContent":["import type {\n AccessEvent,\n AccessManifest,\n ContainerAccessManifestState,\n ContainerKekKeyring,\n ContainerKekPredecessorBridge,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n} from \"@tearleads/crypto\";\nimport {\n computeContainerKekKeyringHash,\n computeContainerKekPredecessorBridgeHash,\n deriveContainerKekWrappingPublicKey,\n KeyingVerificationError,\n} from \"@tearleads/crypto\";\nimport type {\n AccessManifestBundleWire,\n ContainerMutationRequest,\n} from \"@tearleads/validators/request\";\nimport type {\n ContainerKekResponse,\n ContainerRotationResponse,\n ContainerWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport { assertContainerAuthorAccess } from \"../../../data/containers/shared/authorAccess\";\nimport {\n buildContainerCreateKeyEpoch,\n signContainerMutationEvent,\n} from \"../../../data/containers/shared/events\";\nimport { isStaleParentContainerPathFailure } from \"../../../data/containers/shared/mutationFailures\";\nimport {\n asContainerManifestBundle,\n containerKekParentRef,\n uniqueSortedManifestHashes,\n} from \"../../../data/containers/shared/projection\";\nimport type {\n ContainerMutationAuthor,\n ContainerRevokeApi,\n ContainerRevokePlan,\n ContainerRotationResult,\n MaterializedContainerRevokePlan,\n} from \"../../../data/containers/shared/types\";\nimport { readCanonicalRecord } from \"../../../data/keying/canonicalJson\";\nimport {\n type PrincipalPolicyCache,\n type ProjectionUserKeyResolver,\n type ReferencedPrincipalPolicyWarmer,\n requireProjectionUserKeyResolver,\n} from \"../../../data/keyingProjectionVerification\";\nimport { ProjectionDependencyUnavailableError } from \"../../../data/keyingProjectionVerification/dependencyUnavailable\";\nimport type { PrincipalPolicyCurrentEvidence } from \"../../../data/principals/principalPolicyEvidence\";\nimport type { ExecSql } from \"../../../data/sqlite/sqlSchema\";\nimport {\n type ContainerRotationBag,\n type ContainerRotationCollaborators,\n containerRotationBag,\n} from \"../containerMutationCollaborators\";\nimport { buildContainerRotationArtifacts } from \"./move/moveRotation\";\nimport {\n containerMutationRequestCore,\n previousPathRequestFields,\n} from \"./mutationRequestCore\";\nimport {\n submitAcknowledgedContainerMutation,\n submitContainerRotation,\n} from \"./mutationSubmit\";\nimport { containerWriterProjectionFromRotationPlan } from \"./rekey/rekeyProjection\";\nimport {\n type ContainerRevokeSubject,\n deriveContainerRevokeManifest,\n} from \"./revokeManifest\";\nimport { resolveRotationContext } from \"./rotation/rotationContext\";\nimport { collectContainerRevokePrincipalPolicies } from \"./rotation/rotationPrincipalPolicies\";\nimport { buildContainerRotationWraps } from \"./rotation/rotationWraps\";\nimport { refreshedPrincipalPolicies } from \"./share/sharePlanCore\";\n\nfunction buildContainerRevokeRequest(input: {\n body: ContainerRevokeAccessEventBody;\n event: AccessEvent;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n parentKek: ContainerKekResponse | null;\n predecessorBridge: ContainerKekPredecessorBridge;\n previousManifest: AccessManifestBundleWire;\n previousProjection: ContainerWriterProjectionResponse;\n principalPolicies: readonly PrincipalPolicyCurrentEvidence[];\n userRecipientKeys: readonly ContainerUserRecipientKey[];\n wraps: readonly ContainerKeyWrap[];\n}): ContainerMutationRequest {\n return {\n ...containerMutationRequestCore(\"revoke\", input),\n ...previousPathRequestFields(\n input.previousManifest,\n input.previousProjection,\n ),\n predecessorBridge: readCanonicalRecord(\n input.predecessorBridge,\n \"Container revoke predecessor bridge\",\n ),\n keyring: readCanonicalRecord(input.keyring, \"Container revoke keyring\"),\n parentKekRef: input.parentKek\n ? containerKekParentRef(input.parentKek)\n : null,\n };\n}\n\nfunction buildContainerRevokePlanResult(input: {\n body: ContainerRevokeAccessEventBody;\n containerId: string;\n containerKey: Uint8Array;\n containerKeyEpochId: string;\n event: AccessEvent;\n eventHash: string;\n keyEpoch: ContainerKeyEpoch;\n keyring: ContainerKekKeyring;\n manifest: AccessManifest;\n manifestHash: string;\n parentKek: ContainerKekResponse | null;\n predecessorBridge: ContainerKekPredecessorBridge;\n previousManifest: AccessManifestBundleWire;\n previousProjection: ContainerWriterProjectionResponse;\n principalPolicies: readonly PrincipalPolicyCurrentEvidence[];\n state: ContainerAccessManifestState;\n userRecipientKeys: ContainerUserRecipientKey[];\n wraps: ContainerKeyWrap[];\n}): MaterializedContainerRevokePlan {\n const plan: ContainerRevokePlan = {\n body: input.body,\n containerId: input.containerId,\n containerKeyEpochId: input.containerKeyEpochId,\n event: input.event,\n eventHash: input.eventHash,\n keyEpoch: input.keyEpoch,\n keyring: input.keyring,\n manifest: input.manifest,\n manifestHash: input.manifestHash,\n previousManifest: input.previousManifest,\n request: buildContainerRevokeRequest({\n body: input.body,\n event: input.event,\n keyEpoch: input.keyEpoch,\n keyring: input.keyring,\n manifest: input.manifest,\n manifestHash: input.manifestHash,\n parentKek: input.parentKek,\n predecessorBridge: input.predecessorBridge,\n previousManifest: input.previousManifest,\n previousProjection: input.previousProjection,\n principalPolicies: input.principalPolicies,\n userRecipientKeys: input.userRecipientKeys,\n wraps: input.wraps,\n }),\n state: input.state,\n userRecipientKeys: input.userRecipientKeys,\n wraps: input.wraps,\n };\n\n return { containerKey: input.containerKey, plan };\n}\n\n// biome-ignore lint/complexity/noExcessiveLinesPerFunction: Revoke planning has to keep the manifest, KEK, wraps, and signed event in one auditable transition.\nexport async function buildMaterializedContainerRevokePlan(input: {\n author: ContainerMutationAuthor;\n eventId?: string | undefined;\n execSql: ExecSql;\n /** Keys a batch minted above this container and has yet to commit. */\n knownContainerKeks?: ReadonlyMap<string, Uint8Array> | undefined;\n /** False for a projection re-rooted on rotations not yet acknowledged. */\n persistVerificationCheckpoints?: boolean | undefined;\n previousProjection: ContainerWriterProjectionResponse;\n /** Verified policies the path may cite before they are stored locally. */\n principalPolicyCache?: PrincipalPolicyCache | undefined;\n replacementPrincipalPolicy?: PrincipalPolicyCurrentEvidence | undefined;\n revokedSubject: ContainerRevokeSubject;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n signedAt?: string | undefined;\n stillCurrent?: (() => boolean) | undefined;\n targetSecretKey: Uint8Array;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n}): Promise<MaterializedContainerRevokePlan> {\n const resolveProjectionUserKey = requireProjectionUserKeyResolver(\n input.resolveProjectionUserKey,\n \"Remote container revoke\",\n );\n const {\n parentKek,\n parentPublicKey,\n predecessorContainerKey,\n previousState,\n target,\n } = await resolveRotationContext(input, \"revoke\");\n const principalPolicies = await collectContainerRevokePrincipalPolicies({\n execSql: input.execSql,\n persistVerificationCheckpoints: input.persistVerificationCheckpoints,\n previousProjection: input.previousProjection,\n principalPolicyCache: input.principalPolicyCache,\n resolveUserKey: resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n assertContainerAuthorAccess({\n author: input.author,\n projection: input.previousProjection,\n principalPolicies,\n minimumAccess: \"admin\",\n });\n const nextContainerKeyEpoch = target.kek.containerKeyEpoch + 1;\n const { containerKey, containerKeyEpochId, keyring, predecessorBridge } =\n await buildContainerRotationArtifacts({\n containerId: previousState.containerId,\n currentKek: target.kek,\n currentKeyMaterial: predecessorContainerKey,\n keyEpoch: nextContainerKeyEpoch,\n signedEpochIds: target.signedEpochIds,\n });\n const body: ContainerRevokeAccessEventBody = {\n eventType: \"container.revoke\",\n parentManifestHash:\n input.previousProjection.path.at(-2)?.manifestHash ?? null,\n containerKeyPublicKey: await deriveContainerKekWrappingPublicKey({\n containerId: previousState.containerId,\n keyMaterial: containerKey,\n }),\n containerKeyEpochId,\n keyringHash: await computeContainerKekKeyringHash(keyring),\n predecessorBridgeHash:\n await computeContainerKekPredecessorBridgeHash(predecessorBridge),\n subjectId: input.revokedSubject.subjectId,\n subjectType: input.revokedSubject.subjectType,\n };\n const { event, eventHash } = await signContainerMutationEvent({\n author: input.author,\n body,\n containerId: previousState.containerId,\n dependencyManifestHashes: uniqueSortedManifestHashes(\n input.previousProjection.path,\n ),\n eventId: input.eventId ?? crypto.randomUUID(),\n previousManifestHash: target.manifest.manifestHash,\n signedAt: input.signedAt ?? new Date().toISOString(),\n });\n const { manifest, manifestHash, state } = await deriveContainerRevokeManifest(\n {\n containerKeyPublicKey: body.containerKeyPublicKey,\n parentManifestHash: body.parentManifestHash,\n containerKeyEpochId,\n eventHash,\n previousManifest: target.manifest,\n revokedSubject: input.revokedSubject,\n },\n );\n const keyEpoch = buildContainerCreateKeyEpoch({\n containerId: previousState.containerId,\n containerKeyEpochId,\n eventHash,\n keyEpoch: nextContainerKeyEpoch,\n manifestHash,\n parentContainerKeyEpochId: parentKek?.containerKeyEpochId ?? null,\n });\n\n const replacementPrincipalPolicy = input.replacementPrincipalPolicy;\n if (\n replacementPrincipalPolicy &&\n (replacementPrincipalPolicy.principalType !==\n input.revokedSubject.subjectType ||\n replacementPrincipalPolicy.principalId !== input.revokedSubject.subjectId)\n ) {\n throw new Error(\"Container revoke replacement principal does not match\");\n }\n // The revoked group's successor replaces its retiring head rather than\n // dropping it: an ancestor rekeyed in the same batch cites that successor,\n // and when the group's ancestor grant is the signer's only admin path, the\n // server can authorize this revoke only through it. The new state grants\n // the group nothing here, so it still receives no wrap.\n const currentPrincipalPolicies = refreshedPrincipalPolicies({\n previousPolicies: principalPolicies,\n replacementPrincipalPolicy,\n });\n const { userRecipientKeys, wraps } = await buildContainerRotationWraps({\n containerKey,\n containerKeyEpochId,\n manifestHash,\n operationLabel: \"Container revoke\",\n parentKek,\n parentPublicKey,\n principalPolicies: currentPrincipalPolicies,\n resolveUserKey: resolveProjectionUserKey,\n state,\n });\n\n return buildContainerRevokePlanResult({\n body,\n containerId: previousState.containerId,\n containerKey,\n containerKeyEpochId,\n event,\n eventHash,\n keyEpoch,\n keyring,\n manifest,\n manifestHash,\n parentKek,\n predecessorBridge,\n previousManifest: asContainerManifestBundle(target.manifest),\n previousProjection: input.previousProjection,\n principalPolicies: currentPrincipalPolicies,\n state,\n userRecipientKeys,\n wraps,\n });\n}\n\nexport interface RevokeRemoteContainerRequest {\n author: ContainerMutationAuthor;\n containerId: string;\n eventId?: string | undefined;\n revokedSubject: ContainerRevokeSubject;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n signedAt?: string | undefined;\n stillCurrent?: (() => boolean) | undefined;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n}\n\ntype RevokeRemoteContainerInput = RevokeRemoteContainerRequest &\n ContainerRotationBag<ContainerRevokeApi>;\n\nexport type RevokedRemoteContainer = {\n containerKey: Uint8Array;\n plan: ContainerRevokePlan;\n response: ContainerRotationResponse;\n};\n\nconst STALE_PATH = Symbol(\"stale-revoke-path\");\n\nasync function submitRevocation(\n input: RevokeRemoteContainerInput,\n plan: ContainerRevokePlan,\n carried: readonly ContainerMutationRequest[],\n): Promise<ContainerRotationResult> {\n const request = carried.length\n ? { ...plan.request, containerRekeys: [...carried] }\n : plan.request;\n const options = {\n expectedPaymentRequiredOrganizationId: input.author.organizationId,\n };\n const { revokeContainerResult } = input.apiClient;\n return submitContainerRotation({\n plain: () =>\n input.apiClient.revokeContainer(input.containerId, request, options),\n result: revokeContainerResult\n ? () =>\n revokeContainerResult.call(\n input.apiClient,\n input.containerId,\n request,\n { ...options, reportErrors: false },\n )\n : undefined,\n });\n}\n\nasync function planRevoke(input: RevokeRemoteContainerInput) {\n const previousProjection = await input.apiClient.getContainerWriterProjection(\n input.containerId,\n );\n if (!previousProjection) {\n return null;\n }\n\n const materializedPlan = await buildMaterializedContainerRevokePlan({\n author: input.author,\n eventId: input.eventId,\n execSql: input.execSql,\n previousProjection,\n revokedSubject: input.revokedSubject,\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n signedAt: input.signedAt,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n });\n return { previousProjection, materializedPlan };\n}\n\nasync function revokeRemoteContainerOnce(\n input: RevokeRemoteContainerInput,\n retriesStalePath: boolean,\n onAccepted: () => void,\n): Promise<RevokedRemoteContainer | typeof STALE_PATH | null> {\n const planned = await planRevoke(input);\n if (!planned) return null;\n const { previousProjection, materializedPlan } = planned;\n let stalePath = false;\n const revoked = await submitAcknowledgedContainerMutation({\n onAccepted,\n reportSecurityIncident: input.reportSecurityIncident,\n recitationPolicies: [],\n apiClient: input.apiClient,\n author: input.author,\n carriedRekeys: {\n planning: {\n apiClient: input.apiClient,\n author: input.author,\n execSql: input.execSql,\n knownContainerKeks: new Map([\n [\n materializedPlan.plan.containerKeyEpochId,\n materializedPlan.containerKey,\n ],\n ]),\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n },\n rotated: () =>\n containerWriterProjectionFromRotationPlan({\n plan: materializedPlan.plan,\n previousProjection,\n }),\n },\n containerKey: materializedPlan.containerKey,\n execSql: input.execSql,\n plan: materializedPlan.plan,\n stillCurrent: input.stillCurrent,\n submit: async (carried) => {\n const result = await submitRevocation(\n input,\n materializedPlan.plan,\n carried,\n );\n if (\n !result.ok &&\n retriesStalePath &&\n isStaleParentContainerPathFailure(result)\n ) {\n stalePath = true;\n // The refused transaction rolled back. Replan it without reporting an\n // error that the caller can repair; a second refusal is terminal.\n return { ok: false, status: result.status, code: result.code };\n }\n return result;\n },\n });\n return revoked ?? (stalePath ? STALE_PATH : null);\n}\n\nasync function revokeRemoteContainerAttempt(\n input: RevokeRemoteContainerInput,\n retriesStalePath: boolean,\n): Promise<RevokedRemoteContainer | typeof STALE_PATH | null> {\n let accepted = false;\n try {\n return await revokeRemoteContainerOnce(input, retriesStalePath, () => {\n accepted = true;\n });\n } catch (error) {\n // Our own or a carried descendant's cached projection may trail a pin,\n // or its history a checkpoint pinned meanwhile (a retryable missing\n // dependency). Refresh only a refused/unsubmitted attempt, never an\n // accepted rotation.\n if (\n retriesStalePath &&\n !accepted &&\n ((error instanceof KeyingVerificationError &&\n error.code === \"rollback\") ||\n error instanceof ProjectionDependencyUnavailableError)\n )\n return STALE_PATH;\n throw error;\n }\n}\n\n/** A concurrent mutation can advance the path while a revoke is in flight. */\nexport async function revokeRemoteContainer(\n collaborators: ContainerRotationCollaborators<ContainerRevokeApi>,\n request: RevokeRemoteContainerRequest,\n): Promise<RevokedRemoteContainer | null> {\n const input = { ...request, ...containerRotationBag(collaborators) };\n if (input.stillCurrent?.() === false) return null;\n const first = await revokeRemoteContainerAttempt(input, true);\n if (first !== STALE_PATH) return first;\n if (input.stillCurrent?.() === false) return null;\n input.apiClient.evictContainerWriterProjection?.(input.containerId);\n input.apiClient.evictWriterProjectionsCiting?.([input.containerId]);\n const second = await revokeRemoteContainerAttempt(input, false);\n return second === STALE_PATH ? null : second;\n}\n"]}
|
|
@@ -2,27 +2,20 @@ import { type ContainerAccessLevel } from "../../../../internal/crypto/index.js"
|
|
|
2
2
|
import type { ContainerMutationResponse, ContainerWriterProjectionResponse } from "../../../../internal/validators/response/index.js";
|
|
3
3
|
import type { ContainerMutationAuthor, ContainerShareApi, ContainerSharePlan } from "../../../../data/containers/shared/types.js";
|
|
4
4
|
import { type ProjectionUserKeyResolver, type ReferencedPrincipalPolicyWarmer } from "../../../../data/keyingProjectionVerification/index.js";
|
|
5
|
-
import type
|
|
6
|
-
|
|
7
|
-
import { type TrustedUserIdentityResolver } from "../../../../data/trustedUserIdentity/index.js";
|
|
8
|
-
type ShareRemoteContainerInput = {
|
|
9
|
-
reportSecurityIncident: SecurityIncidentReporter;
|
|
5
|
+
import { type ContainerMutationCollaborators } from "../../containerMutationCollaborators.js";
|
|
6
|
+
export interface ShareRemoteContainerRequest {
|
|
10
7
|
accessLevel: ContainerAccessLevel;
|
|
11
|
-
apiClient: ContainerShareApi;
|
|
12
8
|
author: ContainerMutationAuthor;
|
|
13
9
|
containerId: string;
|
|
14
10
|
eventId?: string | undefined;
|
|
15
|
-
execSql: ExecSql;
|
|
16
11
|
previousProjection?: ContainerWriterProjectionResponse | undefined;
|
|
17
12
|
recipientUserId: string;
|
|
18
13
|
resolveProjectionUserKey: ProjectionUserKeyResolver;
|
|
19
|
-
resolveTrustedUserIdentity: TrustedUserIdentityResolver;
|
|
20
14
|
signedAt?: string | undefined;
|
|
21
15
|
stillCurrent?: (() => boolean) | undefined;
|
|
22
|
-
targetSecretKey: Uint8Array;
|
|
23
16
|
warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;
|
|
24
|
-
}
|
|
25
|
-
type SharedRemoteContainer = {
|
|
17
|
+
}
|
|
18
|
+
export type SharedRemoteContainer = {
|
|
26
19
|
containerKey: Uint8Array;
|
|
27
20
|
plan: ContainerSharePlan;
|
|
28
21
|
response: ContainerMutationResponse;
|
|
@@ -35,5 +28,4 @@ type SharedRemoteContainer = {
|
|
|
35
28
|
* pin or checkpoint; either way the share is planned once more from a fresh
|
|
36
29
|
* projection, as a create under a stale parent is.
|
|
37
30
|
*/
|
|
38
|
-
export declare function shareRemoteContainer(
|
|
39
|
-
export {};
|
|
31
|
+
export declare function shareRemoteContainer(collaborators: ContainerMutationCollaborators<ContainerShareApi>, request: ShareRemoteContainerRequest): Promise<SharedRemoteContainer | null>;
|
|
@@ -3,6 +3,7 @@ import { isStaleParentContainerPathFailure } from "../../../../data/containers/s
|
|
|
3
3
|
import { nullOnProjectionVerificationCancellation, requireProjectionUserKeyResolver, } from "../../../../data/keyingProjectionVerification/index.js";
|
|
4
4
|
import { ProjectionDependencyUnavailableError } from "../../../../data/keyingProjectionVerification/dependencyUnavailable.js";
|
|
5
5
|
import { requireTrustedUserIdentityResolver, } from "../../../../data/trustedUserIdentity/index.js";
|
|
6
|
+
import { containerRotationBag, } from "../../containerMutationCollaborators.js";
|
|
6
7
|
import { submitAcknowledgedContainerMutation, submitPlainContainerMutation, } from "../mutationSubmit.js";
|
|
7
8
|
import { buildMaterializedContainerSharePlan } from "./shareMaterialization.js";
|
|
8
9
|
import { resolveShareProjection } from "./shareProjection.js";
|
|
@@ -101,7 +102,12 @@ async function shareRemoteContainerOnce(input, recipientEncapsulationPublicKey,
|
|
|
101
102
|
* pin or checkpoint; either way the share is planned once more from a fresh
|
|
102
103
|
* projection, as a create under a stale parent is.
|
|
103
104
|
*/
|
|
104
|
-
export async function shareRemoteContainer(
|
|
105
|
+
export async function shareRemoteContainer(collaborators, request) {
|
|
106
|
+
const input = {
|
|
107
|
+
...request,
|
|
108
|
+
...containerRotationBag(collaborators),
|
|
109
|
+
resolveTrustedUserIdentity: collaborators.resolveTrustedUserIdentity,
|
|
110
|
+
};
|
|
105
111
|
const resolveProjectionUserKey = requireProjectionUserKeyResolver(input.resolveProjectionUserKey, "Remote container share");
|
|
106
112
|
const resolveTrustedUserIdentity = requireTrustedUserIdentityResolver(input.resolveTrustedUserIdentity);
|
|
107
113
|
const recipientIdentity = await resolveTrustedUserIdentity(input.recipientUserId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,GACxB,MAAM,mBAAmB,CAA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EAC9B,wBAAwB,CACzB,CAAC;IACF,MAAM,0BAA0B,GAAG,kCAAkC,CACnE,KAAK,CAAC,0BAA0B,CACjC,CAAC;IACF,MAAM,iBAAiB,GAAG,MAAM,0BAA0B,CACxD,KAAK,CAAC,eAAe,CACtB,CAAC;IACF,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE,KAAK,KAAK,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,wBAAwB,CAC1C,KAAK,EACL,iBAAiB,CAAC,sBAAsB,EACxC,wBAAwB,EACxB,IAAI,CACL,CAAC;IACF,IAAI,KAAK,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IACvC,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAClD,KAAK,CAAC,SAAS,CAAC,8BAA8B,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAC3C,EAAE,GAAG,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAC3C,iBAAiB,CAAC,sBAAsB,EACxC,wBAAwB,EACxB,KAAK,CACN,CAAC;IACF,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/C,CAAC","sourcesContent":["import {\n type ContainerAccessLevel,\n KeyingVerificationError,\n} from \"@tearleads/crypto\";\nimport type { ContainerMutationRequest } from \"@tearleads/validators/request\";\nimport type {\n ContainerMutationResponse,\n ContainerWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport { isStaleParentContainerPathFailure } from \"../../../../data/containers/shared/mutationFailures\";\nimport type {\n ContainerMutationAuthor,\n ContainerRotationResult,\n ContainerShareApi,\n ContainerSharePlan,\n MaterializedContainerSharePlan,\n} from \"../../../../data/containers/shared/types\";\nimport {\n nullOnProjectionVerificationCancellation,\n type ProjectionUserKeyResolver,\n type ReferencedPrincipalPolicyWarmer,\n requireProjectionUserKeyResolver,\n} from \"../../../../data/keyingProjectionVerification\";\nimport { ProjectionDependencyUnavailableError } from \"../../../../data/keyingProjectionVerification/dependencyUnavailable\";\nimport type { SecurityIncidentReporter } from \"../../../../data/shared/securityIncidents\";\nimport type { ExecSql } from \"../../../../data/sqlite/sqlSchema\";\nimport {\n requireTrustedUserIdentityResolver,\n type TrustedUserIdentityResolver,\n} from \"../../../../data/trustedUserIdentity\";\nimport {\n submitAcknowledgedContainerMutation,\n submitPlainContainerMutation,\n} from \"../mutationSubmit\";\nimport { buildMaterializedContainerSharePlan } from \"./shareMaterialization\";\nimport { resolveShareProjection } from \"./shareProjection\";\n\nasync function buildCurrentContainerSharePlan(\n input: Parameters<typeof buildMaterializedContainerSharePlan>[0],\n): Promise<MaterializedContainerSharePlan | null> {\n return nullOnProjectionVerificationCancellation(() =>\n buildMaterializedContainerSharePlan(input),\n );\n}\n\ntype ShareRemoteContainerInput = {\n reportSecurityIncident: SecurityIncidentReporter;\n accessLevel: ContainerAccessLevel;\n apiClient: ContainerShareApi;\n author: ContainerMutationAuthor;\n containerId: string;\n eventId?: string | undefined;\n execSql: ExecSql;\n previousProjection?: ContainerWriterProjectionResponse | undefined;\n recipientUserId: string;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n resolveTrustedUserIdentity: TrustedUserIdentityResolver;\n signedAt?: string | undefined;\n stillCurrent?: (() => boolean) | undefined;\n targetSecretKey: Uint8Array;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n};\n\ntype SharedRemoteContainer = {\n containerKey: Uint8Array;\n plan: ContainerSharePlan;\n response: ContainerMutationResponse;\n};\n\n/** A path a head advanced under, which a share plans once more (#2647). */\nconst STALE_PATH = Symbol(\"stale-path\");\n\n/**\n * Submit through the status-bearing endpoint when the adapter has one. The\n * refusal that ends the share is reported once submission settles, as the\n * plain endpoint's would be; a stale path the share plans again is not.\n */\nasync function submitShare(\n input: ShareRemoteContainerInput,\n request: ContainerMutationRequest,\n retriesStalePath: boolean,\n): Promise<ContainerRotationResult> {\n const options = {\n expectedPaymentRequiredOrganizationId: input.author.organizationId,\n };\n const { shareContainerResult } = input.apiClient;\n if (!shareContainerResult) {\n return submitPlainContainerMutation(() =>\n input.apiClient.shareContainer(input.containerId, request, options),\n );\n }\n const result = await shareContainerResult.call(\n input.apiClient,\n input.containerId,\n request,\n { ...options, reportErrors: false },\n );\n if (result.ok) return { ok: true, data: result.data };\n return retriesStalePath && isStaleParentContainerPathFailure(result)\n ? { ok: false, code: result.code, status: result.status }\n : result;\n}\n\nfunction planShare(\n input: ShareRemoteContainerInput,\n recipientEncapsulationPublicKey: Uint8Array,\n resolveProjectionUserKey: ProjectionUserKeyResolver,\n) {\n return resolveShareProjection(input, resolveProjectionUserKey).then(\n (previousProjection) =>\n previousProjection &&\n buildCurrentContainerSharePlan({\n accessLevel: input.accessLevel,\n author: input.author,\n eventId: input.eventId,\n execSql: input.execSql,\n previousProjection,\n recipient: {\n recipientEncapsulationPublicKey,\n subjectId: input.recipientUserId,\n subjectType: \"user\",\n },\n resolveProjectionUserKey,\n signedAt: input.signedAt,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n }),\n );\n}\n\nasync function shareRemoteContainerOnce(\n input: ShareRemoteContainerInput,\n recipientEncapsulationPublicKey: Uint8Array,\n resolveProjectionUserKey: ProjectionUserKeyResolver,\n retriesStalePath: boolean,\n): Promise<SharedRemoteContainer | typeof STALE_PATH | null> {\n let materializedPlan: Awaited<ReturnType<typeof planShare>>;\n try {\n materializedPlan = await planShare(\n input,\n recipientEncapsulationPublicKey,\n resolveProjectionUserKey,\n );\n } catch (error) {\n // The path the share was handed predates a pin this device has since\n // advanced, most often through its own re-citation, or its principal\n // history stops short of a checkpoint another workflow pinned meanwhile\n // (a retryable missing dependency, as a create refreshes). A fresh\n // projection is held to the same pins, so a server that rolls a head\n // back or withholds history still fails the share, on its second plan.\n if (\n retriesStalePath &&\n ((error instanceof KeyingVerificationError &&\n error.code === \"rollback\") ||\n error instanceof ProjectionDependencyUnavailableError)\n )\n return STALE_PATH;\n throw error;\n }\n if (!materializedPlan) return null;\n let stalePath = false;\n const shared = await submitAcknowledgedContainerMutation({\n reportSecurityIncident: input.reportSecurityIncident,\n recitationPolicies: [],\n apiClient: input.apiClient,\n author: input.author,\n containerKey: materializedPlan.containerKey,\n execSql: input.execSql,\n plan: materializedPlan.plan,\n stillCurrent: input.stillCurrent,\n submit: async () => {\n const result = await submitShare(\n input,\n materializedPlan.plan.request,\n retriesStalePath,\n );\n stalePath =\n !result.ok &&\n retriesStalePath &&\n isStaleParentContainerPathFailure(result);\n return result;\n },\n });\n return shared ?? (stalePath ? STALE_PATH : null);\n}\n\n/**\n * Share a container with a user. A head on the signed path can advance while\n * the share is in flight, most often under this device's own background\n * re-citation of held descendants after a share above it. The API refuses\n * that as a stale path, and verification refuses a projection behind a local\n * pin or checkpoint; either way the share is planned once more from a fresh\n * projection, as a create under a stale parent is.\n */\nexport async function shareRemoteContainer(\n input: ShareRemoteContainerInput,\n): Promise<SharedRemoteContainer | null> {\n const resolveProjectionUserKey = requireProjectionUserKeyResolver(\n input.resolveProjectionUserKey,\n \"Remote container share\",\n );\n const resolveTrustedUserIdentity = requireTrustedUserIdentityResolver(\n input.resolveTrustedUserIdentity,\n );\n const recipientIdentity = await resolveTrustedUserIdentity(\n input.recipientUserId,\n );\n if (!recipientIdentity || input.stillCurrent?.() === false) {\n return null;\n }\n const first = await shareRemoteContainerOnce(\n input,\n recipientIdentity.encapsulationPublicKey,\n resolveProjectionUserKey,\n true,\n );\n if (first !== STALE_PATH) return first;\n if (input.stillCurrent?.() === false) return null;\n input.apiClient.evictContainerWriterProjection?.(input.containerId);\n const second = await shareRemoteContainerOnce(\n { ...input, previousProjection: undefined },\n recipientIdentity.encapsulationPublicKey,\n resolveProjectionUserKey,\n false,\n );\n return second === STALE_PATH ? null : second;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,iCAAiC,EAAE,MAAM,qDAAqD,CAAC;AAQxG,OAAO,EACL,wCAAwC,EAGxC,gCAAgC,GACjC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,oCAAoC,EAAE,MAAM,qEAAqE,CAAC;AAC3H,OAAO,EACL,kCAAkC,GAEnC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGL,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,mCAAmC,EACnC,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,KAAK,UAAU,8BAA8B,CAC3C,KAAgE;IAEhE,OAAO,wCAAwC,CAAC,GAAG,EAAE,CACnD,mCAAmC,CAAC,KAAK,CAAC,CAC3C,CAAC;AACJ,CAAC;AA0BD,2EAA2E;AAC3E,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAExC;;;;GAIG;AACH,KAAK,UAAU,WAAW,CACxB,KAAgC,EAChC,OAAiC,EACjC,gBAAyB;IAEzB,MAAM,OAAO,GAAG;QACd,qCAAqC,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc;KACnE,CAAC;IACF,MAAM,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;IACjD,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,OAAO,4BAA4B,CAAC,GAAG,EAAE,CACvC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,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,CAAC,MAAM,CAAC;AAC/C,CAAC","sourcesContent":["import {\n type ContainerAccessLevel,\n KeyingVerificationError,\n} from \"@tearleads/crypto\";\nimport type { ContainerMutationRequest } from \"@tearleads/validators/request\";\nimport type {\n ContainerMutationResponse,\n ContainerWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport { isStaleParentContainerPathFailure } from \"../../../../data/containers/shared/mutationFailures\";\nimport type {\n ContainerMutationAuthor,\n ContainerRotationResult,\n ContainerShareApi,\n ContainerSharePlan,\n MaterializedContainerSharePlan,\n} from \"../../../../data/containers/shared/types\";\nimport {\n nullOnProjectionVerificationCancellation,\n type ProjectionUserKeyResolver,\n type ReferencedPrincipalPolicyWarmer,\n requireProjectionUserKeyResolver,\n} from \"../../../../data/keyingProjectionVerification\";\nimport { ProjectionDependencyUnavailableError } from \"../../../../data/keyingProjectionVerification/dependencyUnavailable\";\nimport {\n requireTrustedUserIdentityResolver,\n type TrustedUserIdentityResolver,\n} from \"../../../../data/trustedUserIdentity\";\nimport {\n type ContainerMutationCollaborators,\n type ContainerRotationBag,\n containerRotationBag,\n} from \"../../containerMutationCollaborators\";\nimport {\n submitAcknowledgedContainerMutation,\n submitPlainContainerMutation,\n} from \"../mutationSubmit\";\nimport { buildMaterializedContainerSharePlan } from \"./shareMaterialization\";\nimport { resolveShareProjection } from \"./shareProjection\";\n\nasync function buildCurrentContainerSharePlan(\n input: Parameters<typeof buildMaterializedContainerSharePlan>[0],\n): Promise<MaterializedContainerSharePlan | null> {\n return nullOnProjectionVerificationCancellation(() =>\n buildMaterializedContainerSharePlan(input),\n );\n}\n\nexport interface ShareRemoteContainerRequest {\n accessLevel: ContainerAccessLevel;\n author: ContainerMutationAuthor;\n containerId: string;\n eventId?: string | undefined;\n previousProjection?: ContainerWriterProjectionResponse | undefined;\n recipientUserId: string;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n signedAt?: string | undefined;\n stillCurrent?: (() => boolean) | undefined;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n}\n\ntype ShareRemoteContainerInput = ShareRemoteContainerRequest &\n ContainerRotationBag<ContainerShareApi> & {\n resolveTrustedUserIdentity: TrustedUserIdentityResolver;\n };\n\nexport type SharedRemoteContainer = {\n containerKey: Uint8Array;\n plan: ContainerSharePlan;\n response: ContainerMutationResponse;\n};\n\n/** A path a head advanced under, which a share plans once more (#2647). */\nconst STALE_PATH = Symbol(\"stale-path\");\n\n/**\n * Submit through the status-bearing endpoint when the adapter has one. The\n * refusal that ends the share is reported once submission settles, as the\n * plain endpoint's would be; a stale path the share plans again is not.\n */\nasync function submitShare(\n input: ShareRemoteContainerInput,\n request: ContainerMutationRequest,\n retriesStalePath: boolean,\n): Promise<ContainerRotationResult> {\n const options = {\n expectedPaymentRequiredOrganizationId: input.author.organizationId,\n };\n const { shareContainerResult } = input.apiClient;\n if (!shareContainerResult) {\n return submitPlainContainerMutation(() =>\n input.apiClient.shareContainer(input.containerId, request, options),\n );\n }\n const result = await shareContainerResult.call(\n input.apiClient,\n input.containerId,\n request,\n { ...options, reportErrors: false },\n );\n if (result.ok) return { ok: true, data: result.data };\n return retriesStalePath && isStaleParentContainerPathFailure(result)\n ? { ok: false, code: result.code, status: result.status }\n : result;\n}\n\nfunction planShare(\n input: ShareRemoteContainerInput,\n recipientEncapsulationPublicKey: Uint8Array,\n resolveProjectionUserKey: ProjectionUserKeyResolver,\n) {\n return resolveShareProjection(input, resolveProjectionUserKey).then(\n (previousProjection) =>\n previousProjection &&\n buildCurrentContainerSharePlan({\n accessLevel: input.accessLevel,\n author: input.author,\n eventId: input.eventId,\n execSql: input.execSql,\n previousProjection,\n recipient: {\n recipientEncapsulationPublicKey,\n subjectId: input.recipientUserId,\n subjectType: \"user\",\n },\n resolveProjectionUserKey,\n signedAt: input.signedAt,\n stillCurrent: input.stillCurrent,\n targetSecretKey: input.targetSecretKey,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n }),\n );\n}\n\nasync function shareRemoteContainerOnce(\n input: ShareRemoteContainerInput,\n recipientEncapsulationPublicKey: Uint8Array,\n resolveProjectionUserKey: ProjectionUserKeyResolver,\n retriesStalePath: boolean,\n): Promise<SharedRemoteContainer | typeof STALE_PATH | null> {\n let materializedPlan: Awaited<ReturnType<typeof planShare>>;\n try {\n materializedPlan = await planShare(\n input,\n recipientEncapsulationPublicKey,\n resolveProjectionUserKey,\n );\n } catch (error) {\n // The path the share was handed predates a pin this device has since\n // advanced, most often through its own re-citation, or its principal\n // history stops short of a checkpoint another workflow pinned meanwhile\n // (a retryable missing dependency, as a create refreshes). A fresh\n // projection is held to the same pins, so a server that rolls a head\n // back or withholds history still fails the share, on its second plan.\n if (\n retriesStalePath &&\n ((error instanceof KeyingVerificationError &&\n error.code === \"rollback\") ||\n error instanceof ProjectionDependencyUnavailableError)\n )\n return STALE_PATH;\n throw error;\n }\n if (!materializedPlan) return null;\n let stalePath = false;\n const shared = await submitAcknowledgedContainerMutation({\n reportSecurityIncident: input.reportSecurityIncident,\n recitationPolicies: [],\n apiClient: input.apiClient,\n author: input.author,\n containerKey: materializedPlan.containerKey,\n execSql: input.execSql,\n plan: materializedPlan.plan,\n stillCurrent: input.stillCurrent,\n submit: async () => {\n const result = await submitShare(\n input,\n materializedPlan.plan.request,\n retriesStalePath,\n );\n stalePath =\n !result.ok &&\n retriesStalePath &&\n isStaleParentContainerPathFailure(result);\n return result;\n },\n });\n return shared ?? (stalePath ? STALE_PATH : null);\n}\n\n/**\n * Share a container with a user. A head on the signed path can advance while\n * the share is in flight, most often under this device's own background\n * re-citation of held descendants after a share above it. The API refuses\n * that as a stale path, and verification refuses a projection behind a local\n * pin or checkpoint; either way the share is planned once more from a fresh\n * projection, as a create under a stale parent is.\n */\nexport async function shareRemoteContainer(\n collaborators: ContainerMutationCollaborators<ContainerShareApi>,\n request: ShareRemoteContainerRequest,\n): Promise<SharedRemoteContainer | null> {\n const input: ShareRemoteContainerInput = {\n ...request,\n ...containerRotationBag(collaborators),\n resolveTrustedUserIdentity: collaborators.resolveTrustedUserIdentity,\n };\n const resolveProjectionUserKey = requireProjectionUserKeyResolver(\n input.resolveProjectionUserKey,\n \"Remote container share\",\n );\n const resolveTrustedUserIdentity = requireTrustedUserIdentityResolver(\n input.resolveTrustedUserIdentity,\n );\n const recipientIdentity = await resolveTrustedUserIdentity(\n input.recipientUserId,\n );\n if (!recipientIdentity || input.stillCurrent?.() === false) {\n return null;\n }\n const first = await shareRemoteContainerOnce(\n input,\n recipientIdentity.encapsulationPublicKey,\n resolveProjectionUserKey,\n true,\n );\n if (first !== STALE_PATH) return first;\n if (input.stillCurrent?.() === false) return null;\n input.apiClient.evictContainerWriterProjection?.(input.containerId);\n const second = await shareRemoteContainerOnce(\n { ...input, previousProjection: undefined },\n recipientIdentity.encapsulationPublicKey,\n resolveProjectionUserKey,\n false,\n );\n return second === STALE_PATH ? null : second;\n}\n"]}
|
|
@@ -64,19 +64,20 @@ export async function projectionWithCurrentAncestors(input) {
|
|
|
64
64
|
}
|
|
65
65
|
const serverDecides = serverDecidesStaleLevel(staleLevelId, input.containerId, projection);
|
|
66
66
|
const repaired = await rekeyRemoteContainer({
|
|
67
|
-
|
|
67
|
+
api: {
|
|
68
68
|
getContainerWriterProjection: (containerId) => input.apiClient.getContainerWriterProjection(containerId),
|
|
69
69
|
reciteContainer: (...args) => input.apiClient.reciteContainer(...args),
|
|
70
70
|
rekeyContainer: rekeyContainer.bind(input.apiClient),
|
|
71
71
|
...boundRekeyResult(input.apiClient),
|
|
72
72
|
},
|
|
73
|
-
|
|
74
|
-
containerId: staleLevelId,
|
|
73
|
+
encapsulationSecretKey: input.targetSecretKey,
|
|
75
74
|
execSql: input.execSql,
|
|
76
75
|
reportSecurityIncident: input.reportSecurityIncident,
|
|
76
|
+
}, {
|
|
77
|
+
author: input.author,
|
|
78
|
+
containerId: staleLevelId,
|
|
77
79
|
resolveProjectionUserKey: input.resolveProjectionUserKey,
|
|
78
80
|
stillCurrent: input.stillCurrent,
|
|
79
|
-
targetSecretKey: input.targetSecretKey,
|
|
80
81
|
warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,
|
|
81
82
|
}).catch((error) => {
|
|
82
83
|
const outOfReach = error instanceof ContainerAuthorAccessError ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shareAncestorRepair.js","sourceRoot":"","sources":["shareAncestorRepair.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAM7F,OAAO,EACL,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,gDAAgD,CAAC;AAOxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,SAAS,kBAAkB,CACzB,UAA6C;IAE7C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAC9B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EACrC,cAAc,CACf,CAAC;IACF,OAAO,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;AAChE,CAAC;AAED,oFAAoF;AACpF,SAAS,iBAAiB,CACxB,UAA6C;IAE7C,MAAM,IAAI,GAAG,UAAU,CAAC,aAAa,CAAC;IACtC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IACE,GAAG;YACH,GAAG,CAAC,yBAAyB,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,mBAAmB,EACtE,CAAC;YACD,OAAO,GAAG,CAAC,WAAW,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAA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YACE,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,WAAW,EAAE,YAAY;YACzB,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;YACxD,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,+BAA+B,EAAE,KAAK,CAAC,+BAA+B;SACvE,CACF,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACzB,MAAM,UAAU,GACd,KAAK,YAAY,0BAA0B;gBAC3C,KAAK,YAAY,kCAAkC,CAAC;YACtD,IAAI,UAAU,IAAI,aAAa;gBAAE,OAAO,IAAI,CAAC;YAC7C,MAAM,UAAU;gBACd,CAAC,CAAC,IAAI,mCAAmC,CAAC,YAAY,CAAC;gBACvD,CAAC,CAAC,KAAK,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC;QAClD,IAAI,CAAC,QAAQ;YAAE,OAAO,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,4BAA4B,CAClE,KAAK,CAAC,WAAW,CAClB,CAAC;QACF,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,UAAU,GAAG,SAAS,CAAC;IACzB,CAAC;IACD,OAAO,iBAAiB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC","sourcesContent":["import type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport { ContainerAuthorAccessError } from \"../../../../data/containers/shared/authorAccess\";\nimport type {\n ContainerMutationAuthor,\n ContainerRekeyApi,\n ContainerShareApi,\n} from \"../../../../data/containers/shared/types\";\nimport {\n ContainerKekRepairInaccessibleError,\n ContainerKekTargetUnreachableError,\n} from \"../../../../data/documents/shared/containerKek\";\nimport type {\n ProjectionUserKeyResolver,\n ReferencedPrincipalPolicyWarmer,\n} from \"../../../../data/keyingProjectionVerification\";\nimport type { SecurityIncidentReporter } from \"../../../../data/shared/securityIncidents\";\nimport type { ExecSql } from \"../../../../data/sqlite/sqlSchema\";\nimport { rekeyRemoteContainer } from \"../rekey/rekeyRemote\";\n\nfunction carriesDirectGrant(\n projection: ContainerWriterProjectionResponse,\n): boolean {\n const directGrants = Reflect.get(\n Object(projection.path.at(-1)?.state),\n \"directGrants\",\n );\n return Array.isArray(directGrants) && directGrants.length > 0;\n}\n\n/** The first level on the path, the container included, pinning a retired epoch. */\nfunction firstStaleLevelId(\n projection: ContainerWriterProjectionResponse,\n): string | null {\n const keks = projection.containerKeks;\n for (let index = 1; index < keks.length; index += 1) {\n const kek = keks[index];\n if (\n kek &&\n kek.parentContainerKeyEpochId !== keks[index - 1]?.containerKeyEpochId\n ) {\n return kek.containerId;\n }\n }\n return null;\n}\n\n/**\n * Repair a stale path down to and including a container before granting on it\n * (#2340).\n *\n * A chain with no grant beneath it may sit lazily stale after an ancestor\n * rotation, since nobody's writes depend on it. The first grant changes that:\n * its grantee could never re-key the levels above its container, so the server\n * refuses a first grant below a stale chain. The container's own edge must be\n * current too, because a grant cites the parent's current epoch and the\n * container's key epoch has to pin it. The sharer administers the container\n * through a grant at or above it, and the levels above that grant are already\n * current, so every stale level here is one the sharer can re-key. These\n * repairs are standalone and need not be atomic with the grant: a repair never\n * strands anyone.\n *\n * Every share does this, not only a first grant, which is all the server\n * insists on. A container that already carries a grant is stale only past the\n * carried-rekey cap, and its grantees are then parked behind exactly these\n * levels; the sharer is already here and able.\n */\nfunction boundRekeyResult(\n apiClient: Partial<Pick<ContainerRekeyApi, \"rekeyContainerResult\">>,\n) {\n const { rekeyContainerResult } = apiClient;\n return rekeyContainerResult\n ? { rekeyContainerResult: rekeyContainerResult.bind(apiClient) }\n : {};\n}\n\n// This sharer may be unable to re-key a level above a container that already\n// carries a grant, stale past the carried-rekey cap. The server asks a current\n// chain only of a first grant, so it decides rather than this blocking a grant\n// it would accept.\nfunction serverDecidesStaleLevel(\n staleLevelId: string,\n containerId: string,\n projection: ContainerWriterProjectionResponse,\n): boolean {\n return staleLevelId !== containerId && carriesDirectGrant(projection);\n}\n\nexport async function projectionWithCurrentAncestors(input: {\n apiClient: ContainerShareApi &\n Partial<Pick<ContainerRekeyApi, \"rekeyContainer\" | \"rekeyContainerResult\">>;\n author: ContainerMutationAuthor;\n containerId: string;\n execSql: ExecSql;\n previousProjection: ContainerWriterProjectionResponse;\n reportSecurityIncident: SecurityIncidentReporter;\n resolveProjectionUserKey: ProjectionUserKeyResolver;\n stillCurrent?: (() => boolean) | undefined;\n targetSecretKey: Uint8Array;\n warmReferencedPrincipalPolicies?: ReferencedPrincipalPolicyWarmer | undefined;\n}): Promise<ContainerWriterProjectionResponse | null> {\n const { rekeyContainer } = input.apiClient;\n let projection = input.previousProjection;\n // Each round repairs one level, and a path has a bounded number of them.\n for (let round = 0; round < projection.containerKeks.length; round += 1) {\n const staleLevelId = firstStaleLevelId(projection);\n if (staleLevelId === null) return projection;\n if (!rekeyContainer) {\n // Not a repair someone else owes: the adapter simply cannot make one.\n throw new Error(\n \"Container share must re-key a stale path, which needs rekeyContainer\",\n );\n }\n const serverDecides = serverDecidesStaleLevel(\n staleLevelId,\n input.containerId,\n projection,\n );\n const repaired = await rekeyRemoteContainer(\n {\n api: {\n getContainerWriterProjection: (containerId) =>\n input.apiClient.getContainerWriterProjection(containerId),\n reciteContainer: (...args) =>\n input.apiClient.reciteContainer(...args),\n rekeyContainer: rekeyContainer.bind(input.apiClient),\n ...boundRekeyResult(input.apiClient),\n },\n encapsulationSecretKey: input.targetSecretKey,\n execSql: input.execSql,\n reportSecurityIncident: input.reportSecurityIncident,\n },\n {\n author: input.author,\n containerId: staleLevelId,\n resolveProjectionUserKey: input.resolveProjectionUserKey,\n stillCurrent: input.stillCurrent,\n warmReferencedPrincipalPolicies: input.warmReferencedPrincipalPolicies,\n },\n ).catch((error: unknown) => {\n const outOfReach =\n error instanceof ContainerAuthorAccessError ||\n error instanceof ContainerKekTargetUnreachableError;\n if (outOfReach && serverDecides) return null;\n throw outOfReach\n ? new ContainerKekRepairInaccessibleError(staleLevelId)\n : error;\n });\n if (input.stillCurrent?.() === false) return null;\n if (!repaired) return serverDecides ? projection : null;\n const refreshed = await input.apiClient.getContainerWriterProjection(\n input.containerId,\n );\n if (!refreshed) return null;\n projection = refreshed;\n }\n return firstStaleLevelId(projection) === null ? projection : null;\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ContainerCreateApi, ContainerMoveApi, ContainerRekeyApi, ContainerRevokeApi, ContainerShareApi } from "../../data/containers/shared/types.js";
|
|
2
|
+
import type { SecurityIncidentReporter } from "../../data/shared/securityIncidents.js";
|
|
3
|
+
import type { ExecSql } from "../../data/sqlite/sqlSchema.js";
|
|
4
|
+
import type { TrustedUserIdentityResolver } from "../../data/trustedUserIdentity/index.js";
|
|
5
|
+
/** The API slices a `ContainerMutationService` calls. */
|
|
6
|
+
export type ContainerMutationServiceApi = ContainerCreateApi & ContainerShareApi & ContainerMoveApi & ContainerRekeyApi & ContainerRevokeApi;
|
|
7
|
+
/**
|
|
8
|
+
* What a `ContainerMutationService` binds for its lifetime, one runtime
|
|
9
|
+
* snapshot: the API client, the executor, and the local identity's
|
|
10
|
+
* encapsulation secret key, so a call never mixes one snapshot's executor with
|
|
11
|
+
* another's key. Feature modules take the slice of `Api` they call.
|
|
12
|
+
*/
|
|
13
|
+
export interface ContainerMutationCollaborators<Api = ContainerMutationServiceApi> {
|
|
14
|
+
readonly api: Api;
|
|
15
|
+
/** Unwraps the container key path this identity reaches. */
|
|
16
|
+
readonly encapsulationSecretKey: Uint8Array;
|
|
17
|
+
readonly execSql: ExecSql;
|
|
18
|
+
readonly reportSecurityIncident: SecurityIncidentReporter;
|
|
19
|
+
readonly resolveTrustedUserIdentity: TrustedUserIdentityResolver;
|
|
20
|
+
}
|
|
21
|
+
/** A rotation's collaborators; only a share resolves a recipient identity. */
|
|
22
|
+
export type ContainerRotationCollaborators<Api> = Omit<ContainerMutationCollaborators<Api>, "resolveTrustedUserIdentity">;
|
|
23
|
+
/** The collaborator fields a rotation threads through its planning and submit. */
|
|
24
|
+
export interface ContainerRotationBag<Api> {
|
|
25
|
+
apiClient: Api;
|
|
26
|
+
execSql: ExecSql;
|
|
27
|
+
reportSecurityIncident: SecurityIncidentReporter;
|
|
28
|
+
targetSecretKey: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export declare function containerRotationBag<Api>(collaborators: ContainerRotationCollaborators<Api>): ContainerRotationBag<Api>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function containerRotationBag(collaborators) {
|
|
2
|
+
return {
|
|
3
|
+
apiClient: collaborators.api,
|
|
4
|
+
execSql: collaborators.execSql,
|
|
5
|
+
reportSecurityIncident: collaborators.reportSecurityIncident,
|
|
6
|
+
targetSecretKey: collaborators.encapsulationSecretKey,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=containerMutationCollaborators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerMutationCollaborators.js","sourceRoot":"","sources":["containerMutationCollaborators.ts"],"names":[],"mappings":"AAiDA,MAAM,UAAU,oBAAoB,CAClC,aAAkD;IAElD,OAAO;QACL,SAAS,EAAE,aAAa,CAAC,GAAG;QAC5B,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,sBAAsB,EAAE,aAAa,CAAC,sBAAsB;QAC5D,eAAe,EAAE,aAAa,CAAC,sBAAsB;KACtD,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ContainerCreateApi,\n ContainerMoveApi,\n ContainerRekeyApi,\n ContainerRevokeApi,\n ContainerShareApi,\n} from \"../../data/containers/shared/types\";\nimport type { SecurityIncidentReporter } from \"../../data/shared/securityIncidents\";\nimport type { ExecSql } from \"../../data/sqlite/sqlSchema\";\nimport type { TrustedUserIdentityResolver } from \"../../data/trustedUserIdentity\";\n\n/** The API slices a `ContainerMutationService` calls. */\nexport type ContainerMutationServiceApi = ContainerCreateApi &\n ContainerShareApi &\n ContainerMoveApi &\n ContainerRekeyApi &\n ContainerRevokeApi;\n\n/**\n * What a `ContainerMutationService` binds for its lifetime, one runtime\n * snapshot: the API client, the executor, and the local identity's\n * encapsulation secret key, so a call never mixes one snapshot's executor with\n * another's key. Feature modules take the slice of `Api` they call.\n */\nexport interface ContainerMutationCollaborators<\n Api = ContainerMutationServiceApi,\n> {\n readonly api: Api;\n /** Unwraps the container key path this identity reaches. */\n readonly encapsulationSecretKey: Uint8Array;\n readonly execSql: ExecSql;\n readonly reportSecurityIncident: SecurityIncidentReporter;\n readonly resolveTrustedUserIdentity: TrustedUserIdentityResolver;\n}\n\n/** A rotation's collaborators; only a share resolves a recipient identity. */\nexport type ContainerRotationCollaborators<Api> = Omit<\n ContainerMutationCollaborators<Api>,\n \"resolveTrustedUserIdentity\"\n>;\n\n/** The collaborator fields a rotation threads through its planning and submit. */\nexport interface ContainerRotationBag<Api> {\n apiClient: Api;\n execSql: ExecSql;\n reportSecurityIncident: SecurityIncidentReporter;\n targetSecretKey: Uint8Array;\n}\n\nexport function containerRotationBag<Api>(\n collaborators: ContainerRotationCollaborators<Api>,\n): ContainerRotationBag<Api> {\n return {\n apiClient: collaborators.api,\n execSql: collaborators.execSql,\n reportSecurityIncident: collaborators.reportSecurityIncident,\n targetSecretKey: collaborators.encapsulationSecretKey,\n };\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CreateRemoteContainerResult } from "../../data/containers/shared/types.js";
|
|
2
|
+
import type { RemoteContainerCreateRequest } from "./child/create/createSubmission.js";
|
|
3
|
+
import { type AppliedContainerMove, type MoveRemoteContainerRequest, type SubmittedContainerMove } from "./child/move/index.js";
|
|
4
|
+
import { type RekeyedRemoteContainer, type RekeyRemoteContainerRequest } from "./child/rekey/rekeyRemote.js";
|
|
5
|
+
import { type RevokedRemoteContainer, type RevokeRemoteContainerRequest } from "./child/revoke.js";
|
|
6
|
+
import { type SharedRemoteContainer, type ShareRemoteContainerRequest } from "./child/share/index.js";
|
|
7
|
+
import type { ContainerMutationCollaborators } from "./containerMutationCollaborators.js";
|
|
8
|
+
/**
|
|
9
|
+
* Container Data: creates, shares, moves, re-keys, and revokes remote
|
|
10
|
+
* containers. One instance binds the API client, executor, encapsulation
|
|
11
|
+
* secret key, incident reporter, and identity resolver of one runtime
|
|
12
|
+
* snapshot; each request carries what varies per call, such as the author,
|
|
13
|
+
* ids, the projection key resolver, the policy warmer, and currency checks.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ContainerMutationService {
|
|
16
|
+
private readonly containers;
|
|
17
|
+
constructor(collaborators: ContainerMutationCollaborators);
|
|
18
|
+
createRemoteContainer(request: RemoteContainerCreateRequest): Promise<CreateRemoteContainerResult | null>;
|
|
19
|
+
shareRemoteContainer(request: ShareRemoteContainerRequest): Promise<SharedRemoteContainer | null>;
|
|
20
|
+
/** Signs and submits a move; `null` when it was refused or abandoned. */
|
|
21
|
+
moveRemoteContainer(request: MoveRemoteContainerRequest): Promise<SubmittedContainerMove | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Replays a queued move. When the verified source head already sits under
|
|
24
|
+
* the destination it signs nothing and returns that head.
|
|
25
|
+
*/
|
|
26
|
+
replayRemoteContainerMove(request: MoveRemoteContainerRequest): Promise<SubmittedContainerMove | {
|
|
27
|
+
applied: AppliedContainerMove;
|
|
28
|
+
} | null>;
|
|
29
|
+
rekeyRemoteContainer(request: RekeyRemoteContainerRequest): Promise<RekeyedRemoteContainer | null>;
|
|
30
|
+
/** A concurrent mutation can advance the path while a revoke is in flight. */
|
|
31
|
+
revokeRemoteContainer(request: RevokeRemoteContainerRequest): Promise<RevokedRemoteContainer | null>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createRemoteContainer } from "./child/create/index.js";
|
|
2
|
+
import { moveRemoteContainer, replayRemoteContainerMove, } from "./child/move/index.js";
|
|
3
|
+
import { rekeyRemoteContainer, } from "./child/rekey/rekeyRemote.js";
|
|
4
|
+
import { revokeRemoteContainer, } from "./child/revoke.js";
|
|
5
|
+
import { shareRemoteContainer, } from "./child/share/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Container Data: creates, shares, moves, re-keys, and revokes remote
|
|
8
|
+
* containers. One instance binds the API client, executor, encapsulation
|
|
9
|
+
* secret key, incident reporter, and identity resolver of one runtime
|
|
10
|
+
* snapshot; each request carries what varies per call, such as the author,
|
|
11
|
+
* ids, the projection key resolver, the policy warmer, and currency checks.
|
|
12
|
+
*/
|
|
13
|
+
export class ContainerMutationService {
|
|
14
|
+
containers;
|
|
15
|
+
constructor(collaborators) {
|
|
16
|
+
this.containers = collaborators;
|
|
17
|
+
}
|
|
18
|
+
createRemoteContainer(request) {
|
|
19
|
+
return createRemoteContainer(this.containers, request);
|
|
20
|
+
}
|
|
21
|
+
shareRemoteContainer(request) {
|
|
22
|
+
return shareRemoteContainer(this.containers, request);
|
|
23
|
+
}
|
|
24
|
+
/** Signs and submits a move; `null` when it was refused or abandoned. */
|
|
25
|
+
moveRemoteContainer(request) {
|
|
26
|
+
return moveRemoteContainer(this.containers, request);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Replays a queued move. When the verified source head already sits under
|
|
30
|
+
* the destination it signs nothing and returns that head.
|
|
31
|
+
*/
|
|
32
|
+
replayRemoteContainerMove(request) {
|
|
33
|
+
return replayRemoteContainerMove(this.containers, request);
|
|
34
|
+
}
|
|
35
|
+
rekeyRemoteContainer(request) {
|
|
36
|
+
return rekeyRemoteContainer(this.containers, request);
|
|
37
|
+
}
|
|
38
|
+
/** A concurrent mutation can advance the path while a revoke is in flight. */
|
|
39
|
+
revokeRemoteContainer(request) {
|
|
40
|
+
return revokeRemoteContainer(this.containers, request);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=containerMutationService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerMutationService.js","sourceRoot":"","sources":["containerMutationService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAGL,mBAAmB,EACnB,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB;;;;;;GAMG;AACH,MAAM,OAAO,wBAAwB;IAClB,UAAU,CAAiC;IAE5D,YAAY,aAA6C;QACvD,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;IAClC,CAAC;IAED,qBAAqB,CACnB,OAAqC;QAErC,OAAO,qBAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,oBAAoB,CAClB,OAAoC;QAEpC,OAAO,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,yEAAyE;IACzE,mBAAmB,CACjB,OAAmC;QAEnC,OAAO,mBAAmB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,yBAAyB,CACvB,OAAmC;QAInC,OAAO,yBAAyB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,oBAAoB,CAClB,OAAoC;QAEpC,OAAO,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,8EAA8E;IAC9E,qBAAqB,CACnB,OAAqC;QAErC,OAAO,qBAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACF","sourcesContent":["import type { CreateRemoteContainerResult } from \"../../data/containers/shared/types\";\nimport { createRemoteContainer } from \"./child/create\";\nimport type { RemoteContainerCreateRequest } from \"./child/create/createSubmission\";\nimport {\n type AppliedContainerMove,\n type MoveRemoteContainerRequest,\n moveRemoteContainer,\n replayRemoteContainerMove,\n type SubmittedContainerMove,\n} from \"./child/move\";\nimport {\n type RekeyedRemoteContainer,\n type RekeyRemoteContainerRequest,\n rekeyRemoteContainer,\n} from \"./child/rekey/rekeyRemote\";\nimport {\n type RevokedRemoteContainer,\n type RevokeRemoteContainerRequest,\n revokeRemoteContainer,\n} from \"./child/revoke\";\nimport {\n type SharedRemoteContainer,\n type ShareRemoteContainerRequest,\n shareRemoteContainer,\n} from \"./child/share\";\nimport type { ContainerMutationCollaborators } from \"./containerMutationCollaborators\";\n\n/**\n * Container Data: creates, shares, moves, re-keys, and revokes remote\n * containers. One instance binds the API client, executor, encapsulation\n * secret key, incident reporter, and identity resolver of one runtime\n * snapshot; each request carries what varies per call, such as the author,\n * ids, the projection key resolver, the policy warmer, and currency checks.\n */\nexport class ContainerMutationService {\n private readonly containers: ContainerMutationCollaborators;\n\n constructor(collaborators: ContainerMutationCollaborators) {\n this.containers = collaborators;\n }\n\n createRemoteContainer(\n request: RemoteContainerCreateRequest,\n ): Promise<CreateRemoteContainerResult | null> {\n return createRemoteContainer(this.containers, request);\n }\n\n shareRemoteContainer(\n request: ShareRemoteContainerRequest,\n ): Promise<SharedRemoteContainer | null> {\n return shareRemoteContainer(this.containers, request);\n }\n\n /** Signs and submits a move; `null` when it was refused or abandoned. */\n moveRemoteContainer(\n request: MoveRemoteContainerRequest,\n ): Promise<SubmittedContainerMove | null> {\n return moveRemoteContainer(this.containers, request);\n }\n\n /**\n * Replays a queued move. When the verified source head already sits under\n * the destination it signs nothing and returns that head.\n */\n replayRemoteContainerMove(\n request: MoveRemoteContainerRequest,\n ): Promise<\n SubmittedContainerMove | { applied: AppliedContainerMove } | null\n > {\n return replayRemoteContainerMove(this.containers, request);\n }\n\n rekeyRemoteContainer(\n request: RekeyRemoteContainerRequest,\n ): Promise<RekeyedRemoteContainer | null> {\n return rekeyRemoteContainer(this.containers, request);\n }\n\n /** A concurrent mutation can advance the path while a revoke is in flight. */\n revokeRemoteContainer(\n request: RevokeRemoteContainerRequest,\n ): Promise<RevokedRemoteContainer | null> {\n return revokeRemoteContainer(this.containers, request);\n }\n}\n"]}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
export { ContainerAuthorAccessError } from "../../data/containers/shared/authorAccess.js";
|
|
2
2
|
export { ContainerPathTooDeepError } from "../../data/containers/shared/containerPathLimits.js";
|
|
3
3
|
export type { ContainerReciteApi } from "../../data/containers/shared/reciteApi.js";
|
|
4
|
-
export type { ContainerMutationAuthor, MaterializedContainerRekeyPlan, } from "../../data/containers/shared/types.js";
|
|
4
|
+
export type { ContainerMutationAuthor, CreateRemoteContainerResult, MaterializedContainerRekeyPlan, } from "../../data/containers/shared/types.js";
|
|
5
5
|
export type { AggregatedContainerKekLog, KeyringRebuildResult, } from "../../data/documents/shared/containerKek/index.js";
|
|
6
6
|
export { ContainerKekRepairInaccessibleError, ContainerKekRepairRequiredError, fetchContainerKekLog, HistoricalWrapUnavailableError, type HistoricalWrapUnavailableReason, rebuildKeyringEntriesFromLog, recoverKeyringEntryFromWraps, } from "../../data/documents/shared/containerKek/index.js";
|
|
7
7
|
export { isProjectionVerificationCancelledError } from "../../data/keyingProjectionVerification/types.js";
|
|
8
|
-
export { buildContainerCreatePlan, buildMaterializedContainerCreatePlan, childContainerWriterProjectionFromCreatePlan,
|
|
9
|
-
export
|
|
8
|
+
export { buildContainerCreatePlan, buildMaterializedContainerCreatePlan, childContainerWriterProjectionFromCreatePlan, } from "./child/create/index.js";
|
|
9
|
+
export type { RemoteContainerCreateRequest } from "./child/create/createSubmission.js";
|
|
10
|
+
export type { AppliedContainerMove, MoveRemoteContainerRequest, SubmittedContainerMove, } from "./child/move/index.js";
|
|
10
11
|
export { submitAcknowledgedContainerMutation, submitPlainContainerMutation, } from "./child/mutationSubmit.js";
|
|
11
12
|
export { buildMaterializedContainerRekeyPlan } from "./child/rekey/index.js";
|
|
12
13
|
export { ContainerKeyringOverrideStaleError } from "./child/rekey/keyringOverrideLineage.js";
|
|
13
14
|
export { containerWriterProjectionFromRekeyPlan } from "./child/rekey/rekeyProjection.js";
|
|
14
|
-
export {
|
|
15
|
-
export { buildMaterializedContainerRevokePlan,
|
|
16
|
-
export {
|
|
15
|
+
export type { RekeyedRemoteContainer, RekeyRemoteContainerRequest, } from "./child/rekey/rekeyRemote.js";
|
|
16
|
+
export { buildMaterializedContainerRevokePlan, type RevokedRemoteContainer, type RevokeRemoteContainerRequest, } from "./child/revoke.js";
|
|
17
|
+
export type { SharedRemoteContainer, ShareRemoteContainerRequest, } from "./child/share/index.js";
|
|
17
18
|
export { buildMaterializedContainerSharePlan } from "./child/share/shareMaterialization.js";
|
|
18
19
|
export { referencedPrincipalHeadFromPolicy } from "./child/share/sharePlanCore.js";
|
|
19
20
|
export { resolveShareProjection } from "./child/share/shareProjection.js";
|
|
21
|
+
export type { ContainerMutationCollaborators, ContainerMutationServiceApi, } from "./containerMutationCollaborators.js";
|
|
22
|
+
export { ContainerMutationService } from "./containerMutationService.js";
|
|
20
23
|
export { signedContainerMetadataDocumentId, signedContainerReferencedPrincipalHeads, } from "./mutationResponse.js";
|
|
21
24
|
export { buildRootContainerCreatePlan, rootContainerWriterProjectionFromCreatePlan, } from "./root/create.js";
|
|
22
25
|
export { type ContainerWriteRefusal, classifyContainerWriteRefusal, } from "./writeRefusal.js";
|
|
@@ -8,20 +8,18 @@ export { ContainerKekRepairInaccessibleError, ContainerKekRepairRequiredError, f
|
|
|
8
8
|
// A share's projection verification can be cancelled by a newer generation
|
|
9
9
|
// underneath the caller; hosts filter that outcome from their own reporting.
|
|
10
10
|
export { isProjectionVerificationCancelledError } from "../../data/keyingProjectionVerification/types.js";
|
|
11
|
-
export { buildContainerCreatePlan, buildMaterializedContainerCreatePlan, childContainerWriterProjectionFromCreatePlan,
|
|
12
|
-
export { moveRemoteContainer, replayRemoteContainerMove, } from "./child/move/index.js";
|
|
11
|
+
export { buildContainerCreatePlan, buildMaterializedContainerCreatePlan, childContainerWriterProjectionFromCreatePlan, } from "./child/create/index.js";
|
|
13
12
|
// Organizations' group shares submit and acknowledge their container mutation.
|
|
14
13
|
export { submitAcknowledgedContainerMutation, submitPlainContainerMutation, } from "./child/mutationSubmit.js";
|
|
15
14
|
export { buildMaterializedContainerRekeyPlan } from "./child/rekey/index.js";
|
|
16
15
|
// A rebuilt keyring override that a concurrent rotation outdated: rebuild it.
|
|
17
16
|
export { ContainerKeyringOverrideStaleError } from "./child/rekey/keyringOverrideLineage.js";
|
|
18
17
|
export { containerWriterProjectionFromRekeyPlan } from "./child/rekey/rekeyProjection.js";
|
|
19
|
-
export {
|
|
20
|
-
export { buildMaterializedContainerRevokePlan, revokeRemoteContainer, } from "./child/revoke.js";
|
|
21
|
-
export { shareRemoteContainer } from "./child/share/index.js";
|
|
18
|
+
export { buildMaterializedContainerRevokePlan, } from "./child/revoke.js";
|
|
22
19
|
export { buildMaterializedContainerSharePlan } from "./child/share/shareMaterialization.js";
|
|
23
20
|
export { referencedPrincipalHeadFromPolicy } from "./child/share/sharePlanCore.js";
|
|
24
21
|
export { resolveShareProjection } from "./child/share/shareProjection.js";
|
|
22
|
+
export { ContainerMutationService } from "./containerMutationService.js";
|
|
25
23
|
export { signedContainerMetadataDocumentId, signedContainerReferencedPrincipalHeads, } from "./mutationResponse.js";
|
|
26
24
|
export { buildRootContainerCreatePlan, rootContainerWriterProjectionFromCreatePlan, } from "./root/create.js";
|
|
27
25
|
export { classifyContainerWriteRefusal, } from "./writeRefusal.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,iEAAiE;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2C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L,4BAA4B,EAC5B,2CAA2C,GAC5C,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC","sourcesContent":["// Refusals the SDK raises before it encrypts or sends a container-scoped\n// write; hosts classify them with classifyContainerWriteRefusal.\nexport { ContainerAuthorAccessError } from \"../../data/containers/shared/authorAccess\";\n// A create or move past the readable path length; `code` is\n// `container_path_too_deep`. Queued moves are abandoned, queued creates wait.\nexport { ContainerPathTooDeepError } from \"../../data/containers/shared/containerPathLimits\";\nexport type { ContainerReciteApi } from \"../../data/containers/shared/reciteApi\";\nexport type {\n ContainerMutationAuthor,\n CreateRemoteContainerResult,\n MaterializedContainerRekeyPlan,\n} from \"../../data/containers/shared/types\";\nexport type {\n AggregatedContainerKekLog,\n KeyringRebuildResult,\n} from \"../../data/documents/shared/containerKek\";\nexport {\n ContainerKekRepairInaccessibleError,\n ContainerKekRepairRequiredError,\n fetchContainerKekLog,\n HistoricalWrapUnavailableError,\n type HistoricalWrapUnavailableReason,\n rebuildKeyringEntriesFromLog,\n recoverKeyringEntryFromWraps,\n} from \"../../data/documents/shared/containerKek\";\n// A share's projection verification can be cancelled by a newer generation\n// underneath the caller; hosts filter that outcome from their own reporting.\nexport { isProjectionVerificationCancelledError } from \"../../data/keyingProjectionVerification/types\";\nexport {\n buildContainerCreatePlan,\n buildMaterializedContainerCreatePlan,\n childContainerWriterProjectionFromCreatePlan,\n} from \"./child/create\";\nexport type { RemoteContainerCreateRequest } from \"./child/create/createSubmission\";\nexport type {\n AppliedContainerMove,\n MoveRemoteContainerRequest,\n SubmittedContainerMove,\n} from \"./child/move\";\n// Organizations' group shares submit and acknowledge their container mutation.\nexport {\n submitAcknowledgedContainerMutation,\n submitPlainContainerMutation,\n} from \"./child/mutationSubmit\";\nexport { buildMaterializedContainerRekeyPlan } from \"./child/rekey\";\n// A rebuilt keyring override that a concurrent rotation outdated: rebuild it.\nexport { ContainerKeyringOverrideStaleError } from \"./child/rekey/keyringOverrideLineage\";\nexport { containerWriterProjectionFromRekeyPlan } from \"./child/rekey/rekeyProjection\";\nexport type {\n RekeyedRemoteContainer,\n RekeyRemoteContainerRequest,\n} from \"./child/rekey/rekeyRemote\";\nexport {\n buildMaterializedContainerRevokePlan,\n type RevokedRemoteContainer,\n type RevokeRemoteContainerRequest,\n} from \"./child/revoke\";\nexport type {\n SharedRemoteContainer,\n ShareRemoteContainerRequest,\n} from \"./child/share\";\nexport { buildMaterializedContainerSharePlan } from \"./child/share/shareMaterialization\";\nexport { referencedPrincipalHeadFromPolicy } from \"./child/share/sharePlanCore\";\nexport { resolveShareProjection } from \"./child/share/shareProjection\";\nexport type {\n ContainerMutationCollaborators,\n ContainerMutationServiceApi,\n} from \"./containerMutationCollaborators\";\nexport { ContainerMutationService } from \"./containerMutationService\";\nexport {\n signedContainerMetadataDocumentId,\n signedContainerReferencedPrincipalHeads,\n} from \"./mutationResponse\";\nexport {\n buildRootContainerCreatePlan,\n rootContainerWriterProjectionFromCreatePlan,\n} from \"./root/create\";\nexport {\n type ContainerWriteRefusal,\n classifyContainerWriteRefusal,\n} from \"./writeRefusal\";\n"]}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import type { ContainerDirectGrant } from "../../internal/crypto/index.js";
|
|
2
2
|
import type { ContainerMutationResponse } from "../../internal/validators/response/index.js";
|
|
3
3
|
import type { ReferencedPrincipalPolicyWarmer } from "../../data/keyingProjectionVerification/index.js";
|
|
4
|
-
import type { SecurityIncidentReporter } from "../../data/shared/securityIncidents.js";
|
|
5
|
-
import type { ExecSql } from "../../data/sqlite/sqlSchema.js";
|
|
6
4
|
import type { TrustedUserIdentityResolver } from "../../data/trustedUserIdentity/index.js";
|
|
7
|
-
import {
|
|
5
|
+
import type { ContainerMutationService } from "../containers/index.js";
|
|
8
6
|
type OrganizationContainerGrantSubject = Pick<ContainerDirectGrant, "subjectId" | "subjectType">;
|
|
9
|
-
type OrganizationContainerGrantRevocationApi = Parameters<typeof revokeRemoteContainer>[0]["apiClient"];
|
|
10
7
|
export declare function revokeOrganizationContainerGrant(input: {
|
|
11
8
|
readonly stillCurrent: () => boolean;
|
|
12
|
-
readonly reportSecurityIncident: SecurityIncidentReporter;
|
|
13
|
-
readonly apiClient: OrganizationContainerGrantRevocationApi;
|
|
14
9
|
readonly containerId: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly secretKey: Uint8Array;
|
|
18
|
-
};
|
|
19
|
-
readonly execSql: ExecSql;
|
|
10
|
+
/** Bound to the runtime snapshot whose encapsulation key reaches the container. */
|
|
11
|
+
readonly containers: ContainerMutationService;
|
|
20
12
|
readonly organizationId: string;
|
|
21
13
|
readonly resolveTrustedUserIdentity: TrustedUserIdentityResolver;
|
|
22
14
|
readonly revokedSubject: OrganizationContainerGrantSubject;
|