@tearleads/client-sdk 0.1.11 → 0.1.14

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 (144) hide show
  1. package/README.md +50 -9
  2. package/client/Tearleads.d.ts +4 -0
  3. package/client/Tearleads.js +5 -0
  4. package/client/Tearleads.js.map +1 -1
  5. package/client/index.d.ts +1 -0
  6. package/client/index.js.map +1 -1
  7. package/client/principalHistoryProtection.d.ts +19 -0
  8. package/client/principalHistoryProtection.js +76 -0
  9. package/client/principalHistoryProtection.js.map +1 -0
  10. package/client/workflowRuntime.d.ts +5 -0
  11. package/client/workflowRuntime.js +34 -5
  12. package/client/workflowRuntime.js.map +1 -1
  13. package/data/containers/shared/authorAccess.d.ts +2 -2
  14. package/data/containers/shared/authorAccess.js.map +1 -1
  15. package/data/containers/shared/heldContainerHeads.js.map +1 -1
  16. package/data/containers/shared/principalPolicies.js.map +1 -1
  17. package/data/containers/shared/types.d.ts +3 -2
  18. package/data/containers/shared/types.js.map +1 -1
  19. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js.map +1 -1
  20. package/data/keyingProjectionVerification/checkpointContext.d.ts +4 -3
  21. package/data/keyingProjectionVerification/checkpointContext.js.map +1 -1
  22. package/data/keyingProjectionVerification/containerManifestVerification.js.map +1 -1
  23. package/data/keyingProjectionVerification/containerPathVerification.js.map +1 -1
  24. package/data/keyingProjectionVerification/containerProjectionVerification.d.ts +4 -3
  25. package/data/keyingProjectionVerification/containerProjectionVerification.js.map +1 -1
  26. package/data/keyingProjectionVerification/documentManifestPolicies.js.map +1 -1
  27. package/data/keyingProjectionVerification/documentManifestVerification.js.map +1 -1
  28. package/data/keyingProjectionVerification/documentProjectionVerification.d.ts +3 -2
  29. package/data/keyingProjectionVerification/documentProjectionVerification.js.map +1 -1
  30. package/data/keyingProjectionVerification/organizationFounderBinding.js +9 -4
  31. package/data/keyingProjectionVerification/organizationFounderBinding.js.map +1 -1
  32. package/data/keyingProjectionVerification/principalPolicyCache.js +3 -4
  33. package/data/keyingProjectionVerification/principalPolicyCache.js.map +1 -1
  34. package/data/keyingProjectionVerification/principalPolicyVerification.js +12 -2
  35. package/data/keyingProjectionVerification/principalPolicyVerification.js.map +1 -1
  36. package/data/keyingProjectionVerification/projectionAuthorizationEvidence.js.map +1 -1
  37. package/data/keyingProjectionVerification/resolvedPrincipalPolicy.js +70 -0
  38. package/data/keyingProjectionVerification/resolvedPrincipalPolicy.js.map +1 -0
  39. package/data/keyingProjectionVerification/types.d.ts +17 -2
  40. package/data/keyingProjectionVerification/types.js +12 -0
  41. package/data/keyingProjectionVerification/types.js.map +1 -1
  42. package/data/persistence/organizationFounderPersistence.js +3 -2
  43. package/data/persistence/organizationFounderPersistence.js.map +1 -1
  44. package/data/persistence/principalHistoryEvidencePersistence.js +91 -0
  45. package/data/persistence/principalHistoryEvidencePersistence.js.map +1 -0
  46. package/data/persistence/principalHistoryPrefixPersistence.js +52 -0
  47. package/data/persistence/principalHistoryPrefixPersistence.js.map +1 -0
  48. package/data/persistence/principalHistoryStagePersistence.js +9 -2
  49. package/data/persistence/principalHistoryStagePersistence.js.map +1 -1
  50. package/data/persistence/principalKeyEnvelopeCandidates.js +67 -0
  51. package/data/persistence/principalKeyEnvelopeCandidates.js.map +1 -0
  52. package/data/principals/principalHistoryPrefixProtection.js +29 -0
  53. package/data/principals/principalHistoryPrefixProtection.js.map +1 -0
  54. package/data/principals/principalHistoryProtection.d.ts +10 -0
  55. package/data/principals/principalHistoryProtection.js +14 -0
  56. package/data/principals/principalHistoryProtection.js.map +1 -0
  57. package/data/principals/principalHistoryStageProtection.js.map +1 -1
  58. package/data/principals/principalPolicyCrypto.js +11 -21
  59. package/data/principals/principalPolicyCrypto.js.map +1 -1
  60. package/data/principals/principalPolicyEvidence.d.ts +4 -0
  61. package/data/principals/principalPolicyEvidence.js +12 -0
  62. package/data/principals/principalPolicyEvidence.js.map +1 -0
  63. package/data/sqlite/principalHistoryEvidenceSchema.js +46 -0
  64. package/data/sqlite/principalHistoryEvidenceSchema.js.map +1 -0
  65. package/data/sqlite/principalKeyFingerprintJson.js +9 -0
  66. package/data/sqlite/principalKeyFingerprintJson.js.map +1 -0
  67. package/data/sqlite/principalPolicySchema.js +4 -0
  68. package/data/sqlite/principalPolicySchema.js.map +1 -1
  69. package/data/sqlite/schema.d.ts +304 -0
  70. package/data/sqlite/schema.js +5 -0
  71. package/data/sqlite/schema.js.map +1 -1
  72. package/data/sqlite/sqlTableSchema.js +1 -1
  73. package/data/sqlite/sqlTableSchema.js.map +1 -1
  74. package/index.d.ts +3 -3
  75. package/index.js +1 -1
  76. package/index.js.map +1 -1
  77. package/internal/api-client/principalPolicyPages.d.ts +2 -0
  78. package/internal/api-client/principalPolicyPages.js +11 -2
  79. package/internal/api-client/principalPolicyPages.js.map +1 -1
  80. package/internal/crypto/index.d.ts +1 -1
  81. package/internal/crypto/index.js +1 -1
  82. package/internal/crypto/index.js.map +1 -1
  83. package/internal/crypto/keying/index.d.ts +1 -1
  84. package/internal/crypto/keying/index.js +1 -1
  85. package/internal/crypto/keying/index.js.map +1 -1
  86. package/internal/crypto/keying/principalPolicyHistoryIndex.d.ts +6 -2
  87. package/internal/crypto/keying/principalPolicyHistoryIndex.js +11 -5
  88. package/internal/crypto/keying/principalPolicyHistoryIndex.js.map +1 -1
  89. package/internal/crypto/keying/principalPolicyHistoryReferences.d.ts +2 -0
  90. package/internal/crypto/keying/principalPolicyHistoryReferences.js +19 -2
  91. package/internal/crypto/keying/principalPolicyHistoryReferences.js.map +1 -1
  92. package/package.json +4 -1
  93. package/sqlite/sqlite3-licenses.md +38 -0
  94. package/sqlite/sqlite3.wasm +0 -0
  95. package/sqlite/worker.js +4 -0
  96. package/workflows/containers/child/create.js.map +1 -1
  97. package/workflows/containers/child/move.js.map +1 -1
  98. package/workflows/containers/child/moveWraps.js.map +1 -1
  99. package/workflows/containers/child/mutationRequestCore.js.map +1 -1
  100. package/workflows/containers/child/recitePlan.js.map +1 -1
  101. package/workflows/containers/child/rekey.d.ts +3 -2
  102. package/workflows/containers/child/rekey.js.map +1 -1
  103. package/workflows/containers/child/revoke.d.ts +2 -2
  104. package/workflows/containers/child/revoke.js.map +1 -1
  105. package/workflows/containers/child/rotationPrincipalPolicies.js.map +1 -1
  106. package/workflows/containers/child/rotationWraps.js.map +1 -1
  107. package/workflows/containers/child/sharePlanCore.d.ts +11 -10
  108. package/workflows/containers/child/sharePlanCore.js.map +1 -1
  109. package/workflows/documents/linkSetAuthority.js.map +1 -1
  110. package/workflows/principals/index.d.ts +1 -0
  111. package/workflows/principals/index.js +1 -0
  112. package/workflows/principals/index.js.map +1 -1
  113. package/workflows/principals/principalHistoryRecoveryPrefix.js +65 -0
  114. package/workflows/principals/principalHistoryRecoveryPrefix.js.map +1 -0
  115. package/workflows/principals/principalHistoryRecoveryReferences.js +60 -0
  116. package/workflows/principals/principalHistoryRecoveryReferences.js.map +1 -0
  117. package/workflows/principals/principalHistoryRecoveryStage.js +38 -2
  118. package/workflows/principals/principalHistoryRecoveryStage.js.map +1 -1
  119. package/workflows/principals/principalHistoryRecoveryTypes.d.ts +9 -1
  120. package/workflows/principals/principalHistoryRecoveryTypes.js +7 -0
  121. package/workflows/principals/principalHistoryRecoveryTypes.js.map +1 -1
  122. package/workflows/principals/principalHistoryRecoveryVerification.js +24 -0
  123. package/workflows/principals/principalHistoryRecoveryVerification.js.map +1 -0
  124. package/workflows/principals/principalRecoveryDirectory.d.ts +10 -0
  125. package/workflows/principals/principalRecoveryDirectory.js +107 -0
  126. package/workflows/principals/principalRecoveryDirectory.js.map +1 -0
  127. package/workflows/principals/principalRecoveryMemo.js +46 -0
  128. package/workflows/principals/principalRecoveryMemo.js.map +1 -0
  129. package/workflows/principals/principalRecoveryOutage.js +40 -0
  130. package/workflows/principals/principalRecoveryOutage.js.map +1 -0
  131. package/workflows/principals/principalRecoveryQueue.js +22 -0
  132. package/workflows/principals/principalRecoveryQueue.js.map +1 -0
  133. package/workflows/principals/recoverPrincipalPolicyHistory.d.ts +1 -0
  134. package/workflows/principals/recoverPrincipalPolicyHistory.js +108 -36
  135. package/workflows/principals/recoverPrincipalPolicyHistory.js.map +1 -1
  136. package/workflows/principals/recoverScopedPrincipalPolicyHistory.d.ts +13 -0
  137. package/workflows/principals/recoverScopedPrincipalPolicyHistory.js +150 -0
  138. package/workflows/principals/recoverScopedPrincipalPolicyHistory.js.map +1 -0
  139. package/workflows/principals/runtimePolicyRecovery.js +65 -0
  140. package/workflows/principals/runtimePolicyRecovery.js.map +1 -0
  141. package/workflows/principals/runtimePolicyWarmer.js +5 -1
  142. package/workflows/principals/runtimePolicyWarmer.js.map +1 -1
  143. package/workflows/sync/remoteResetPrincipalScope.js +10 -0
  144. package/workflows/sync/remoteResetPrincipalScope.js.map +1 -1
