@tearleads/client-sdk 0.1.40 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/client/Tearleads.js +3 -0
  2. package/client/Tearleads.js.map +1 -1
  3. package/data/documents/shared/syncResponses.js +5 -7
  4. package/data/documents/shared/syncResponses.js.map +1 -1
  5. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js +2 -0
  6. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js.map +1 -1
  7. package/data/keyingProjectionVerification/checkpointContext.d.ts +12 -0
  8. package/data/keyingProjectionVerification/checkpointContext.js +16 -0
  9. package/data/keyingProjectionVerification/checkpointContext.js.map +1 -1
  10. package/data/keyingProjectionVerification/containerDestinationVerification.js +3 -1
  11. package/data/keyingProjectionVerification/containerDestinationVerification.js.map +1 -1
  12. package/data/keyingProjectionVerification/containerProjectionVerification.js +12 -6
  13. package/data/keyingProjectionVerification/containerProjectionVerification.js.map +1 -1
  14. package/data/keyingProjectionVerification/documentProjectionVerification.js +10 -4
  15. package/data/keyingProjectionVerification/documentProjectionVerification.js.map +1 -1
  16. package/data/persistence/keyingCheckpointAdvancePersistence.js +27 -8
  17. package/data/persistence/keyingCheckpointAdvancePersistence.js.map +1 -1
  18. package/data/persistence/verifiedManifestBundlePersistence.d.ts +45 -0
  19. package/data/persistence/verifiedManifestBundlePersistence.js +282 -0
  20. package/data/persistence/verifiedManifestBundlePersistence.js.map +1 -0
  21. package/data/sqlite/schema.d.ts +157 -0
  22. package/data/sqlite/schema.js +3 -0
  23. package/data/sqlite/schema.js.map +1 -1
  24. package/data/sqlite/verifiedManifestBundleSchema.d.ts +174 -0
  25. package/data/sqlite/verifiedManifestBundleSchema.js +36 -0
  26. package/data/sqlite/verifiedManifestBundleSchema.js.map +1 -0
  27. package/internal/api-client/ApiClient.d.ts +4 -11
  28. package/internal/api-client/ApiClient.js +8 -6
  29. package/internal/api-client/ApiClient.js.map +1 -1
  30. package/internal/api-client/index.d.ts +1 -1
  31. package/internal/api-client/index.js +0 -1
  32. package/internal/api-client/index.js.map +1 -1
  33. package/internal/api-client/principalHistoryRequest.js +8 -2
  34. package/internal/api-client/principalHistoryRequest.js.map +1 -1
  35. package/internal/api-client/principalHistoryRequestContext.js +15 -5
  36. package/internal/api-client/principalHistoryRequestContext.js.map +1 -1
  37. package/internal/api-client/routes/writerProjections.js +6 -3
  38. package/internal/api-client/routes/writerProjections.js.map +1 -1
  39. package/internal/api-client/verifiedManifestCitations.d.ts +23 -0
  40. package/internal/api-client/verifiedManifestCitations.js +60 -0
  41. package/internal/api-client/verifiedManifestCitations.js.map +1 -0
  42. package/internal/api-client/writerProjectionRequests.js +75 -14
  43. package/internal/api-client/writerProjectionRequests.js.map +1 -1
  44. package/internal/crypto/index.d.ts +0 -1
  45. package/internal/crypto/index.js +0 -1
  46. package/internal/crypto/index.js.map +1 -1
  47. package/internal/validators/documentSyncRefinements.js +5 -0
  48. package/internal/validators/documentSyncRefinements.js.map +1 -1
  49. package/internal/validators/knownManifestsRefinements.js +5 -0
  50. package/internal/validators/knownManifestsRefinements.js.map +1 -0
  51. package/internal/validators/operation/documentSync.d.ts +3 -0
  52. package/internal/validators/operation/writerProjections.d.ts +85 -319
  53. package/internal/validators/operation/writerProjections.js +11 -11
  54. package/internal/validators/operation/writerProjections.js.map +1 -1
  55. package/internal/validators/response/container.d.ts +429 -20
  56. package/internal/validators/response/container.js +40 -5
  57. package/internal/validators/response/container.js.map +1 -1
  58. package/internal/validators/response/documentMutation.d.ts +440 -20
  59. package/internal/validators/response/documentMutation.js +33 -3
  60. package/internal/validators/response/documentMutation.js.map +1 -1
  61. package/internal/validators/response/documentSyncSchema.js +35 -1
  62. package/internal/validators/response/documentSyncSchema.js.map +1 -1
  63. package/internal/validators/response/index.d.ts +3 -2
  64. package/internal/validators/response/index.js +3 -2
  65. package/internal/validators/response/index.js.map +1 -1
  66. package/internal/validators/response/manifestBundleReferences.js +79 -0
  67. package/internal/validators/response/manifestBundleReferences.js.map +1 -0
  68. package/internal/validators/response/writerProjectionWire.d.ts +19 -0
  69. package/internal/validators/response/writerProjectionWire.js +132 -0
  70. package/internal/validators/response/writerProjectionWire.js.map +1 -0
  71. package/internal/validators/schema.js +20 -0
  72. package/internal/validators/schema.js.map +1 -1
  73. package/internal/validators/util/index.d.ts +1 -1
  74. package/internal/validators/util/index.js +1 -1
  75. package/internal/validators/util/index.js.map +1 -1
  76. package/internal/validators/util/knownManifestWire.d.ts +11 -0
  77. package/internal/validators/util/knownManifestWire.js +28 -0
  78. package/internal/validators/util/knownManifestWire.js.map +1 -0
  79. package/internal/validators/writerProjectionRefinements.js +5 -0
  80. package/internal/validators/writerProjectionRefinements.js.map +1 -1
  81. package/package.json +1 -1
  82. package/workflows/documents/syncContentKeys.js +4 -9
  83. package/workflows/documents/syncContentKeys.js.map +1 -1
  84. package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -5
  85. package/workflows/sync/remoteReset.js +2 -0
  86. package/workflows/sync/remoteReset.js.map +1 -1
  87. package/internal/api-client/projectionHistoryTransport.js +0 -107
  88. package/internal/api-client/projectionHistoryTransport.js.map +0 -1
  89. package/internal/api-client/verifiedProjectionHistory.d.ts +0 -4
  90. package/internal/api-client/verifiedProjectionHistory.js +0 -12
  91. package/internal/api-client/verifiedProjectionHistory.js.map +0 -1
  92. package/internal/crypto/projectionHistory.d.ts +0 -14
  93. package/internal/crypto/projectionHistory.js +0 -90
  94. package/internal/crypto/projectionHistory.js.map +0 -1
  95. package/internal/crypto/projectionHistorySlots.d.ts +0 -13
  96. package/internal/crypto/projectionHistorySlots.js +0 -81
  97. package/internal/crypto/projectionHistorySlots.js.map +0 -1
  98. package/internal/validators/projectionHistoryRefinements.js +0 -5
  99. package/internal/validators/projectionHistoryRefinements.js.map +0 -1
  100. package/internal/validators/util/projectionHistoryWire.d.ts +0 -23
  101. package/internal/validators/util/projectionHistoryWire.js +0 -33
  102. package/internal/validators/util/projectionHistoryWire.js.map +0 -1
@@ -3,30 +3,40 @@ export class PrincipalHistoryRequestContext {
3
3
  runtime;
4
4
  method;
5
5
  path;
6
+ identity;
6
7
  options;
7
- token;
8
8
  submitted = false;
9
9
  renewedRead = false;
10
10
  restartedRead = false;
11
- constructor(runtime, method, path, options) {
11
+ constructor(runtime, method, path, options,
12
+ // Requests of one operation share the identity they started under.
13
+ identity = { token: runtime.getAuthToken() }) {
12
14
  this.runtime = runtime;
13
15
  this.method = method;
14
16
  this.path = path;
15
- this.token = runtime.getAuthToken();
17
+ this.identity = identity;
16
18
  this.options = {
17
19
  ...options,
18
20
  retryOnSessionExpired: options?.retryOnSessionExpired === false ? false : "renew-only",
19
21
  onSessionRenewed: () => {
20
22
  if (method === "GET" && !options?.signal?.aborted) {
21
- this.token = runtime.getAuthToken();
23
+ this.identity.token = runtime.getAuthToken();
22
24
  this.renewedRead = true;
23
25
  }
24
26
  },
25
27
  };
26
28
  }
29
+ /**
30
+ * Another request of the same operation, with its own options: an account
31
+ * switch at any point cancels both, while a session renewal in either
32
+ * carries over.
33
+ */
34
+ derive(options) {
35
+ return new PrincipalHistoryRequestContext(this.runtime, this.method, this.path, options, this.identity);
36
+ }
27
37
  cancelled() {
28
38
  return (this.options.signal?.aborted === true ||
29
- this.runtime.getAuthToken() !== this.token);
39
+ this.runtime.getAuthToken() !== this.identity.token);
30
40
  }
31
41
  beforeRequest() {
32
42
  this.submitted = this.method !== "GET";
@@ -1 +1 @@
1
- {"version":3,"file":"principalHistoryRequestContext.js","sourceRoot":"","sources":["principalHistoryRequestContext.ts"],"names":[],"mappings":"AAGA,gGAAgG;AAChG,MAAM,OAAO,8BAA8B;IAQtB;IACA;IACA;IATV,OAAO,CAAuB;IAC/B,KAAK,CAAgB;IACrB,SAAS,GAAG,KAAK,CAAC;IAClB,WAAW,GAAG,KAAK,CAAC;IACpB,aAAa,GAAG,KAAK,CAAC;IAE9B,YACmB,OAA0B,EAC1B,MAAkB,EAClB,IAAY,E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,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,QAAmB,EAAE,QAAQ,GAAG,KAAK;QAC3C,KAAK,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC;YAChD,IAAI,EAAE,IAAI,CAAC,SAAS;gBAClB,CAAC,CAAC,mCAAmC;gBACrC,CAAC,CAAC,QAAQ;oBACR,CAAC,CAAC,qCAAqC;oBACvC,CAAC,CAAC,mCAAmC;YACzC,IAAI,EAAE,IAAI,CAAC,SAAS;gBAClB,CAAC,CAAC,iBAAiB;gBACnB,CAAC,CAAC,QAAQ;oBACR,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,WAAW;YACjB,OAAO,EAAE,IAAI,CAAC,SAAS;gBACrB,CAAC,CAAC,4DAA4D;gBAC9D,CAAC,CAAC,QAAQ;oBACR,CAAC,CAAC,qCAAqC;oBACvC,CAAC,CAAC,yCAAyC;YAC/C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE;gBACP,GAAG,IAAI,CAAC,OAAO;gBACf,YAAY,EACV,QAAQ;oBACR,IAAI,CAAC,MAAM,KAAK,KAAK;oBACrB,IAAI,CAAC,OAAO,CAAC,YAAY,KAAK,KAAK;aACtC;YACD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport type { HttpMethod, RequestFailure, RequestResultOptions } from \"./types\";\n\n/** Keep continuations within their authentication context without hiding commit uncertainty. */\nexport class PrincipalHistoryRequestContext {\n readonly options: RequestResultOptions;\n private token: string | null;\n private submitted = false;\n private renewedRead = false;\n private restartedRead = false;\n\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly method: HttpMethod,\n private readonly path: string,\n options: RequestResultOptions | undefined,\n ) {\n this.token = runtime.getAuthToken();\n this.options = {\n ...options,\n retryOnSessionExpired:\n options?.retryOnSessionExpired === false ? false : \"renew-only\",\n onSessionRenewed: () => {\n if (method === \"GET\" && !options?.signal?.aborted) {\n this.token = runtime.getAuthToken();\n this.renewedRead = true;\n }\n },\n };\n }\n\n cancelled(): boolean {\n return (\n this.options.signal?.aborted === true ||\n this.runtime.getAuthToken() !== this.token\n );\n }\n\n beforeRequest(): void {\n this.submitted = this.method !== \"GET\";\n }\n\n afterPreparation(): void {\n this.submitted = false;\n }\n\n afterReadPage(): void {\n // A completed page is forward progress. A later page may renew again,\n // while repeated 401s within one page still cannot loop indefinitely.\n this.renewedRead = false;\n this.restartedRead = false;\n }\n\n restartReadAfterRenewal(): boolean {\n if (!this.renewedRead || this.restartedRead || this.cancelled())\n return false;\n this.restartedRead = true;\n return true;\n }\n\n failure(response?: Response, timedOut = false): RequestFailure {\n void response?.body?.cancel().catch(() => {});\n return this.runtime.responseRequest.reportFailure({\n code: this.submitted\n ? \"principal_history_outcome_unknown\"\n : timedOut\n ? \"principal_history_request_timed_out\"\n : \"principal_history_context_changed\",\n kind: this.submitted\n ? \"outcome-unknown\"\n : timedOut\n ? \"network\"\n : \"cancelled\",\n message: this.submitted\n ? \"Policy request may have committed; refresh before retrying\"\n : timedOut\n ? \"Principal history request timed out\"\n : \"Principal history request was cancelled\",\n method: this.method,\n options: {\n ...this.options,\n reportErrors:\n timedOut &&\n this.method === \"GET\" &&\n this.options.reportErrors !== false,\n },\n path: this.path,\n status: null,\n statusText: \"\",\n });\n }\n}\n"]}
1
+ {"version":3,"file":"principalHistoryRequestContext.js","sourceRoot":"","sources":["principalHistoryRequestContext.ts"],"names":[],"mappings":"AAGA,gGAAgG;AAChG,MAAM,OAAO,8BAA8B;IAOtB;IACA;IACA;IAGA;IAXV,OAAO,CAAuB;IAC/B,SAAS,GAAG,KAAK,CAAC;IA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KAAK;aACtC;YACD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport type { HttpMethod, RequestFailure, RequestResultOptions } from \"./types\";\n\n/** Keep continuations within their authentication context without hiding commit uncertainty. */\nexport class PrincipalHistoryRequestContext {\n readonly options: RequestResultOptions;\n private submitted = false;\n private renewedRead = false;\n private restartedRead = false;\n\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly method: HttpMethod,\n private readonly path: string,\n options: RequestResultOptions | undefined,\n // Requests of one operation share the identity they started under.\n private readonly identity = { token: runtime.getAuthToken() },\n ) {\n this.options = {\n ...options,\n retryOnSessionExpired:\n options?.retryOnSessionExpired === false ? false : \"renew-only\",\n onSessionRenewed: () => {\n if (method === \"GET\" && !options?.signal?.aborted) {\n this.identity.token = runtime.getAuthToken();\n this.renewedRead = true;\n }\n },\n };\n }\n\n /**\n * Another request of the same operation, with its own options: an account\n * switch at any point cancels both, while a session renewal in either\n * carries over.\n */\n derive(options: RequestResultOptions): PrincipalHistoryRequestContext {\n return new PrincipalHistoryRequestContext(\n this.runtime,\n this.method,\n this.path,\n options,\n this.identity,\n );\n }\n\n cancelled(): boolean {\n return (\n this.options.signal?.aborted === true ||\n this.runtime.getAuthToken() !== this.identity.token\n );\n }\n\n beforeRequest(): void {\n this.submitted = this.method !== \"GET\";\n }\n\n afterPreparation(): void {\n this.submitted = false;\n }\n\n afterReadPage(): void {\n // A completed page is forward progress. A later page may renew again,\n // while repeated 401s within one page still cannot loop indefinitely.\n this.renewedRead = false;\n this.restartedRead = false;\n }\n\n restartReadAfterRenewal(): boolean {\n if (!this.renewedRead || this.restartedRead || this.cancelled())\n return false;\n this.restartedRead = true;\n return true;\n }\n\n failure(response?: Response, timedOut = false): RequestFailure {\n void response?.body?.cancel().catch(() => {});\n return this.runtime.responseRequest.reportFailure({\n code: this.submitted\n ? \"principal_history_outcome_unknown\"\n : timedOut\n ? \"principal_history_request_timed_out\"\n : \"principal_history_context_changed\",\n kind: this.submitted\n ? \"outcome-unknown\"\n : timedOut\n ? \"network\"\n : \"cancelled\",\n message: this.submitted\n ? \"Policy request may have committed; refresh before retrying\"\n : timedOut\n ? \"Principal history request timed out\"\n : \"Principal history request was cancelled\",\n method: this.method,\n options: {\n ...this.options,\n reportErrors:\n timedOut &&\n this.method === \"GET\" &&\n this.options.reportErrors !== false,\n },\n path: this.path,\n status: null,\n statusText: \"\",\n });\n }\n}\n"]}
@@ -1,4 +1,7 @@
1
- import { getContainerWriterProjectionOperation, getDocumentWriterProjectionOperation, isGetContainerWriterProjectionOperationResponse, isGetDocumentWriterProjectionOperationResponse, operationRequestPath, } from "../../validators/operation/index.js";
1
+ import { getContainerWriterProjectionOperation, getDocumentWriterProjectionOperation, operationRequestPath, } from "../../validators/operation/index.js";
2
+ import { isContainerWriterProjectionResponse, isDocumentWriterProjectionResponse, } from "../../validators/response/index.js";
3
+ // Validators run on the decoded projection: the transport resolves the wire's
4
+ // manifest-hash citations into bundles first (writerProjectionRequests).
2
5
  // A writer projection is consumed by its leaf: callers wrap keys under