@@ -11,8 +11,10 @@ export interface PrincipalPolicyHistoryReferenceProof {
11
11
  * checked against the private root owned by a local verifier, never a peer's
12
12
  * claimed root. Each leaf commits to the exact signed entry already accepted.
13
13
  * Replaces the retained selection; the current entry is always included.
14
+ * A separate checkpoint proof preserves the full 128-citation selection budget.
14
15
  */
15
16
  export declare function verifyPrincipalPolicyHistoryReferences(input: {
16
17
  readonly history: VerifiedPrincipalPolicyHistory;
17
18
  readonly references: readonly PrincipalPolicyHistoryReferenceProof[];
19
+ readonly checkpointReference?: PrincipalPolicyHistoryReferenceProof | undefined;
18
20
  }): Promise<KeyingVerificationResult<VerifiedPrincipalPolicyHistory>>;
@@ -21,22 +21,39 @@ function assertProofBudget(references) {
21
21
  * checked against the private root owned by a local verifier, never a peer's
22
22
  * claimed root. Each leaf commits to the exact signed entry already accepted.
23
23
  * Replaces the retained selection; the current entry is always included.
24
+ * A separate checkpoint proof preserves the full 128-citation selection budget.
24
25
  */
25
26
  export function verifyPrincipalPolicyHistoryReferences(input) {
26
27
  return runVerifier(async () => {
27
28
  const history = ownVerifiedPrincipalPolicyHistory(input.history);
28
29
  const supplied = input.references;
30
+ const suppliedCheckpoint = input.checkpointReference;
29
31
  assertProofBudget(supplied);
32
+ if (suppliedCheckpoint !== undefined)
33
+ assertProofBudget([suppliedCheckpoint]);
30
34
  const references = structuredClone(supplied);
35
+ const checkpoint = structuredClone(suppliedCheckpoint);
31
36
  assertProofBudget(references);
32
- normalizePrincipalHistoryInput({
37
+ const scope = {
33
38
  principalId: history.currentEntry.state.principalId,
34
39
  principalType: history.currentEntry.state.principalType,
40
+ };
41
+ normalizePrincipalHistoryInput({
42
+ ...scope,
35
43
  retainedReferences: references.map((item) => item.reference),
36
44
  });
45
+ const selected = [...references];
46
+ if (checkpoint !== undefined) {
47
+ assertProofBudget([checkpoint]);
48
+ normalizePrincipalHistoryInput({
49
+ ...scope,
50
+ retainedReferences: [checkpoint.reference],
51
+ });
52
+ selected.push(checkpoint);
53
+ }
37
54
  const entries = new Map();
38
55
  const treeSize = history.currentEntry.state.version;
39
- for (const item of references) {
56
+ for (const item of selected) {
40
57
  const entry = await normalizePrincipalPolicyStateChainEntry(item.entry);
41
58
  const proof = normalizeTransparencyInclusionProof(item.proof);
42
59
  if (!principalPolicyStateMatchesReference(entry.state, item.reference) ||
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyHistoryReferences.js","sourceRoot":"","sources":["principalPolicyHistoryReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,GAEnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EACL,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAe9B,SAAS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ainEntry } from \"./principalPolicyChainEntry\";\nimport { normalizePrincipalHistoryInput } from \"./principalPolicyHistoryChecks\";\nimport { principalHistoryIndexLeaf } from \"./principalPolicyHistoryIndex\";\nimport {\n makeVerifiedPrincipalPolicyHistory,\n ownVerifiedPrincipalPolicyHistory,\n PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT,\n type VerifiedPrincipalPolicyHistory,\n} from \"./principalPolicyHistoryTypes\";\nimport { principalPolicyStateMatchesReference } from \"./principalPolicyReference\";\nimport { runVerifier, throwVerification } from \"./shared\";\nimport {\n assertTransparencyInclusion,\n normalizeTransparencyInclusionProof,\n} from \"./transparencyProofs\";\nimport type {\n KeyingVerificationResult,\n PrincipalPolicyStateChainEntry,\n ReferencedPrincipalHead,\n TransparencyInclusionProof,\n} from \"./types\";\n\n/** Untrusted material to select an entry from a locally verified prefix. */\nexport interface PrincipalPolicyHistoryReferenceProof {\n readonly reference: ReferencedPrincipalHead;\n readonly entry: PrincipalPolicyStateChainEntry;\n readonly proof: TransparencyInclusionProof;\n}\n\nfunction assertProofBudget(\n references: readonly PrincipalPolicyHistoryReferenceProof[],\n): void {\n if (\n !Array.isArray(references) ||\n references.length > PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT\n )\n throwVerification(\"invalid_shape\", \"too many principal history proofs\");\n const count = references.length;\n for (let index = 0; index < count; index += 1) {\n const path = references[index]?.proof.auditPath;\n if (!Array.isArray(path) || path.length > 53)\n throwVerification(\n \"invalid_shape\",\n \"principal history proof exceeds its budget\",\n );\n }\n}\n\n/**\n * Select new retained references without replaying signatures. Inclusion is\n * checked against the private root owned by a local verifier, never a peer's\n * claimed root. Each leaf commits to the exact signed entry already accepted.\n * Replaces the retained selection; the current entry is always included.\n */\nexport function verifyPrincipalPolicyHistoryReferences(input: {\n readonly history: VerifiedPrincipalPolicyHistory;\n readonly references: readonly PrincipalPolicyHistoryReferenceProof[];\n}): Promise<KeyingVerificationResult<VerifiedPrincipalPolicyHistory>> {\n return runVerifier(async () => {\n const history = ownVerifiedPrincipalPolicyHistory(input.history);\n const supplied = input.references;\n assertProofBudget(supplied);\n const references = structuredClone(supplied);\n assertProofBudget(references);\n normalizePrincipalHistoryInput({\n principalId: history.currentEntry.state.principalId,\n principalType: history.currentEntry.state.principalType,\n retainedReferences: references.map((item) => item.reference),\n });\n const entries = new Map<number, PrincipalPolicyStateChainEntry>();\n const treeSize = history.currentEntry.state.version;\n for (const item of references) {\n const entry = await normalizePrincipalPolicyStateChainEntry(item.entry);\n const proof = normalizeTransparencyInclusionProof(item.proof);\n if (\n !principalPolicyStateMatchesReference(entry.state, item.reference) ||\n entry.state.version > treeSize ||\n proof.leafIndex !== entry.state.version - 1\n )\n throwVerification(\n \"object_mismatch\",\n \"principal history proof reference mismatch\",\n );\n await assertTransparencyInclusion({\n leafHash: await principalHistoryIndexLeaf(entry.state),\n checkpoint: {\n logId: \"principal-history\",\n rootHash: history.indexRootHash,\n treeSize,\n },\n proof,\n });\n entries.set(entry.state.version, entry);\n }\n entries.set(treeSize, history.currentEntry);\n return makeVerifiedPrincipalPolicyHistory({\n ...history,\n retainedEntries: [...entries.values()].sort(\n (left, right) => left.state.version - right.state.version,\n ),\n });\n });\n}\n"]}
1
+ {"version":3,"file":"principalPolicyHistoryReferences.js","sourceRoot":"","sources":["principalPolicyHistoryReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,GAEnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EACL,2BAA2B,EAC3B,m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UAAU,EAAE;oBACV,KAAK,EAAE,mBAAmB;oBAC1B,QAAQ,EAAE,OAAO,CAAC,aAAa;oBAC/B,QAAQ;iBACT;gBACD,KAAK;aACN,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5C,OAAO,kCAAkC,CAAC;YACxC,GAAG,OAAO;YACV,eAAe,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CACzC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAC1D;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { normalizePrincipalPolicyStateChainEntry } from \"./principalPolicyChainEntry\";\nimport { normalizePrincipalHistoryInput } from \"./principalPolicyHistoryChecks\";\nimport { principalHistoryIndexLeaf } from \"./principalPolicyHistoryIndex\";\nimport {\n makeVerifiedPrincipalPolicyHistory,\n ownVerifiedPrincipalPolicyHistory,\n PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT,\n type VerifiedPrincipalPolicyHistory,\n} from \"./principalPolicyHistoryTypes\";\nimport { principalPolicyStateMatchesReference } from \"./principalPolicyReference\";\nimport { runVerifier, throwVerification } from \"./shared\";\nimport {\n assertTransparencyInclusion,\n normalizeTransparencyInclusionProof,\n} from \"./transparencyProofs\";\nimport type {\n KeyingVerificationResult,\n PrincipalPolicyStateChainEntry,\n ReferencedPrincipalHead,\n TransparencyInclusionProof,\n} from \"./types\";\n\n/** Untrusted material to select an entry from a locally verified prefix. */\nexport interface PrincipalPolicyHistoryReferenceProof {\n readonly reference: ReferencedPrincipalHead;\n readonly entry: PrincipalPolicyStateChainEntry;\n readonly proof: TransparencyInclusionProof;\n}\n\nfunction assertProofBudget(\n references: readonly PrincipalPolicyHistoryReferenceProof[],\n): void {\n if (\n !Array.isArray(references) ||\n references.length > PRINCIPAL_HISTORY_PAGE_ENTRY_LIMIT\n )\n throwVerification(\"invalid_shape\", \"too many principal history proofs\");\n const count = references.length;\n for (let index = 0; index < count; index += 1) {\n const path = references[index]?.proof.auditPath;\n if (!Array.isArray(path) || path.length > 53)\n throwVerification(\n \"invalid_shape\",\n \"principal history proof exceeds its budget\",\n );\n }\n}\n\n/**\n * Select new retained references without replaying signatures. Inclusion is\n * checked against the private root owned by a local verifier, never a peer's\n * claimed root. Each leaf commits to the exact signed entry already accepted.\n * Replaces the retained selection; the current entry is always included.\n * A separate checkpoint proof preserves the full 128-citation selection budget.\n */\nexport function verifyPrincipalPolicyHistoryReferences(input: {\n readonly history: VerifiedPrincipalPolicyHistory;\n readonly references: readonly PrincipalPolicyHistoryReferenceProof[];\n readonly checkpointReference?:\n | PrincipalPolicyHistoryReferenceProof\n | undefined;\n}): Promise<KeyingVerificationResult<VerifiedPrincipalPolicyHistory>> {\n return runVerifier(async () => {\n const history = ownVerifiedPrincipalPolicyHistory(input.history);\n const supplied = input.references;\n const suppliedCheckpoint = input.checkpointReference;\n assertProofBudget(supplied);\n if (suppliedCheckpoint !== undefined)\n assertProofBudget([suppliedCheckpoint]);\n const references = structuredClone(supplied);\n const checkpoint = structuredClone(suppliedCheckpoint);\n assertProofBudget(references);\n const scope = {\n principalId: history.currentEntry.state.principalId,\n principalType: history.currentEntry.state.principalType,\n };\n normalizePrincipalHistoryInput({\n ...scope,\n retainedReferences: references.map((item) => item.reference),\n });\n const selected = [...references];\n if (checkpoint !== undefined) {\n assertProofBudget([checkpoint]);\n normalizePrincipalHistoryInput({\n ...scope,\n retainedReferences: [checkpoint.reference],\n });\n selected.push(checkpoint);\n }\n const entries = new Map<number, PrincipalPolicyStateChainEntry>();\n const treeSize = history.currentEntry.state.version;\n for (const item of selected) {\n const entry = await normalizePrincipalPolicyStateChainEntry(item.entry);\n const proof = normalizeTransparencyInclusionProof(item.proof);\n if (\n !principalPolicyStateMatchesReference(entry.state, item.reference) ||\n entry.state.version > treeSize ||\n proof.leafIndex !== entry.state.version - 1\n )\n throwVerification(\n \"object_mismatch\",\n \"principal history proof reference mismatch\",\n );\n await assertTransparencyInclusion({\n leafHash: await principalHistoryIndexLeaf(entry.state),\n checkpoint: {\n logId: \"principal-history\",\n rootHash: history.indexRootHash,\n treeSize,\n },\n proof,\n });\n entries.set(entry.state.version, entry);\n }\n entries.set(treeSize, history.currentEntry);\n return makeVerifiedPrincipalPolicyHistory({\n ...history,\n retainedEntries: [...entries.values()].sort(\n (left, right) => left.state.version - right.state.version,\n ),\n });\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tearleads/client-sdk",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
4
4
  "description": "React-free Tearleads client runtime: local SQLite persistence, keys, sync, encrypted blobs, and domain workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -20,6 +20,9 @@
20
20
  "types": "./sqlite.d.ts",
21
21
  "default": "./sqlite.js"
22
22
  },
23
+ "./sqlite/worker.js": "./sqlite/worker.js",
24
+ "./sqlite/sqlite3.wasm": "./sqlite/sqlite3.wasm",
25
+ "./sqlite/sqlite3-licenses.md": "./sqlite/sqlite3-licenses.md",
23
26
  "./testing": {
24
27
  "types": "./data/trustedUserIdentity/testFixtures.d.ts",
25
28
  "default": "./data/trustedUserIdentity/testFixtures.js"
@@ -0,0 +1,38 @@
1
+ # SQLite WebAssembly licenses
2
+
3
+ `dist/jswasm/` holds the SQLite3 Multiple Ciphers WebAssembly build that
4
+ `scripts/buildSqliteMultipleCiphers.sh` downloads. Anything that ships those
5
+ files, or a bundle of them, ships this notice with them.
6
+
7
+ ## SQLite
8
+
9
+ SQLite and its WebAssembly JavaScript bindings are in the public domain:
10
+ <https://www.sqlite.org/copyright.html>.
11
+
12
+ ## SQLite3 Multiple Ciphers
13
+
14
+ <https://github.com/utelle/SQLite3MultipleCiphers>
15
+
16
+ ```text
17
+ MIT License
18
+
19
+ Copyright (c) 2019-2026 Ulrich Telle
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+ ```
Binary file