3
6
  // whatever container or document the response describes. Binding the
4
7
  // validator to the requested id makes a projection for any other object an
@@ -24,7 +27,7 @@ function containerProjectionDescribes(projection, containerId) {
24
27
  }
25
28
  export const containerWriterProjection = {
26
29
  isResponseFor(containerId) {
27
- return (value) => isGetContainerWriterProjectionOperationResponse(value) &&
30
+ return (value) => isContainerWriterProjectionResponse(value) &&
28
31
  containerProjectionDescribes(value, containerId);
29
32
  },
30
33
  method: getContainerWriterProjectionOperation.method,
@@ -39,7 +42,7 @@ export const documentWriterProjection = {
39
42
  // least describe the container it labels itself with, so a substituted
40
43
  // path cannot smuggle another container's leaf under a relabeled id.
41
44
  isResponseFor(documentId) {
42
- return (value) => isGetDocumentWriterProjectionOperationResponse(value) &&
45
+ return (value) => isDocumentWriterProjectionResponse(value) &&
43
46
  value.documentId === documentId &&
44
47
  manifestDescribes(value.documentManifest, "documentId", documentId) &&
45
48
  value.documentKekTargets.documentId === documentId &&
@@ -1 +1 @@
1
- {"version":3,"file":"writerProjections.js","sourceRoot":"","sources":["writerProjections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,oCAAoC,EACpC,+CAA+C,EAC/C,8CAA8C,EAC9C,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAOzC,uEAAuE;AACvE,qEAAqE;AACrE,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,wEAAwE;AACxE,mEAAmE;AACnE,SAAS,iBAAiB,CACxB,MAA6E,EAC7E,QAAsC,EACtC,EAAU;IAEV,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE;QAC/C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAC3C,CAAC;AACJ,CAAC;AAED,SAAS,4BAA4B,CACnC,UAAuC,EACvC,WAAmB;IAEnB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,OAAO,CACL,UAAU,CAAC,WAAW,KAAK,WAAW;QACtC,IAAI,KAAK,SAAS;QAClB,OAAO,KAAK,SAAS;QACrB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC;QACnD,OAAO,CAAC,WAAW,KAAK,WAAW;QACnC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,KAAK,WAAW;QAC5D,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,aAAa,CAAC,WAAmB;QAC/B,OAAO,CAAC,KAAc,EAA8C,EAAE,CACpE,+CAA+C,CAAC,KAAK,CAAC;YACtD,4BAA4B,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,EAAE,qCAAqC,CAAC,MAAM;IACpD,IAAI,CAAC,WAAmB;QACtB,OAAO,oBAAoB,CAAC,qCAAqC,EAAE;YACjE,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,0EAA0E;IAC1E,uEAAuE;IACvE,qEAAqE;IACrE,aAAa,CAAC,UAAkB;QAC9B,OAAO,CAAC,KAAc,EAA6C,EAAE,CACnE,8CAA8C,CAAC,KAAK,CAAC;YACrD,KAAK,CAAC,UAAU,KAAK,UAAU;YAC/B,iBAAiB,CAAC,KAAK,CAAC,gBAAgB,EAAE,YAAY,EAAE,UAAU,CAAC;YACnE,KAAK,CAAC,kBAAkB,CAAC,UAAU,KAAK,UAAU;YAClD,KAAK,CAAC,gBAAgB,CAAC,UAAU,KAAK,UAAU;YAChD,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CACnD,4BAA4B,CAAC,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,CACjE,CAAC;IACN,CAAC;IACD,MAAM,EAAE,oCAAoC,CAAC,MAAM;IACnD,IAAI,CAAC,UAAkB;QACrB,OAAO,oBAAoB,CAAC,oCAAoC,EAAE;YAChE,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["import {\n getContainerWriterProjectionOperation,\n getDocumentWriterProjectionOperation,\n isGetContainerWriterProjectionOperationResponse,\n isGetDocumentWriterProjectionOperationResponse,\n operationRequestPath,\n} from \"@tearleads/validators/operation\";\nimport type {\n ContainerKeyingPathResponse,\n ContainerWriterProjectionResponse,\n DocumentWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\n\n// A writer projection is consumed by its leaf: callers wrap keys under\n// whatever container or document the response describes. Binding the\n// validator to the requested id makes a projection for any other object an\n// invalid response, so a server cannot redirect a create, move, share, rekey,\n// or content-key re-wrap onto an object it substituted. The top-level id is a\n// mutable label, so the binding also covers the hash-committed manifest object\n// id, the manifest state the SDK later verifies, and the nested KEK and\n// content-key bundle ids a relabeled projection would still carry.\nfunction manifestDescribes(\n bundle: { manifest: Record<string, unknown>; state: Record<string, unknown> },\n stateKey: \"containerId\" | \"documentId\",\n id: string,\n): boolean {\n return (\n Reflect.get(bundle.manifest, \"objectId\") === id &&\n Reflect.get(bundle.state, stateKey) === id\n );\n}\n\nfunction containerProjectionDescribes(\n projection: ContainerKeyingPathResponse,\n containerId: string,\n): boolean {\n const leaf = projection.path.at(-1);\n const leafKek = projection.containerKeks.at(-1);\n return (\n projection.containerId === containerId &&\n leaf !== undefined &&\n leafKek !== undefined &&\n manifestDescribes(leaf, \"containerId\", containerId) &&\n leafKek.containerId === containerId &&\n Reflect.get(leafKek.keyEpoch, \"containerId\") === containerId &&\n (leafKek.keyring === null || leafKek.keyring.containerId === containerId)\n );\n}\n\nexport const containerWriterProjection = {\n isResponseFor(containerId: string) {\n return (value: unknown): value is ContainerWriterProjectionResponse =>\n isGetContainerWriterProjectionOperationResponse(value) &&\n containerProjectionDescribes(value, containerId);\n },\n method: getContainerWriterProjectionOperation.method,\n path(containerId: string) {\n return operationRequestPath(getContainerWriterProjectionOperation, {\n containerId,\n });\n },\n};\n\nexport const documentWriterProjection = {\n // The authorizing container paths carry no requested id, but each must at\n // least describe the container it labels itself with, so a substituted\n // path cannot smuggle another container's leaf under a relabeled id.\n isResponseFor(documentId: string) {\n return (value: unknown): value is DocumentWriterProjectionResponse =>\n isGetDocumentWriterProjectionOperationResponse(value) &&\n value.documentId === documentId &&\n manifestDescribes(value.documentManifest, \"documentId\", documentId) &&\n value.documentKekTargets.documentId === documentId &&\n value.contentKeyBundle.documentId === documentId &&\n value.authorizingContainerPaths.every((projection) =>\n containerProjectionDescribes(projection, projection.containerId),\n );\n },\n method: getDocumentWriterProjectionOperation.method,\n path(documentId: string) {\n return operationRequestPath(getDocumentWriterProjectionOperation, {\n documentId,\n });\n },\n};\n"]}
1
+ {"version":3,"file":"writerProjections.js","sourceRoot":"","sources":["writerProjections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,oCAAoC,EACpC,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAIL,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,gCAAgC,CAAC;AAExC,8EAA8E;AAC9E,yEAAyE;AACzE,uEAAuE;AACvE,qEAAqE;AACrE,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,wEAAwE;AACxE,mEAAmE;AACnE,SAAS,iBAAiB,CACxB,MAA6E,EAC7E,QAAsC,EACtC,EAAU;IAEV,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE;QAC/C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAC3C,CAAC;AACJ,CAAC;AAED,SAAS,4BAA4B,CACnC,UAAuC,EACvC,WAAmB;IAEnB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,OAAO,CACL,UAAU,CAAC,WAAW,KAAK,WAAW;QACtC,IAAI,KAAK,SAAS;QAClB,OAAO,KAAK,SAAS;QACrB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,CAAC;QACnD,O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AU;SACX,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["import {\n getContainerWriterProjectionOperation,\n getDocumentWriterProjectionOperation,\n operationRequestPath,\n} from \"@tearleads/validators/operation\";\nimport {\n type ContainerKeyingPathResponse,\n type ContainerWriterProjectionResponse,\n type DocumentWriterProjectionResponse,\n isContainerWriterProjectionResponse,\n isDocumentWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\n\n// Validators run on the decoded projection: the transport resolves the wire's\n// manifest-hash citations into bundles first (writerProjectionRequests).\n// A writer projection is consumed by its leaf: callers wrap keys under\n// whatever container or document the response describes. Binding the\n// validator to the requested id makes a projection for any other object an\n// invalid response, so a server cannot redirect a create, move, share, rekey,\n// or content-key re-wrap onto an object it substituted. The top-level id is a\n// mutable label, so the binding also covers the hash-committed manifest object\n// id, the manifest state the SDK later verifies, and the nested KEK and\n// content-key bundle ids a relabeled projection would still carry.\nfunction manifestDescribes(\n bundle: { manifest: Record<string, unknown>; state: Record<string, unknown> },\n stateKey: \"containerId\" | \"documentId\",\n id: string,\n): boolean {\n return (\n Reflect.get(bundle.manifest, \"objectId\") === id &&\n Reflect.get(bundle.state, stateKey) === id\n );\n}\n\nfunction containerProjectionDescribes(\n projection: ContainerKeyingPathResponse,\n containerId: string,\n): boolean {\n const leaf = projection.path.at(-1);\n const leafKek = projection.containerKeks.at(-1);\n return (\n projection.containerId === containerId &&\n leaf !== undefined &&\n leafKek !== undefined &&\n manifestDescribes(leaf, \"containerId\", containerId) &&\n leafKek.containerId === containerId &&\n Reflect.get(leafKek.keyEpoch, \"containerId\") === containerId &&\n (leafKek.keyring === null || leafKek.keyring.containerId === containerId)\n );\n}\n\nexport const containerWriterProjection = {\n isResponseFor(containerId: string) {\n return (value: unknown): value is ContainerWriterProjectionResponse =>\n isContainerWriterProjectionResponse(value) &&\n containerProjectionDescribes(value, containerId);\n },\n method: getContainerWriterProjectionOperation.method,\n path(containerId: string) {\n return operationRequestPath(getContainerWriterProjectionOperation, {\n containerId,\n });\n },\n};\n\nexport const documentWriterProjection = {\n // The authorizing container paths carry no requested id, but each must at\n // least describe the container it labels itself with, so a substituted\n // path cannot smuggle another container's leaf under a relabeled id.\n isResponseFor(documentId: string) {\n return (value: unknown): value is DocumentWriterProjectionResponse =>\n isDocumentWriterProjectionResponse(value) &&\n value.documentId === documentId &&\n manifestDescribes(value.documentManifest, \"documentId\", documentId) &&\n value.documentKekTargets.documentId === documentId &&\n value.contentKeyBundle.documentId === documentId &&\n value.authorizingContainerPaths.every((projection) =>\n containerProjectionDescribes(projection, projection.containerId),\n );\n },\n method: getDocumentWriterProjectionOperation.method,\n path(documentId: string) {\n return operationRequestPath(getDocumentWriterProjectionOperation, {\n documentId,\n });\n },\n};\n"]}
@@ -0,0 +1,23 @@
1
+ import { type AccessManifestBundleWireResponse } from "../validators/response/index.js";
2
+ /** Citation only saves bytes: a source slower than this sends the read uncited. */
3
+ export declare const MANIFEST_CITATION_DEADLINE_MS = 250;
4
+ export interface WriterProjectionTarget {
5
+ readonly kind: "container" | "document";
6
+ readonly id: string;
7
+ }
8
+ /**
9
+ * Verified access-manifest bundles a device durably holds that a writer
10
+ * projection of `target` may cite, most useful first. This is never trust
11
+ * input: the exact cited bytes only fill the response's omitted positions,
12
+ * and the caller verifies the rebuilt projection exactly as a full one.
13
+ */
14
+ export interface VerifiedManifestCitations {
15
+ cite(target: WriterProjectionTarget): Promise<readonly AccessManifestBundleWireResponse[]>;
16
+ }
17
+ /**
18
+ * The bytes one request cites, copied so a later eviction or mutation of the
19
+ * source cannot change what fills its omissions. Citing only saves bytes, so
20
+ * it never blocks or fails a read: a slow, failing, or abandoned source
21
+ * yields no hints.
22
+ */
23
+ export declare function heldManifestCitations(source: VerifiedManifestCitations | null, target: WriterProjectionTarget, signal?: AbortSignal | undefined): Promise<Map<string, AccessManifestBundleWireResponse>>;
@@ -0,0 +1,60 @@
1
+ import { isAccessManifestBundleWireResponse, } from "../validators/response/index.js";
2
+ import { isSha256HexString, KNOWN_MANIFEST_HINT_LIMIT, } from "../validators/util/index.js";
3
+ /** Citation only saves bytes: a source slower than this sends the read uncited. */
4
+ export const MANIFEST_CITATION_DEADLINE_MS = 250;
5
+ /**
6
+ * The source's answer, or nothing once the deadline passes, the caller
7
+ * aborts, or the source throws or rejects. A late answer is discarded: it can
8
+ * never reach a request that was already sent.
9
+ */
10
+ function boundedCitation(source, target, signal) {
11
+ return new Promise((resolve) => {
12
+ let settled = false;
13
+ const finish = (bundles) => {
14
+ if (settled)
15
+ return;
16
+ settled = true;
17
+ clearTimeout(timer);
18
+ signal?.removeEventListener("abort", abandon);
19
+ resolve(bundles);
20
+ };
21
+ const abandon = () => finish([]);
22
+ const timer = setTimeout(abandon, MANIFEST_CITATION_DEADLINE_MS);
23
+ if (signal?.aborted)
24
+ return abandon();
25
+ signal?.addEventListener("abort", abandon, { once: true });
26
+ try {
27
+ source.cite(target).then(finish, abandon);
28
+ }
29
+ catch {
30
+ abandon();
31
+ }
32
+ });
33
+ }
34
+ /**
35
+ * The bytes one request cites, copied so a later eviction or mutation of the
36
+ * source cannot change what fills its omissions. Citing only saves bytes, so
37
+ * it never blocks or fails a read: a slow, failing, or abandoned source
38
+ * yields no hints.
39
+ */
40
+ export async function heldManifestCitations(source, target, signal) {
41
+ const held = new Map();
42
+ if (!source)
43
+ return held;
44
+ for (const bundle of await boundedCitation(source, target, signal)) {
45
+ if (held.size >= KNOWN_MANIFEST_HINT_LIMIT)
46
+ break;
47
+ if (!isAccessManifestBundleWireResponse(bundle) ||
48
+ !isSha256HexString(bundle.manifestHash) ||
49
+ held.has(bundle.manifestHash))
50
+ continue;
51
+ try {
52
+ held.set(bundle.manifestHash, structuredClone(bundle));
53
+ }
54
+ catch {
55
+ // An uncloneable entry is skipped; its manifest simply travels.
56
+ }
57
+ }
58
+ return held;
59
+ }
60
+ //# sourceMappingURL=verifiedManifestCitations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifiedManifestCitations.js","sourceRoot":"","sources":["verifi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,EAC9B,MAAgC;IAEhC,MAAM,IAAI,GAAG,IAAI,GAAG,EAA4C,CAAC;IACjE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,KAAK,MAAM,MAAM,IAAI,MAAM,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QACnE,IAAI,IAAI,CAAC,IAAI,IAAI,yBAAyB;YAAE,MAAM;QAClD,IACE,CAAC,kCAAkC,CAAC,MAAM,CAAC;YAC3C,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC;YACvC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;YAE7B,SAAS;QACX,IAAI,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,gEAAgE;QAClE,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {\n type AccessManifestBundleWireResponse,\n isAccessManifestBundleWireResponse,\n} from \"@tearleads/validators/response\";\nimport {\n isSha256HexString,\n KNOWN_MANIFEST_HINT_LIMIT,\n} from \"@tearleads/validators/util\";\n\n/** Citation only saves bytes: a source slower than this sends the read uncited. */\nexport const MANIFEST_CITATION_DEADLINE_MS = 250;\n\nexport interface WriterProjectionTarget {\n readonly kind: \"container\" | \"document\";\n readonly id: string;\n}\n\n/**\n * Verified access-manifest bundles a device durably holds that a writer\n * projection of `target` may cite, most useful first. This is never trust\n * input: the exact cited bytes only fill the response's omitted positions,\n * and the caller verifies the rebuilt projection exactly as a full one.\n */\nexport interface VerifiedManifestCitations {\n cite(\n target: WriterProjectionTarget,\n ): Promise<readonly AccessManifestBundleWireResponse[]>;\n}\n\n/**\n * The source's answer, or nothing once the deadline passes, the caller\n * aborts, or the source throws or rejects. A late answer is discarded: it can\n * never reach a request that was already sent.\n */\nfunction boundedCitation(\n source: VerifiedManifestCitations,\n target: WriterProjectionTarget,\n signal: AbortSignal | undefined,\n): Promise<readonly unknown[]> {\n return new Promise((resolve) => {\n let settled = false;\n const finish = (bundles: readonly unknown[]) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n signal?.removeEventListener(\"abort\", abandon);\n resolve(bundles);\n };\n const abandon = () => finish([]);\n const timer = setTimeout(abandon, MANIFEST_CITATION_DEADLINE_MS);\n if (signal?.aborted) return abandon();\n signal?.addEventListener(\"abort\", abandon, { once: true });\n try {\n source.cite(target).then(finish, abandon);\n } catch {\n abandon();\n }\n });\n}\n\n/**\n * The bytes one request cites, copied so a later eviction or mutation of the\n * source cannot change what fills its omissions. Citing only saves bytes, so\n * it never blocks or fails a read: a slow, failing, or abandoned source\n * yields no hints.\n */\nexport async function heldManifestCitations(\n source: VerifiedManifestCitations | null,\n target: WriterProjectionTarget,\n signal?: AbortSignal | undefined,\n): Promise<Map<string, AccessManifestBundleWireResponse>> {\n const held = new Map<string, AccessManifestBundleWireResponse>();\n if (!source) return held;\n for (const bundle of await boundedCitation(source, target, signal)) {\n if (held.size >= KNOWN_MANIFEST_HINT_LIMIT) break;\n if (\n !isAccessManifestBundleWireResponse(bundle) ||\n !isSha256HexString(bundle.manifestHash) ||\n held.has(bundle.manifestHash)\n )\n continue;\n try {\n held.set(bundle.manifestHash, structuredClone(bundle));\n } catch {\n // An uncloneable entry is skipped; its manifest simply travels.\n }\n }\n return held;\n}\n"]}
@@ -1,20 +1,81 @@
1
1
  import { getContainerWriterProjectionOperation, getDocumentWriterProjectionOperation, } from "../validators/operation/index.js";
2
+ import { decodeContainerWriterProjection, decodeDocumentWriterProjection, } from "../validators/response/index.js";
2
3
  import { principalHistoryRequest } from "./principalHistoryRequest.js";
3
- /** Preparation and body deadlines sit inside projection-history negotiation. */
4
- export function writerProjectionRequests(runtime) {
4
+ import { PrincipalHistoryRequestContext } from "./principalHistoryRequestContext.js";
5
+ import { heldManifestCitations, } from "./verifiedManifestCitations.js";
6
+ const PROJECTION_PATH = /^\/(?:containers|documents)\/([^/?#]+)\/writer-projection$/u;
7
+ function projectionId(path) {
8
+ const encoded = PROJECTION_PATH.exec(path)?.[1];
9
+ if (encoded === undefined)
10
+ return null;
11
+ try {
12
+ return decodeURIComponent(encoded);
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ }
18
+ function writerProjectionKind(operationId) {
19
+ if (operationId === "containers.writerProjection.get")
20
+ return "container";
21
+ if (operationId === "documents.writerProjection.get")
22
+ return "document";
23
+ return null;
24
+ }
25
+ function readProjection(runtime, input, held, context) {
26
+ const container = input.kind === "container";
27
+ return principalHistoryRequest(runtime, {
28
+ path: input.path,
29
+ validator: input.validator,
30
+ decode: (value) => container
31
+ ? decodeContainerWriterProjection(value, held)
32
+ : decodeDocumentWriterProjection(value, held),
33
+ method: "GET",
34
+ context,
35
+ operation: container
36
+ ? getContainerWriterProjectionOperation
37
+ : getDocumentWriterProjectionOperation,
38
+ });
39
+ }
40
+ /**
41
+ * Preparation and body deadlines sit inside the projection read. The wire
42
+ * cites each manifest bundle by hash; decoding resolves every citation, from
43
+ * the response or from the exact bytes this request declared held, before any
44
+ * validator, cache, or verifier sees the projection. A response this device
45
+ * cannot rebuild fails closed into one complete, hint-free refetch.
46
+ */
47
+ async function citedProjectionRead(runtime, citations, input, options) {
48
+ // Bind the identity before citations load: an account switch while they
49
+ // load, or before the refetch, must not carry one identity's hints or
50
+ // answer into another's session. Each request rechecks this context.
51
+ const context = new PrincipalHistoryRequestContext(runtime, "GET", input.path, options);
52
+ const id = projectionId(input.path);
53
+ // Caller-specific headers make a request its own; it cites nothing. The
54
+ // caller's abort also ends a citation wait.
55
+ const held = id === null || options.headers !== undefined
56
+ ? new Map()
57
+ : await heldManifestCitations(citations, { kind: input.kind, id }, options.signal);
58
+ if (held.size === 0)
59
+ return readProjection(runtime, input, held, context);
60
+ const hinted = await readProjection(runtime, input, held, context.derive({
61
+ ...options,
62
+ headers: { "x-known-manifests": [...held.keys()].join(",") },
63
+ reportErrors: false,
64
+ }));
65
+ if (hinted.ok)
66
+ return hinted;
67
+ if (hinted.kind !== "shape") {
68
+ if (options.reportErrors !== false)
69
+ hinted.report();
70
+ return hinted;
71
+ }
72
+ return readProjection(runtime, input, new Map(), context.derive(options));
73
+ }
74
+ export function writerProjectionRequests(runtime, citations) {
5
75
  const requestResult = (path, validator, method, body, options, operation) => {
6
- if (method === "GET" &&
7
- (operation.id === "containers.writerProjection.get" ||
8
- operation.id === "documents.writerProjection.get"))
9
- return principalHistoryRequest(runtime, {
10
- path,
11
- validator,
12
- method,
13
- options: options ?? {},
14
- operation: operation.id === "containers.writerProjection.get"
15
- ? getContainerWriterProjectionOperation
16
- : getDocumentWriterProjectionOperation,
17
- });
76
+ const kind = method === "GET" ? writerProjectionKind(operation.id) : null;
77
+ if (kind)
78
+ return citedProjectionRead(runtime, citations(), { kind, path, validator }, options ?? {});
18
79
  return runtime.requestResult(path, validator, method, body, options, operation);
19
80
  };
20
81
  const request = async (...args) => {
@@ -1 +1 @@
1
- {"version":3,"file":"writerProjectionRequests.js","sourceRoot":"","sources":["writerProjectionRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,oCAAoC,GACrC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,gFAAgF;AAChF,MAAM,UAAU,wBAAwB,CAAC,OAA0B;IAIjE,MAAM,aAAa,GAA6B,CAC9C,IAAI,EACJ,SAAS,EACT,MAAM,EACN,IAAI,EACJ,OAAO,EACP,SAAS,EACT,EAAE;QACF,IACE,MAAM,KAAK,KAAK;YAChB,CAAC,SAAS,CAAC,EAAE,KAAK,iCAAiC;gBACjD,SAAS,CAAC,EAAE,KAAK,gCAAgC,CAAC;YAEpD,OAAO,uBAAuB,CAAC,OAAO,EAAE;gBACtC,IAAI;gBACJ,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,SAAS,EACP,SAAS,CAAC,EAAE,KAAK,iCAAiC;oBAChD,CAAC,CAAC,qCAAqC;oBACvC,CAAC,CAAC,oCAAoC;aAC3C,CAAC,CAAC;QACL,OAAO,OAAO,CAAC,aAAa,CAC1B,IAAI,EACJ,SAAS,EACT,MAAM,EACN,IAAI,EACJ,OAAO,EACP,SAAS,CACV,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,OAAO,GAAuB,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE;QACpD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import {\n getContainerWriterProjectionOperation,\n getDocumentWriterProjectionOperation,\n} from \"@tearleads/validators/operation\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport type { OperationRequestFn, OperationRequestResultFn } from \"./types\";\n\n/** Preparation and body deadlines sit inside projection-history negotiation. */\nexport function writerProjectionRequests(runtime: ApiRequestRuntime): {\n request: OperationRequestFn;\n requestResult: OperationRequestResultFn;\n} {\n const requestResult: OperationRequestResultFn = (\n path,\n validator,\n method,\n body,\n options,\n operation,\n ) => {\n if (\n method === \"GET\" &&\n (operation.id === \"containers.writerProjection.get\" ||\n operation.id === \"documents.writerProjection.get\")\n )\n return principalHistoryRequest(runtime, {\n path,\n validator,\n method,\n options: options ?? {},\n operation:\n operation.id === \"containers.writerProjection.get\"\n ? getContainerWriterProjectionOperation\n : getDocumentWriterProjectionOperation,\n });\n return runtime.requestResult(\n path,\n validator,\n method,\n body,\n options,\n operation,\n );\n };\n const request: OperationRequestFn = async (...args) => {\n const result = await requestResult(...args);\n return result.ok ? result.data : null;\n };\n return { request, requestResult };\n}\n"]}
1
+ {"version":3,"file":"writerProjectionRequests.js","sourceRoot":"","sources":["writerProjectionRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,oCAAoC,GACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAOlF,OAAO,EACL,qBAAqB,GAGtB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,eAAe,GACnB,6DAA6D,CAAC;AAEhE,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,WAAmB;IAEnB,IAAI,WAAW,KAAK,iCAAiC;QAAE,OAAO,WAAW,CAAC;IAC1E,IAAI,WAAW,KAAK,gCAAgC;QAAE,OAAO,UAAU,CAAC;IACxE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CACrB,OAA0B,EAC1B,KAIC,EACD,IAAiB,EACjB,OAAuC;IAEvC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;IAC7C,OAAO,uBAAuB,CAAC,OAAO,EAAE;QACtC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,MAAM,EAAE,CAAC,KAAK,EAAE,E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AAE,CAAC;AACpC,CAAC","sourcesContent":["import {\n getContainerWriterProjectionOperation,\n getDocumentWriterProjectionOperation,\n} from \"@tearleads/validators/operation\";\nimport {\n type AccessManifestBundleWireResponse,\n decodeContainerWriterProjection,\n decodeDocumentWriterProjection,\n} from \"@tearleads/validators/response\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport { PrincipalHistoryRequestContext } from \"./principalHistoryRequestContext\";\nimport type {\n OperationRequestFn,\n OperationRequestResultFn,\n RequestResult,\n RequestResultOptions,\n} from \"./types\";\nimport {\n heldManifestCitations,\n type VerifiedManifestCitations,\n type WriterProjectionTarget,\n} from \"./verifiedManifestCitations\";\n\ntype HeldBundles = ReadonlyMap<string, AccessManifestBundleWireResponse>;\n\nconst PROJECTION_PATH =\n /^\\/(?:containers|documents)\\/([^/?#]+)\\/writer-projection$/u;\n\nfunction projectionId(path: string): string | null {\n const encoded = PROJECTION_PATH.exec(path)?.[1];\n if (encoded === undefined) return null;\n try {\n return decodeURIComponent(encoded);\n } catch {\n return null;\n }\n}\n\nfunction writerProjectionKind(\n operationId: string,\n): WriterProjectionTarget[\"kind\"] | null {\n if (operationId === \"containers.writerProjection.get\") return \"container\";\n if (operationId === \"documents.writerProjection.get\") return \"document\";\n return null;\n}\n\nfunction readProjection<T>(\n runtime: ApiRequestRuntime,\n input: {\n readonly kind: WriterProjectionTarget[\"kind\"];\n readonly path: string;\n readonly validator: (value: unknown) => value is T;\n },\n held: HeldBundles,\n context: PrincipalHistoryRequestContext,\n): Promise<RequestResult<T>> {\n const container = input.kind === \"container\";\n return principalHistoryRequest(runtime, {\n path: input.path,\n validator: input.validator,\n decode: (value) =>\n container\n ? decodeContainerWriterProjection(value, held)\n : decodeDocumentWriterProjection(value, held),\n method: \"GET\",\n context,\n operation: container\n ? getContainerWriterProjectionOperation\n : getDocumentWriterProjectionOperation,\n });\n}\n\n/**\n * Preparation and body deadlines sit inside the projection read. The wire\n * cites each manifest bundle by hash; decoding resolves every citation, from\n * the response or from the exact bytes this request declared held, before any\n * validator, cache, or verifier sees the projection. A response this device\n * cannot rebuild fails closed into one complete, hint-free refetch.\n */\nasync function citedProjectionRead<T>(\n runtime: ApiRequestRuntime,\n citations: VerifiedManifestCitations | null,\n input: {\n readonly kind: WriterProjectionTarget[\"kind\"];\n readonly path: string;\n readonly validator: (value: unknown) => value is T;\n },\n options: RequestResultOptions,\n): Promise<RequestResult<T>> {\n // Bind the identity before citations load: an account switch while they\n // load, or before the refetch, must not carry one identity's hints or\n // answer into another's session. Each request rechecks this context.\n const context = new PrincipalHistoryRequestContext(\n runtime,\n \"GET\",\n input.path,\n options,\n );\n const id = projectionId(input.path);\n // Caller-specific headers make a request its own; it cites nothing. The\n // caller's abort also ends a citation wait.\n const held =\n id === null || options.headers !== undefined\n ? new Map<string, AccessManifestBundleWireResponse>()\n : await heldManifestCitations(\n citations,\n { kind: input.kind, id },\n options.signal,\n );\n if (held.size === 0) return readProjection(runtime, input, held, context);\n const hinted = await readProjection(\n runtime,\n input,\n held,\n context.derive({\n ...options,\n headers: { \"x-known-manifests\": [...held.keys()].join(\",\") },\n reportErrors: false,\n }),\n );\n if (hinted.ok) return hinted;\n if (hinted.kind !== \"shape\") {\n if (options.reportErrors !== false) hinted.report();\n return hinted;\n }\n return readProjection(runtime, input, new Map(), context.derive(options));\n}\n\nexport function writerProjectionRequests(\n runtime: ApiRequestRuntime,\n citations: () => VerifiedManifestCitations | null,\n): {\n request: OperationRequestFn;\n requestResult: OperationRequestResultFn;\n} {\n const requestResult: OperationRequestResultFn = (\n path,\n validator,\n method,\n body,\n options,\n operation,\n ) => {\n const kind = method === \"GET\" ? writerProjectionKind(operation.id) : null;\n if (kind)\n return citedProjectionRead(\n runtime,\n citations(),\n { kind, path, validator },\n options ?? {},\n );\n return runtime.requestResult(\n path,\n validator,\n method,\n body,\n options,\n operation,\n );\n };\n const request: OperationRequestFn = async (...args) => {\n const result = await requestResult(...args);\n return result.ok ? result.data : null;\n };\n return { request, requestResult };\n}\n"]}
@@ -30,7 +30,6 @@ export { PrincipalPolicyValidationError, throwPrincipalPolicyValidationError, }
30
30
  export type { ManagedRecipientPrincipalType, PrincipalContainerGrant, PrincipalContainerGrantAccessLevel, PrincipalProjectionMember, PrincipalProjectionRole, PrincipalStateExternalAuthority, PrincipalStateHeaderInput, PrincipalStateMember, PrincipalStateMemberEnvelope, PrincipalStateMembershipMode, PrincipalStatePayloadCipherSuite, PrincipalStateSigningInput, SignedPrincipalState, UnsignedPrincipalState, } from "./principalState.js";
31
31
  export { buildPrincipalStateSigningInput, computePrincipalMembershipRoot, computePrincipalProjectionRoot, computePrincipalStateHash, computePrincipalStatePayloadCiphertextHash, derivePrincipalProjectionMembers, isManagedRecipientPrincipalType, isPrincipalProjectionRole, normalizePrincipalProjectionMembers, normalizePrincipalStateMembers, serializeUnsignedPrincipalState, signPrincipalState, } from "./principalState.js";
32
32
  export { verifySignedPrincipalState, verifySignedPrincipalStateResult, } from "./principalStateVerification.js";
33
- export { captureProjectionHistory, type HistoryProjection, omitProjectionHistory, type RetainedProjectionHistory, restoreProjectionHistory, } from "./projectionHistory.js";
34
33
  export type { SigningKeyPair } from "./signing/generateKeyPair.js";
35
34
  export { generateSigningKeyPair, generateSigningSeedAndKeyPair, ML_DSA87_PUBLIC_KEY_BYTES, ML_DSA87_SECRET_KEY_BYTES, ML_DSA87_SIGNATURE_BYTES, } from "./signing/generateKeyPair.js";
36
35
  export { sign } from "./signing/sign.js";
@@ -22,7 +22,6 @@ export { computePrincipalMemberEnvelopesRoot, normalizePrincipalStateMemberEnvel
22
22
  export { PrincipalPolicyValidationError, throwPrincipalPolicyValidationError, } from "./principalPolicyValidationError.js";
23
23
  export { buildPrincipalStateSigningInput, computePrincipalMembershipRoot, computePrincipalProjectionRoot, computePrincipalStateHash, computePrincipalStatePayloadCiphertextHash, derivePrincipalProjectionMembers, isManagedRecipientPrincipalType, isPrincipalProjectionRole, normalizePrincipalProjectionMembers, normalizePrincipalStateMembers, serializeUnsignedPrincipalState, signPrincipalState, } from "./principalState.js";
24
24
  export { verifySignedPrincipalState, verifySignedPrincipalStateResult, } from "./principalStateVerification.js";
25
- export { captureProjectionHistory, omitProjectionHistory, restoreProjectionHistory, } from "./projectionHistory.js";
26
25
  export { generateSigningKeyPair, generateSigningSeedAndKeyPair, ML_DSA87_PUBLIC_KEY_BYTES, ML_DSA87_SECRET_KEY_BYTES, ML_DSA87_SIGNATURE_BYTES, } from "./signing/generateKeyPair.js";
27
26
  export { sign } from "./signing/sign.js";
28
27
  export { verify } from "./signing/verify.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B,EAC9B,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAA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B,EAC7B,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,gCAAgC,EAChC,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,2CAA2C,EAC3C,mCAAmC,EACnC,wCAAwC,EAExC,0CAA0C,GAC3C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mCAAmC,EACnC,sCAAsC,EACtC,sCAAsC,GACvC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAiB1C,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAC9B,yBAAyB,EACzB,0CAA0C,EAC1C,gCAAgC,EAChC,+BAA+B,EAC/B,yBAAyB,EACzB,mCAAmC,EACnC,8BAA8B,EAC9B,+BAA+B,EAC/B,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EAExB,qBAAqB,EAErB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC","sourcesContent":["export { blobContentMetadataHash } from \"./blobContentMetadata\";\nexport { BlobEnvelopeError } from \"./blobEnvelopeError\";\nexport type {\n BlobEnvelopeHeaderRecord,\n BlobEnvelopeRecord,\n} from \"./blobEnvelopeReader\";\nexport {\n MAX_BLOB_ENVELOPE_HEADER_BYTES,\n parseBlobEnvelopeV2,\n parseBlobEnvelopeV2Header,\n readBlobEnvelopeHeaderByteLength,\n} from \"./blobEnvelopeReader\";\nexport type { BlobEnvelopeV2Header } from \"./blobEnvelopeV2\";\nexport {\n BLOB_CHUNK_SIZE_BYTES,\n BLOB_ENCRYPTED_BYTES_FORMAT,\n BLOB_ENCRYPTED_BYTES_VERSION,\n BLOB_ENVELOPE_MAGIC_BYTES,\n BLOB_ENVELOPE_PREFIX_BYTES,\n blobChunkPlaintextByteLength,\n computeBlobChunkCount,\n computeBlobEncryptedByteLength,\n deriveBlobChunkIv,\n encodeBlobEnvelopeV2Header,\n joinBlobPartBytes,\n MAX_BLOB_CHUNK_COUNT,\n normalizeBlobChunkSize,\n} from \"./blobEnvelopeV2\";\nexport { compareCanonicalStrings } from \"./canonicalOrdering\";\nexport {\n AUTH_CHALLENGE_BYTES,\n AUTH_CHALLENGE_HEX_LENGTH,\n authChallengeSigningBytes,\n CHALLENGE_TTL_SECONDS,\n canonicalAuthOrigin,\n generateChallenge,\n} from \"./challenge\";\nexport type {\n ContentKeyEnvelopeKind,\n ContentKeyWrapBinding,\n} from \"./contentKeyEnvelope\";\nexport {\n ContentKeyEnvelopeError,\n decodeContentKeyEnvelope,\n unwrapContentKey,\n wrapContentKey,\n} from \"./contentKeyEnvelope\";\nexport { decryptAsRecipient } from \"./encapsulation/decryptAsRecipient\";\nexport { encryptForRecipients } from \"./encapsulation/encryptForRecipients\";\nexport type { EncapsulationKeyPair } from \"./encapsulation/generateKeyPair\";\nexport {\n generateKemKeyPair,\n generateKemSeedAndKeyPair,\n ML_KEM1024_CIPHERTEXT_BYTES,\n ML_KEM1024_PUBLIC_KEY_BYTES,\n ML_KEM1024_SECRET_KEY_BYTES,\n ML_KEM1024_SEED_BYTES,\n} from \"./encapsulation/generateKeyPair\";\nexport type { EncryptedEnvelope, RecipientEntry } from \"./encapsulation/types\";\nexport { unwrapDek } from \"./encapsulation/unwrapDek\";\nexport { wrapDekForRecipients } from \"./encapsulation/wrapDek\";\nexport { toFingerprint } from \"./fingerprint\";\nexport {\n decryptGroupMetadata,\n encodeBuiltinGroupMetadata,\n encryptGroupMetadata,\n type GroupMetadata,\n type GroupMetadataKey,\n readGroupMetadata,\n} from \"./groupMetadata\";\nexport { bytesToHex, hexToBytes } from \"./hex\";\nexport {\n createIdentitySeedPhrase,\n createIdentitySeedPhraseFromEntropy,\n generateIdentityKeyPairsFromSeedPhrase,\n IDENTITY_SEED_PHRASE_DERIVATION_SUITE,\n IDENTITY_SEED_PHRASE_ENTROPY_BYTES,\n IDENTITY_SEED_PHRASE_STRENGTH_BITS,\n IDENTITY_SEED_PHRASE_WORDS,\n type IdentitySeedPhraseKeyPairs,\n normalizeIdentitySeedPhrase,\n validateIdentitySeedPhrase,\n} from \"./identitySeedPhrase\";\nexport {\n createIncrementalSha256,\n type IncrementalSha256,\n} from \"./incrementalSha256\";\nexport type {\n AccessEvent,\n AccessEventType,\n AccessManifest,\n AccessManifestCheckpoint,\n AccessManifestTransparencyLeaf,\n AccessObjectKind,\n AnyVerifiedAccessManifest,\n AnyVerifiedPrincipalPolicy,\n AttachmentAccessEventBody,\n AttachmentBindAccessEventBody,\n AttachmentDetachAccessEventBody,\n BlobAccessManifest,\n BlobContentKeyTarget,\n ContainerAccessEventBody,\n ContainerAccessKeyState,\n ContainerAccessLevel,\n ContainerAccessManifest,\n ContainerAccessManifestState,\n ContainerAccessStructural,\n ContainerCreateAccessEventBody,\n ContainerDirectGrant,\n ContainerGrantAccessEventBody,\n ContainerGrantPrincipalHead,\n ContainerGrantSubjectType,\n ContainerKekKeyring,\n ContainerKekKeyringEntry,\n ContainerKekPredecessorBridge,\n ContainerKekRecipientTarget,\n ContainerKekTarget,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerMoveAccessEventBody,\n ContainerReciteAccessEventBody,\n ContainerRekeyAccessEventBody,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n ContentObjectKind,\n ContentRecordEncryptionSuite,\n ContentRecordNonceDomain,\n DeriveBlobKekTargetsInput,\n DeriveContainerKekRecipientTargetsInput,\n DeriveDocumentKekTargetsInput,\n DocumentAccessEventBody,\n DocumentContentKeyTarget,\n DocumentContentRecordMetadataInput,\n DocumentLinkAccessEventBody,\n DocumentLinkSetManifestState,\n DocumentLinkSetStructural,\n DocumentPurgeAccessEventBody,\n DocumentUnlinkAccessEventBody,\n IdentityStateCheckpoint,\n IdentityStateHead,\n IdentityStateTransparencyLeaf,\n KekRecipientKind,\n KeyingCanonicalJson,\n KeyingHashDomain,\n KeyingLocalCheckpointStore,\n KeyingVerificationCode,\n KeyingVerificationResult,\n ManagedPrincipalKind,\n PrincipalHistoryIndexNode,\n PrincipalPolicyAuthorization,\n PrincipalPolicyBundle,\n PrincipalPolicyCheckpoint,\n PrincipalPolicyCurrent,\n PrincipalPolicyExternalAuthority,\n PrincipalPolicyExternalAuthorityState,\n PrincipalPolicyHistoryInput,\n PrincipalPolicyHistoryPage,\n PrincipalPolicyHistoryProgressOptions,\n PrincipalPolicyHistoryReferenceProof,\n PrincipalPolicyHistoryVerifier,\n PrincipalPolicyMemberEnvelopes,\n PrincipalPolicyPayload,\n PrincipalPolicySignedState,\n PrincipalPolicySignerPublicKey,\n PrincipalPolicySnapshot,\n PrincipalPolicyStateChainEntry,\n PrincipalPolicyTransitionMismatch,\n PrincipalPolicyTransitionMismatchCode,\n PrincipalPolicyTransparencyLeaf,\n ReferencedPrincipalHead,\n SignedTransparencyTreeHead,\n TransparencyConsistencyProof,\n TransparencyInclusionProof,\n TransparencyLeaf,\n TransparencyLeafKind,\n TransparencyTreeCheckpoint,\n UnsignedAccessEvent,\n UnsignedTransparencyTreeHead,\n UnsignedWriteHeader,\n VerifiedAccessEvent,\n VerifiedAccessManifest,\n VerifiedAccessManifestCheckpointEvidence,\n VerifiedAccessManifestSnapshot,\n VerifiedAttachmentBinding,\n VerifiedAttachmentDetach,\n VerifiedBlobKekTargets,\n VerifiedContainerAccessManifest,\n VerifiedContainerKekState,\n VerifiedContainerParentEdge,\n VerifiedDocumentKekTargets,\n VerifiedDocumentLinkSetManifest,\n VerifiedDocumentLinkSetSnapshot,\n VerifiedDocumentLinkSetStateEvidence,\n VerifiedIdentityState,\n VerifiedPrincipalPolicy,\n VerifiedPrincipalPolicyCurrent,\n VerifiedPrincipalPolicyHistory,\n VerifiedPrincipalPolicySelection,\n VerifiedPrincipalPolicySnapshot,\n VerifiedTransparencyProof,\n VerifiedTransparencyTreeHead,\n VerifiedWriteHeader,\n VerifyAccessEventInput,\n VerifyAccessManifestInput,\n VerifyAttachmentBindingEventInput,\n VerifyAttachmentDetachEventInput,\n VerifyContainerAccessManifestInput,\n VerifyContainerKekStateInput,\n VerifyContainerParentEdgeInput,\n VerifyDocumentLinkSetManifestInput,\n VerifyDocumentPurgeEventInput,\n VerifyIdentityStateCheckpointInput,\n VerifyPrincipalPolicyBundleInput,\n VerifyPrincipalPolicySnapshotInput,\n VerifySignedTransparencyTreeHeadInput,\n VerifyTransparencyConsistencyProofInput,\n VerifyTransparencyInclusionProofInput,\n VerifyTransparencyProofInput,\n VerifyWriteHeaderInput,\n WriteHeader,\n} from \"./keying\";\nexport {\n ACCESS_MANIFEST_VERIFICATION_REVISION,\n accessManifestCheckpointFromManifest,\n accessManifestTransparencyLeaf,\n assertSealedContainerKekKeyringLength,\n BLOB_CONTENT_KEY_WRAP_SUITE,\n CONTAINER_KEK_KEYRING_ENTRY_BYTES,\n CONTAINER_KEK_KEYRING_FORMAT_VERSION,\n CONTAINER_KEK_KEYRING_HEADER_BYTES,\n CONTAINER_KEK_KEYRING_SEAL_SUITE,\n CONTAINER_KEK_MATERIAL_ID_PREFIX,\n CONTAINER_KEK_PARENT_WRAP_SUITE,\n CONTAINER_KEK_PREDECESSOR_WRAP_SUITE,\n CONTAINER_KEK_USER_WRAP_SUITE,\n CONTENT_RECORD_ENCRYPTION_SUITE,\n computeAccessEventBodyHash,\n computeAccessEventHash,\n computeAccessManifestHash,\n computeBlobAccessManifestHash,\n computeBlobContentKeyTargetHash,\n computeContainerAccessKeyTargetHash,\n computeContainerAccessStructuralHash,\n computeContainerDirectGrantRoot,\n computeContainerKekKeyringHash,\n computeContainerKekMaterialId,\n computeContainerKekPredecessorBridgeHash,\n computeContainerKekRecipientTargetHash,\n computeContainerKeyEpochHash,\n computeContentRecordNonceDomainHash,\n computeDocumentContentKeyTargetHash,\n computeDocumentContentRecordCiphertextHash,\n computeDocumentContentRecordMetadataHash,\n computeDocumentContentRecordPlaintextHash,\n computeDocumentLinkSetGrantRoot,\n computeDocumentLinkSetKeyTargetHash,\n computeDocumentLinkSetStructuralHash,\n computeKeyingDomainHash,\n computeTransparencyLeafHash,\n computeTransparencyMerkleRoot,\n computeWriteHeaderHash,\n createContainerKekPredecessorBridge,\n createPrincipalHistoryIndexProof,\n createPrincipalPolicyHistoryVerifier,\n createTransparencyConsistencyProof,\n createTransparencyInclusionProof,\n DOCUMENT_CONTENT_KEY_WRAP_SUITE,\n deriveBlobKekTargets,\n deriveContainerAccessManifest,\n deriveContainerKekRecipientTargets,\n deriveContainerKekWrappingPublicKey,\n deriveDocumentKekTargets,\n deriveDocumentLinkSetManifest,\n derivePrincipalRecipientKeyEpochId,\n documentContentRecordMetadata,\n expectedSealedContainerKekKeyringBytes,\n getPrincipalPolicyTransitionMismatch,\n getPrincipalPolicyTransitionMismatchReason,\n identityStateTransparencyLeaf,\n isContainerKekMaterialId,\n isKeyingVerificationCode,\n KEYING_VERIFICATION_CODES,\n KeyingVerificationError,\n MAX_CONTAINER_KEY_EPOCH,\n MAX_CONTAINER_RECITATION_EPOCH,\n makeVerifiedAccessEvent,\n makeVerifiedBlobKekTargets,\n makeVerifiedContainerAccessManifest,\n makeVerifiedContainerKekState,\n makeVerifiedDocumentKekTargets,\n makeVerifiedDocumentLinkSetManifest,\n makeVerifiedDocumentLinkSetSnapshot,\n makeVerifiedPrincipalPolicy,\n normalizeAttachmentAccessEventBody,\n normalizeContainerAccessEventBody,\n normalizeContainerKekKeyring,\n normalizeContainerKekPredecessorBridge,\n normalizeDocumentAccessEventBody,\n normalizeDocumentPurgeAccessEventBody,\n openContainerKekKeyring,\n PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT,\n PRINCIPAL_HISTORY_VERIFICATION_REVISION,\n principalHistoryIndexLeaf,\n principalPolicyMatchesReference,\n principalPolicyTransparencyLeaf,\n resolveContainerPathUserAccessLevel,\n resolveContainerStatePathUserAccessLevel,\n resolveHistoricalContainerPathUserAccessLevel,\n resolvePrincipalHistoryIndexProof,\n restorePrincipalPolicyHistoryVerifier,\n sealContainerKekKeyring,\n selectPrincipalPolicyAuthorization,\n selectPrincipalPolicyCurrentPredecessorReferences,\n serializeKeyingCanonicalJson,\n signAccessEvent,\n signTransparencyTreeHead,\n signWriteHeader,\n unwrapContainerKekParentWrap,\n unwrapContainerKekPredecessorBridge,\n verifyAccessManifest,\n verifyAccessManifestLocalCheckpoint,\n verifyAccessManifestSnapshot,\n verifyAttachmentBindingEvent,\n verifyAttachmentDetachEvent,\n verifyContainerAccessManifest,\n verifyContainerKekKeyringEntry,\n verifyContainerKekState,\n verifyContainerParentEdge,\n verifyDocumentLinkSetManifest,\n verifyDocumentLinkSetSnapshot,\n verifyDocumentPurgeEvent,\n verifyIdentityStateCheckpoint,\n verifyPrincipalPolicyBundle,\n verifyPrincipalPolicyBundleAgainstHistory,\n verifyPrincipalPolicyCheckpoint,\n verifyPrincipalPolicyCurrent,\n verifyPrincipalPolicyCurrentMutation,\n verifyPrincipalPolicyCurrentSuccessor,\n verifyPrincipalPolicyHistoryReferences,\n verifyPrincipalPolicySnapshot,\n verifySignedAccessEvent,\n verifySignedTransparencyTreeHead,\n verifyTransparencyConsistencyProof,\n verifyTransparencyInclusionProof,\n verifyTransparencyProof,\n verifyWriteHeader,\n} from \"./keying\";\nexport {\n organizationReplacementAuthorizationPayload,\n organizationReplacementSigningBytes,\n signOrganizationReplacementAuthorization,\n type VerifiedOrganizationReplacementAuthorization,\n verifyOrganizationReplacementAuthorization,\n} from \"./organizationReplacement\";\nexport {\n computePrincipalContainerGrantRoot,\n normalizePrincipalContainerGrants,\n} from \"./principalContainerGrants\";\nexport {\n computePrincipalMemberEnvelopesRoot,\n normalizePrincipalStateMemberEnvelopes,\n PrincipalMemberEnvelopeValidationError,\n} from \"./principalMemberEnvelopes\";\nexport type { PrincipalPolicyValidationErrorCode } from \"./principalPolicyValidationError\";\nexport {\n PrincipalPolicyValidationError,\n throwPrincipalPolicyValidationError,\n} from \"./principalPolicyValidationError\";\nexport type {\n ManagedRecipientPrincipalType,\n PrincipalContainerGrant,\n PrincipalContainerGrantAccessLevel,\n PrincipalProjectionMember,\n PrincipalProjectionRole,\n PrincipalStateExternalAuthority,\n PrincipalStateHeaderInput,\n PrincipalStateMember,\n PrincipalStateMemberEnvelope,\n PrincipalStateMembershipMode,\n PrincipalStatePayloadCipherSuite,\n PrincipalStateSigningInput,\n SignedPrincipalState,\n UnsignedPrincipalState,\n} from \"./principalState\";\nexport {\n buildPrincipalStateSigningInput,\n computePrincipalMembershipRoot,\n computePrincipalProjectionRoot,\n computePrincipalStateHash,\n computePrincipalStatePayloadCiphertextHash,\n derivePrincipalProjectionMembers,\n isManagedRecipientPrincipalType,\n isPrincipalProjectionRole,\n normalizePrincipalProjectionMembers,\n normalizePrincipalStateMembers,\n serializeUnsignedPrincipalState,\n signPrincipalState,\n} from \"./principalState\";\nexport {\n verifySignedPrincipalState,\n verifySignedPrincipalStateResult,\n} from \"./principalStateVerification\";\nexport {\n captureProjectionHistory,\n type HistoryProjection,\n omitProjectionHistory,\n type RetainedProjectionHistory,\n restoreProjectionHistory,\n} from \"./projectionHistory\";\nexport type { SigningKeyPair } from \"./signing/generateKeyPair\";\nexport {\n generateSigningKeyPair,\n generateSigningSeedAndKeyPair,\n ML_DSA87_PUBLIC_KEY_BYTES,\n ML_DSA87_SECRET_KEY_BYTES,\n ML_DSA87_SIGNATURE_BYTES,\n} from \"./signing/generateKeyPair\";\nexport { sign } from \"./signing/sign\";\nexport { verify } from \"./signing/verify\";\nexport type { SymmetricCiphertext } from \"./symmetric\";\nexport {\n AES_256_KEY_BYTES,\n AES_GCM_IV_BYTES,\n AES_GCM_TAG_BYTES,\n assertAesGcmIv,\n createAesGcmIv,\n decryptWithDek,\n encryptWithDek,\n} from \"./symmetric\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B,EAC9B,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC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MAAM,UAAU,CAAC;AAClB,OAAO,EACL,2CAA2C,EAC3C,mCAAmC,EACnC,wCAAwC,EAExC,0CAA0C,GAC3C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mCAAmC,EACnC,sCAAsC,EACtC,sCAAsC,GACvC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAiB1C,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAC9B,yBAAyB,EACzB,0CAA0C,EAC1C,gCAAgC,EAChC,+BAA+B,EAC/B,yBAAyB,EACzB,mCAAmC,EACnC,8BAA8B,EAC9B,+BAA+B,EAC/B,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC","sourcesContent":["export { blobContentMetadataHash } from \"./blobContentMetadata\";\nexport { BlobEnvelopeError } from \"./blobEnvelopeError\";\nexport type {\n BlobEnvelopeHeaderRecord,\n BlobEnvelopeRecord,\n} from \"./blobEnvelopeReader\";\nexport {\n MAX_BLOB_ENVELOPE_HEADER_BYTES,\n parseBlobEnvelopeV2,\n parseBlobEnvelopeV2Header,\n readBlobEnvelopeHeaderByteLength,\n} from \"./blobEnvelopeReader\";\nexport type { BlobEnvelopeV2Header } from \"./blobEnvelopeV2\";\nexport {\n BLOB_CHUNK_SIZE_BYTES,\n BLOB_ENCRYPTED_BYTES_FORMAT,\n BLOB_ENCRYPTED_BYTES_VERSION,\n BLOB_ENVELOPE_MAGIC_BYTES,\n BLOB_ENVELOPE_PREFIX_BYTES,\n blobChunkPlaintextByteLength,\n computeBlobChunkCount,\n computeBlobEncryptedByteLength,\n deriveBlobChunkIv,\n encodeBlobEnvelopeV2Header,\n joinBlobPartBytes,\n MAX_BLOB_CHUNK_COUNT,\n normalizeBlobChunkSize,\n} from \"./blobEnvelopeV2\";\nexport { compareCanonicalStrings } from \"./canonicalOrdering\";\nexport {\n AUTH_CHALLENGE_BYTES,\n AUTH_CHALLENGE_HEX_LENGTH,\n authChallengeSigningBytes,\n CHALLENGE_TTL_SECONDS,\n canonicalAuthOrigin,\n generateChallenge,\n} from \"./challenge\";\nexport type {\n ContentKeyEnvelopeKind,\n ContentKeyWrapBinding,\n} from \"./contentKeyEnvelope\";\nexport {\n ContentKeyEnvelopeError,\n decodeContentKeyEnvelope,\n unwrapContentKey,\n wrapContentKey,\n} from \"./contentKeyEnvelope\";\nexport { decryptAsRecipient } from \"./encapsulation/decryptAsRecipient\";\nexport { encryptForRecipients } from \"./encapsulation/encryptForRecipients\";\nexport type { EncapsulationKeyPair } from \"./encapsulation/generateKeyPair\";\nexport {\n generateKemKeyPair,\n generateKemSeedAndKeyPair,\n ML_KEM1024_CIPHERTEXT_BYTES,\n ML_KEM1024_PUBLIC_KEY_BYTES,\n ML_KEM1024_SECRET_KEY_BYTES,\n ML_KEM1024_SEED_BYTES,\n} from \"./encapsulation/generateKeyPair\";\nexport type { EncryptedEnvelope, RecipientEntry } from \"./encapsulation/types\";\nexport { unwrapDek } from \"./encapsulation/unwrapDek\";\nexport { wrapDekForRecipients } from \"./encapsulation/wrapDek\";\nexport { toFingerprint } from \"./fingerprint\";\nexport {\n decryptGroupMetadata,\n encodeBuiltinGroupMetadata,\n encryptGroupMetadata,\n type GroupMetadata,\n type GroupMetadataKey,\n readGroupMetadata,\n} from \"./groupMetadata\";\nexport { bytesToHex, hexToBytes } from \"./hex\";\nexport {\n createIdentitySeedPhrase,\n createIdentitySeedPhraseFromEntropy,\n generateIdentityKeyPairsFromSeedPhrase,\n IDENTITY_SEED_PHRASE_DERIVATION_SUITE,\n IDENTITY_SEED_PHRASE_ENTROPY_BYTES,\n IDENTITY_SEED_PHRASE_STRENGTH_BITS,\n IDENTITY_SEED_PHRASE_WORDS,\n type IdentitySeedPhraseKeyPairs,\n normalizeIdentitySeedPhrase,\n validateIdentitySeedPhrase,\n} from \"./identitySeedPhrase\";\nexport {\n createIncrementalSha256,\n type IncrementalSha256,\n} from \"./incrementalSha256\";\nexport type {\n AccessEvent,\n AccessEventType,\n AccessManifest,\n AccessManifestCheckpoint,\n AccessManifestTransparencyLeaf,\n AccessObjectKind,\n AnyVerifiedAccessManifest,\n AnyVerifiedPrincipalPolicy,\n AttachmentAccessEventBody,\n AttachmentBindAccessEventBody,\n AttachmentDetachAccessEventBody,\n BlobAccessManifest,\n BlobContentKeyTarget,\n ContainerAccessEventBody,\n ContainerAccessKeyState,\n ContainerAccessLevel,\n ContainerAccessManifest,\n ContainerAccessManifestState,\n ContainerAccessStructural,\n ContainerCreateAccessEventBody,\n ContainerDirectGrant,\n ContainerGrantAccessEventBody,\n ContainerGrantPrincipalHead,\n ContainerGrantSubjectType,\n ContainerKekKeyring,\n ContainerKekKeyringEntry,\n ContainerKekPredecessorBridge,\n ContainerKekRecipientTarget,\n ContainerKekTarget,\n ContainerKeyEpoch,\n ContainerKeyWrap,\n ContainerMoveAccessEventBody,\n ContainerReciteAccessEventBody,\n ContainerRekeyAccessEventBody,\n ContainerRevokeAccessEventBody,\n ContainerUserRecipientKey,\n ContentObjectKind,\n ContentRecordEncryptionSuite,\n ContentRecordNonceDomain,\n DeriveBlobKekTargetsInput,\n DeriveContainerKekRecipientTargetsInput,\n DeriveDocumentKekTargetsInput,\n DocumentAccessEventBody,\n DocumentContentKeyTarget,\n DocumentContentRecordMetadataInput,\n DocumentLinkAccessEventBody,\n DocumentLinkSetManifestState,\n DocumentLinkSetStructural,\n DocumentPurgeAccessEventBody,\n DocumentUnlinkAccessEventBody,\n IdentityStateCheckpoint,\n IdentityStateHead,\n IdentityStateTransparencyLeaf,\n KekRecipientKind,\n KeyingCanonicalJson,\n KeyingHashDomain,\n KeyingLocalCheckpointStore,\n KeyingVerificationCode,\n KeyingVerificationResult,\n ManagedPrincipalKind,\n PrincipalHistoryIndexNode,\n PrincipalPolicyAuthorization,\n PrincipalPolicyBundle,\n PrincipalPolicyCheckpoint,\n PrincipalPolicyCurrent,\n PrincipalPolicyExternalAuthority,\n PrincipalPolicyExternalAuthorityState,\n PrincipalPolicyHistoryInput,\n PrincipalPolicyHistoryPage,\n PrincipalPolicyHistoryProgressOptions,\n PrincipalPolicyHistoryReferenceProof,\n PrincipalPolicyHistoryVerifier,\n PrincipalPolicyMemberEnvelopes,\n PrincipalPolicyPayload,\n PrincipalPolicySignedState,\n PrincipalPolicySignerPublicKey,\n PrincipalPolicySnapshot,\n PrincipalPolicyStateChainEntry,\n PrincipalPolicyTransitionMismatch,\n PrincipalPolicyTransitionMismatchCode,\n PrincipalPolicyTransparencyLeaf,\n ReferencedPrincipalHead,\n SignedTransparencyTreeHead,\n TransparencyConsistencyProof,\n TransparencyInclusionProof,\n TransparencyLeaf,\n TransparencyLeafKind,\n TransparencyTreeCheckpoint,\n UnsignedAccessEvent,\n UnsignedTransparencyTreeHead,\n UnsignedWriteHeader,\n VerifiedAccessEvent,\n VerifiedAccessManifest,\n VerifiedAccessManifestCheckpointEvidence,\n VerifiedAccessManifestSnapshot,\n VerifiedAttachmentBinding,\n VerifiedAttachmentDetach,\n VerifiedBlobKekTargets,\n VerifiedContainerAccessManifest,\n VerifiedContainerKekState,\n VerifiedContainerParentEdge,\n VerifiedDocumentKekTargets,\n VerifiedDocumentLinkSetManifest,\n VerifiedDocumentLinkSetSnapshot,\n VerifiedDocumentLinkSetStateEvidence,\n VerifiedIdentityState,\n VerifiedPrincipalPolicy,\n VerifiedPrincipalPolicyCurrent,\n VerifiedPrincipalPolicyHistory,\n VerifiedPrincipalPolicySelection,\n VerifiedPrincipalPolicySnapshot,\n VerifiedTransparencyProof,\n VerifiedTransparencyTreeHead,\n VerifiedWriteHeader,\n VerifyAccessEventInput,\n VerifyAccessManifestInput,\n VerifyAttachmentBindingEventInput,\n VerifyAttachmentDetachEventInput,\n VerifyContainerAccessManifestInput,\n VerifyContainerKekStateInput,\n VerifyContainerParentEdgeInput,\n VerifyDocumentLinkSetManifestInput,\n VerifyDocumentPurgeEventInput,\n VerifyIdentityStateCheckpointInput,\n VerifyPrincipalPolicyBundleInput,\n VerifyPrincipalPolicySnapshotInput,\n VerifySignedTransparencyTreeHeadInput,\n VerifyTransparencyConsistencyProofInput,\n VerifyTransparencyInclusionProofInput,\n VerifyTransparencyProofInput,\n VerifyWriteHeaderInput,\n WriteHeader,\n} from \"./keying\";\nexport {\n ACCESS_MANIFEST_VERIFICATION_REVISION,\n accessManifestCheckpointFromManifest,\n accessManifestTransparencyLeaf,\n assertSealedContainerKekKeyringLength,\n BLOB_CONTENT_KEY_WRAP_SUITE,\n CONTAINER_KEK_KEYRING_ENTRY_BYTES,\n CONTAINER_KEK_KEYRING_FORMAT_VERSION,\n CONTAINER_KEK_KEYRING_HEADER_BYTES,\n CONTAINER_KEK_KEYRING_SEAL_SUITE,\n CONTAINER_KEK_MATERIAL_ID_PREFIX,\n CONTAINER_KEK_PARENT_WRAP_SUITE,\n CONTAINER_KEK_PREDECESSOR_WRAP_SUITE,\n CONTAINER_KEK_USER_WRAP_SUITE,\n CONTENT_RECORD_ENCRYPTION_SUITE,\n computeAccessEventBodyHash,\n computeAccessEventHash,\n computeAccessManifestHash,\n computeBlobAccessManifestHash,\n computeBlobContentKeyTargetHash,\n computeContainerAccessKeyTargetHash,\n computeContainerAccessStructuralHash,\n computeContainerDirectGrantRoot,\n computeContainerKekKeyringHash,\n computeContainerKekMaterialId,\n computeContainerKekPredecessorBridgeHash,\n computeContainerKekRecipientTargetHash,\n computeContainerKeyEpochHash,\n computeContentRecordNonceDomainHash,\n computeDocumentContentKeyTargetHash,\n computeDocumentContentRecordCiphertextHash,\n computeDocumentContentRecordMetadataHash,\n computeDocumentContentRecordPlaintextHash,\n computeDocumentLinkSetGrantRoot,\n computeDocumentLinkSetKeyTargetHash,\n computeDocumentLinkSetStructuralHash,\n computeKeyingDomainHash,\n computeTransparencyLeafHash,\n computeTransparencyMerkleRoot,\n computeWriteHeaderHash,\n createContainerKekPredecessorBridge,\n createPrincipalHistoryIndexProof,\n createPrincipalPolicyHistoryVerifier,\n createTransparencyConsistencyProof,\n createTransparencyInclusionProof,\n DOCUMENT_CONTENT_KEY_WRAP_SUITE,\n deriveBlobKekTargets,\n deriveContainerAccessManifest,\n deriveContainerKekRecipientTargets,\n deriveContainerKekWrappingPublicKey,\n deriveDocumentKekTargets,\n deriveDocumentLinkSetManifest,\n derivePrincipalRecipientKeyEpochId,\n documentContentRecordMetadata,\n expectedSealedContainerKekKeyringBytes,\n getPrincipalPolicyTransitionMismatch,\n getPrincipalPolicyTransitionMismatchReason,\n identityStateTransparencyLeaf,\n isContainerKekMaterialId,\n isKeyingVerificationCode,\n KEYING_VERIFICATION_CODES,\n KeyingVerificationError,\n MAX_CONTAINER_KEY_EPOCH,\n MAX_CONTAINER_RECITATION_EPOCH,\n makeVerifiedAccessEvent,\n makeVerifiedBlobKekTargets,\n makeVerifiedContainerAccessManifest,\n makeVerifiedContainerKekState,\n makeVerifiedDocumentKekTargets,\n makeVerifiedDocumentLinkSetManifest,\n makeVerifiedDocumentLinkSetSnapshot,\n makeVerifiedPrincipalPolicy,\n normalizeAttachmentAccessEventBody,\n normalizeContainerAccessEventBody,\n normalizeContainerKekKeyring,\n normalizeContainerKekPredecessorBridge,\n normalizeDocumentAccessEventBody,\n normalizeDocumentPurgeAccessEventBody,\n openContainerKekKeyring,\n PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT,\n PRINCIPAL_HISTORY_VERIFICATION_REVISION,\n principalHistoryIndexLeaf,\n principalPolicyMatchesReference,\n principalPolicyTransparencyLeaf,\n resolveContainerPathUserAccessLevel,\n resolveContainerStatePathUserAccessLevel,\n resolveHistoricalContainerPathUserAccessLevel,\n resolvePrincipalHistoryIndexProof,\n restorePrincipalPolicyHistoryVerifier,\n sealContainerKekKeyring,\n selectPrincipalPolicyAuthorization,\n selectPrincipalPolicyCurrentPredecessorReferences,\n serializeKeyingCanonicalJson,\n signAccessEvent,\n signTransparencyTreeHead,\n signWriteHeader,\n unwrapContainerKekParentWrap,\n unwrapContainerKekPredecessorBridge,\n verifyAccessManifest,\n verifyAccessManifestLocalCheckpoint,\n verifyAccessManifestSnapshot,\n verifyAttachmentBindingEvent,\n verifyAttachmentDetachEvent,\n verifyContainerAccessManifest,\n verifyContainerKekKeyringEntry,\n verifyContainerKekState,\n verifyContainerParentEdge,\n verifyDocumentLinkSetManifest,\n verifyDocumentLinkSetSnapshot,\n verifyDocumentPurgeEvent,\n verifyIdentityStateCheckpoint,\n verifyPrincipalPolicyBundle,\n verifyPrincipalPolicyBundleAgainstHistory,\n verifyPrincipalPolicyCheckpoint,\n verifyPrincipalPolicyCurrent,\n verifyPrincipalPolicyCurrentMutation,\n verifyPrincipalPolicyCurrentSuccessor,\n verifyPrincipalPolicyHistoryReferences,\n verifyPrincipalPolicySnapshot,\n verifySignedAccessEvent,\n verifySignedTransparencyTreeHead,\n verifyTransparencyConsistencyProof,\n verifyTransparencyInclusionProof,\n verifyTransparencyProof,\n verifyWriteHeader,\n} from \"./keying\";\nexport {\n organizationReplacementAuthorizationPayload,\n organizationReplacementSigningBytes,\n signOrganizationReplacementAuthorization,\n type VerifiedOrganizationReplacementAuthorization,\n verifyOrganizationReplacementAuthorization,\n} from \"./organizationReplacement\";\nexport {\n computePrincipalContainerGrantRoot,\n normalizePrincipalContainerGrants,\n} from \"./principalContainerGrants\";\nexport {\n computePrincipalMemberEnvelopesRoot,\n normalizePrincipalStateMemberEnvelopes,\n PrincipalMemberEnvelopeValidationError,\n} from \"./principalMemberEnvelopes\";\nexport type { PrincipalPolicyValidationErrorCode } from \"./principalPolicyValidationError\";\nexport {\n PrincipalPolicyValidationError,\n throwPrincipalPolicyValidationError,\n} from \"./principalPolicyValidationError\";\nexport type {\n ManagedRecipientPrincipalType,\n PrincipalContainerGrant,\n PrincipalContainerGrantAccessLevel,\n PrincipalProjectionMember,\n PrincipalProjectionRole,\n PrincipalStateExternalAuthority,\n PrincipalStateHeaderInput,\n PrincipalStateMember,\n PrincipalStateMemberEnvelope,\n PrincipalStateMembershipMode,\n PrincipalStatePayloadCipherSuite,\n PrincipalStateSigningInput,\n SignedPrincipalState,\n UnsignedPrincipalState,\n} from \"./principalState\";\nexport {\n buildPrincipalStateSigningInput,\n computePrincipalMembershipRoot,\n computePrincipalProjectionRoot,\n computePrincipalStateHash,\n computePrincipalStatePayloadCiphertextHash,\n derivePrincipalProjectionMembers,\n isManagedRecipientPrincipalType,\n isPrincipalProjectionRole,\n normalizePrincipalProjectionMembers,\n normalizePrincipalStateMembers,\n serializeUnsignedPrincipalState,\n signPrincipalState,\n} from \"./principalState\";\nexport {\n verifySignedPrincipalState,\n verifySignedPrincipalStateResult,\n} from \"./principalStateVerification\";\nexport type { SigningKeyPair } from \"./signing/generateKeyPair\";\nexport {\n generateSigningKeyPair,\n generateSigningSeedAndKeyPair,\n ML_DSA87_PUBLIC_KEY_BYTES,\n ML_DSA87_SECRET_KEY_BYTES,\n ML_DSA87_SIGNATURE_BYTES,\n} from \"./signing/generateKeyPair\";\nexport { sign } from \"./signing/sign\";\nexport { verify } from \"./signing/verify\";\nexport type { SymmetricCiphertext } from \"./symmetric\";\nexport {\n AES_256_KEY_BYTES,\n AES_GCM_IV_BYTES,\n AES_GCM_TAG_BYTES,\n assertAesGcmIv,\n createAesGcmIv,\n decryptWithDek,\n encryptWithDek,\n} from \"./symmetric\";\n"]}
@@ -60,10 +60,15 @@ export const documentSyncResponsePullPageRefinement = {
60
60
  description: "pullPage.hasMore is true exactly when pullPage.nextCursor is non-null",
61
61
  id: "response.pull-page-continuation",
62
62
  };
63
+ export const documentSyncResponseHistoricalBundlesRefinement = {
64
+ description: "contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch",
65
+ id: "response.historical-content-key-bundles",
66
+ };
63
67
  export const documentSyncResponseRuntimeRefinements = [
64
68
  documentSyncResponseRotationRefinement,
65
69
  documentSyncResponseCommitLsnModeRefinement,
66
70
  documentSyncResponseCommitLsnSentinelRefinement,
67
71
  documentSyncResponsePullPageRefinement,
72
+ documentSyncResponseHistoricalBundlesRefinement,
68
73
  ];
69
74
  //# sourceMappingURL=documentSyncRefinements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"documentSyncRefinements.js","sourceRoot":"","sources":["documentSyncRefinements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD;QACE,WAAW,EACT,+EAA+E;QACjF,EAAE,EAAE,oCAAoC;KACzC;IACD;QACE,WAAW,EACT,4EAA4E;QAC9E,EAAE,EAAE,sCAAsC;KAC3C;IACD;QACE,WAAW,EACT,yEAAyE;QAC3E,EAAE,EAAE,wCAAwC;KAC7C;IACD;QACE,WAAW,EAAE,uDAAuD;QACpE,EAAE,EAAE,oCAAoC;KACzC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD;QACE,WAAW,EACT,+HAA+H;QACjI,EAAE,EAAE,qCAAqC;KAC1C;IACD;QACE,WAAW,EACT,4HAA4H;QAC9H,EAAE,EAAE,+BAA+B;KACpC;IACD;QACE,WAAW,EACT,wGAAwG;QAC1G,EAAE,EAAE,mCAAmC;KACxC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,sCAAsC;IACzC,GAAG,kCAAkC;IACrC,qCAAqC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW,EAAE,gFAAgF,yCAAyC,sBAAsB;IAC5J,EAAE,EAAE,uDAAuD;CACnD,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,qCAAqC;CACjC,CAAC;AAEX,MAAM,CAAC,MAAM,2CAA2C,GAAG;IACzD,WAAW,EACT,iEAAiE;IACnE,EAAE,EAAE,wCAAwC;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,WAAW,EACT,yEAAyE;IAC3E,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,uEAAuE;IACzE,EAAE,EAAE,iCAAiC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,sCAAsC;IACtC,2CAA2C;IAC3C,+CAA+C;IAC/C,sCAAsC;CAC9B,CAAC","sourcesContent":["import { MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS } from \"./util/documentSyncLimits\";\n\nexport const documentSyncRequestRotationRefinement = {\n description:\n \"checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline\",\n id: \"request.rotation-checkpoint-fields\",\n} as const;\n\nexport const documentSyncRequestEnvelopeRefinements = [\n {\n description:\n \"inlineRekeyCommitId must be present exactly when containerRekeys is non-empty\",\n id: \"request.inline-rekey-commit-marker\",\n },\n {\n description:\n \"authorizingContainerPathRefs is required when outgoingUpdates is non-empty\",\n id: \"request.authorizing-paths-for-writes\",\n },\n {\n description:\n \"containerRekeys may be non-empty only when outgoingUpdates is non-empty\",\n id: \"request.container-rekeys-require-write\",\n },\n {\n description: \"outgoing update ids must be unique within the request\",\n id: \"request.unique-outgoing-update-ids\",\n },\n] as const;\n\nexport const documentSyncRequestPullRefinements = [\n {\n description:\n \"a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths\",\n id: \"request.pull-continuation-read-only\",\n },\n {\n description:\n 'historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths',\n id: \"request.raw-history-read-only\",\n },\n {\n description:\n 'historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested',\n id: \"request.raw-history-null-frontier\",\n },\n] as const;\n\nexport const documentSyncRequestRuntimeRefinements = [\n ...documentSyncRequestEnvelopeRefinements,\n ...documentSyncRequestPullRefinements,\n documentSyncRequestRotationRefinement,\n] as const;\n\nexport const documentLinkSetPathRefinement = {\n description: `authorizingContainerPathRefs and targetContainerPathRefs may contain at most ${MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS} references in total`,\n id: \"request.post-link-authorization-path-total-references\",\n} as const;\n\nexport const documentSyncResponseRotationRefinement = {\n description:\n \"checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline\",\n id: \"response.rotation-checkpoint-fields\",\n} as const;\n\nexport const documentSyncResponseCommitLsnModeRefinement = {\n description:\n 'commitLsnMode \"untracked\" requires the commitLsn \"0/0\" sentinel',\n id: \"response.untracked-commit-lsn-sentinel\",\n} as const;\n\nexport const documentSyncResponseCommitLsnSentinelRefinement = {\n description:\n 'commitLsn \"0/0\" requires commitLsnMode \"untracked\" in the same response',\n id: \"response.untracked-commit-lsn-mode\",\n} as const;\n\nexport const documentSyncResponsePullPageRefinement = {\n description:\n \"pullPage.hasMore is true exactly when pullPage.nextCursor is non-null\",\n id: \"response.pull-page-continuation\",\n} as const;\n\nexport const documentSyncResponseRuntimeRefinements = [\n documentSyncResponseRotationRefinement,\n documentSyncResponseCommitLsnModeRefinement,\n documentSyncResponseCommitLsnSentinelRefinement,\n documentSyncResponsePullPageRefinement,\n] as const;\n"]}
1
+ {"version":3,"file":"documentSyncRefinements.js","sourceRoot":"","sources":["documentSyncRefinements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD;QACE,WAAW,EACT,+EAA+E;QACjF,EAAE,EAAE,oCAAoC;KACzC;IACD;QACE,WAAW,EACT,4EAA4E;QAC9E,EAAE,EAAE,sCAAsC;KAC3C;IACD;QACE,WAAW,EACT,yEAAyE;QAC3E,EAAE,EAAE,wCAAwC;KAC7C;IACD;QACE,WAAW,EAAE,uDAAuD;QACpE,EAAE,EAAE,oCAAoC;KACzC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD;QACE,WAAW,EACT,+HAA+H;QACjI,EAAE,EAAE,qCAAqC;KAC1C;IACD;QACE,WAAW,EACT,4HAA4H;QAC9H,EAAE,EAAE,+BAA+B;KACpC;IACD;QACE,WAAW,EACT,wGAAwG;QAC1G,EAAE,EAAE,mCAAmC;KACxC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,GAAG,sCAAsC;IACzC,GAAG,kCAAkC;IACrC,qCAAqC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW,EAAE,gFAAgF,yCAAyC,sBAAsB;IAC5J,EAAE,EAAE,uDAAuD;CACnD,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,oHAAoH;IACtH,EAAE,EAAE,qCAAqC;CACjC,CAAC;AAEX,MAAM,CAAC,MAAM,2CAA2C,GAAG;IACzD,WAAW,EACT,iEAAiE;IACnE,EAAE,EAAE,wCAAwC;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,WAAW,EACT,yEAAyE;IAC3E,EAAE,EAAE,oCAAoC;CAChC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,WAAW,EACT,uEAAuE;IACzE,EAAE,EAAE,iCAAiC;CAC7B,CAAC;AAEX,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,WAAW,EACT,4HAA4H;IAC9H,EAAE,EAAE,yCAAyC;CACrC,CAAC;AAEX,MAAM,CAAC,MAAM,sCAAsC,GAAG;IACpD,sCAAsC;IACtC,2CAA2C;IAC3C,+CAA+C;IAC/C,sCAAsC;IACtC,+CAA+C;CACvC,CAAC","sourcesContent":["import { MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS } from \"./util/documentSyncLimits\";\n\nexport const documentSyncRequestRotationRefinement = {\n description:\n \"checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline\",\n id: \"request.rotation-checkpoint-fields\",\n} as const;\n\nexport const documentSyncRequestEnvelopeRefinements = [\n {\n description:\n \"inlineRekeyCommitId must be present exactly when containerRekeys is non-empty\",\n id: \"request.inline-rekey-commit-marker\",\n },\n {\n description:\n \"authorizingContainerPathRefs is required when outgoingUpdates is non-empty\",\n id: \"request.authorizing-paths-for-writes\",\n },\n {\n description:\n \"containerRekeys may be non-empty only when outgoingUpdates is non-empty\",\n id: \"request.container-rekeys-require-write\",\n },\n {\n description: \"outgoing update ids must be unique within the request\",\n id: \"request.unique-outgoing-update-ids\",\n },\n] as const;\n\nexport const documentSyncRequestPullRefinements = [\n {\n description:\n \"a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths\",\n id: \"request.pull-continuation-read-only\",\n },\n {\n description:\n 'historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths',\n id: \"request.raw-history-read-only\",\n },\n {\n description:\n 'historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested',\n id: \"request.raw-history-null-frontier\",\n },\n] as const;\n\nexport const documentSyncRequestRuntimeRefinements = [\n ...documentSyncRequestEnvelopeRefinements,\n ...documentSyncRequestPullRefinements,\n documentSyncRequestRotationRefinement,\n] as const;\n\nexport const documentLinkSetPathRefinement = {\n description: `authorizingContainerPathRefs and targetContainerPathRefs may contain at most ${MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS} references in total`,\n id: \"request.post-link-authorization-path-total-references\",\n} as const;\n\nexport const documentSyncResponseRotationRefinement = {\n description:\n \"checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline\",\n id: \"response.rotation-checkpoint-fields\",\n} as const;\n\nexport const documentSyncResponseCommitLsnModeRefinement = {\n description:\n 'commitLsnMode \"untracked\" requires the commitLsn \"0/0\" sentinel',\n id: \"response.untracked-commit-lsn-sentinel\",\n} as const;\n\nexport const documentSyncResponseCommitLsnSentinelRefinement = {\n description:\n 'commitLsn \"0/0\" requires commitLsnMode \"untracked\" in the same response',\n id: \"response.untracked-commit-lsn-mode\",\n} as const;\n\nexport const documentSyncResponsePullPageRefinement = {\n description:\n \"pullPage.hasMore is true exactly when pullPage.nextCursor is non-null\",\n id: \"response.pull-page-continuation\",\n} as const;\n\nexport const documentSyncResponseHistoricalBundlesRefinement = {\n description:\n \"contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch\",\n id: \"response.historical-content-key-bundles\",\n} as const;\n\nexport const documentSyncResponseRuntimeRefinements = [\n documentSyncResponseRotationRefinement,\n documentSyncResponseCommitLsnModeRefinement,\n documentSyncResponseCommitLsnSentinelRefinement,\n documentSyncResponsePullPageRefinement,\n documentSyncResponseHistoricalBundlesRefinement,\n] as const;\n"]}
@@ -0,0 +1,5 @@
1
+ export const knownManifestsHeaderRefinement = {
2
+ id: "request.known-manifest-hints",
3
+ description: "x-known-manifests must list at most 48 unique lowercase SHA-256 manifest hashes",
4
+ };
5
+ //# sourceMappingURL=knownManifestsRefinements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knownManifestsRefinements.js","sourceRoot":"","sources":["knownManifestsRefinements.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,EAAE,EAAE,8BAA8B;IAClC,WAAW,EACT,iFAAiF;CAC3E,CAAC","sourcesContent":["export const knownManifestsHeaderRefinement = {\n id: \"request.known-manifest-hints\",\n description:\n \"x-known-manifests must list at most 48 unique lowercase SHA-256 manifest hashes\",\n} as const;\n"]}
@@ -746,6 +746,9 @@ export declare const documentSyncOperation: Omit<{
746
746
  }, {
747
747
  readonly description: "pullPage.hasMore is true exactly when pullPage.nextCursor is non-null";
748
748
  readonly id: "response.pull-page-continuation";
749
+ }, {
750
+ readonly description: "contentKeyBundles carries each content-key epoch at most once, and only epochs older than contentKeyBundle.contentKeyEpoch";
751
+ readonly id: "response.historical-content-key-bundles";
749
752
  }];
750
753
  }, "failureResponses" | "failureStatuses"> & {
751
754
  readonly failureResponses: {