@pacspace-io/sdk 0.9.0 → 0.15.2

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 (152) hide show
  1. package/README.md +53 -132
  2. package/dist/blinding-file.d.ts +13 -0
  3. package/dist/blinding-file.d.ts.map +1 -0
  4. package/dist/blinding-guard.d.ts +7 -0
  5. package/dist/blinding-guard.d.ts.map +1 -0
  6. package/dist/blinding.d.ts +32 -0
  7. package/dist/blinding.d.ts.map +1 -0
  8. package/dist/client.d.ts +28 -4
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/fingerprint.d.ts +26 -5
  11. package/dist/fingerprint.d.ts.map +1 -1
  12. package/dist/index.d.ts +35 -35
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +7366 -186
  15. package/dist/index.js.map +7 -1
  16. package/dist/inputs.txt +132 -0
  17. package/dist/records-crypto-libraries.json +42 -0
  18. package/dist/records-crypto-types/proof/hiding-commitment-v1.d.ts +19 -0
  19. package/dist/records-crypto-types/proof/jcs.d.ts +4 -0
  20. package/dist/records-crypto-types/proof/layout-document-v1.d.ts +72 -0
  21. package/dist/records-crypto-types/proof/ledger-head-v1.d.ts +22 -0
  22. package/dist/records-crypto-types/proof/merkle-v2.d.ts +5 -0
  23. package/dist/records-crypto-types/proof/payload-ref-v1.d.ts +17 -0
  24. package/dist/records-crypto-types/proof/seal-input.d.ts +2 -0
  25. package/dist/records-crypto-types/proof/semantic-receipt-v2.d.ts +89 -0
  26. package/dist/records-crypto-types/proof/semantic-receipt-v3.d.ts +20 -0
  27. package/dist/records-crypto-types/proof/slot-encoding-v1.d.ts +169 -0
  28. package/dist/records-crypto-types/records/flag-threads-v1.d.ts +53 -0
  29. package/dist/records-crypto-types/records/labels.d.ts +37 -0
  30. package/dist/records-crypto-types/records/reader-crypto-v1.d.ts +198 -0
  31. package/dist/records-crypto-types/records/reader-link-v1.d.ts +164 -0
  32. package/dist/records-crypto-types/records/shared-record-ack-v2.d.ts +72 -0
  33. package/dist/records-crypto-types/records/signed-acknowledgment-v1.d.ts +38 -0
  34. package/dist/records-crypto-types/records/signed-acknowledgment-v2.d.ts +12 -0
  35. package/dist/records-crypto-types/records/trail-index-v1.d.ts +89 -0
  36. package/dist/records-crypto-types/records/trail-rule.d.ts +54 -0
  37. package/dist/records-crypto-types/records-crypto/asymmetric/ack-flag-notes-v1.d.ts +57 -0
  38. package/dist/records-crypto-types/records-crypto/asymmetric/flag-notes-v1.d.ts +55 -0
  39. package/dist/records-crypto-types/records-crypto/asymmetric/index.d.ts +4 -0
  40. package/dist/records-crypto-types/records-crypto/asymmetric/reader-wraps-v1.d.ts +83 -0
  41. package/dist/records-crypto-types/records-crypto/asymmetric/records-asymmetric-v1.d.ts +201 -0
  42. package/dist/records-crypto-types/records-crypto/base64url.d.ts +3 -0
  43. package/dist/records-crypto-types/records-crypto/blinding-file.d.ts +16 -0
  44. package/dist/records-crypto-types/records-crypto/blinding-value.d.ts +10 -0
  45. package/dist/records-crypto-types/records-crypto/bundle-entry.d.ts +2 -0
  46. package/dist/records-crypto-types/records-crypto/disclosure-envelope-v1.d.ts +42 -0
  47. package/dist/records-crypto-types/records-crypto/held-file.d.ts +17 -0
  48. package/dist/records-crypto-types/records-crypto/hmac-node.d.ts +8 -0
  49. package/dist/records-crypto-types/records-crypto/hmac-web.d.ts +8 -0
  50. package/dist/records-crypto-types/records-crypto/index.d.ts +13 -0
  51. package/dist/records-crypto-types/records-crypto/platform-crypto.d.ts +9 -0
  52. package/dist/records-crypto-types/records-crypto/record-disclosure-v1.d.ts +171 -0
  53. package/dist/records-crypto-types/records-crypto/record-hash-v2.d.ts +49 -0
  54. package/dist/records-crypto-types/records-crypto/record-hash-v3.d.ts +36 -0
  55. package/dist/records-crypto-types/records-crypto/records-encryption-v1.d.ts +185 -0
  56. package/dist/records-crypto-types/records-crypto/wrap-shapes-v1.d.ts +23 -0
  57. package/dist/records-crypto.d.ts +1 -0
  58. package/dist/records-crypto.js +16105 -0
  59. package/dist/records-crypto.js.map +7 -0
  60. package/dist/records-encryption/base64url.d.ts +5 -0
  61. package/dist/records-encryption/base64url.d.ts.map +1 -0
  62. package/dist/records-encryption/encrypted-records.d.ts +338 -0
  63. package/dist/records-encryption/encrypted-records.d.ts.map +1 -0
  64. package/dist/records-encryption/index.d.ts +14 -0
  65. package/dist/records-encryption/index.d.ts.map +1 -0
  66. package/dist/records-encryption/keys.d.ts +40 -0
  67. package/dist/records-encryption/keys.d.ts.map +1 -0
  68. package/dist/records-encryption/loader.d.ts +15 -0
  69. package/dist/records-encryption/loader.d.ts.map +1 -0
  70. package/dist/records-encryption/pin-store-file.d.ts +8 -0
  71. package/dist/records-encryption/pin-store-file.d.ts.map +1 -0
  72. package/dist/records-encryption/pin-store.d.ts +17 -0
  73. package/dist/records-encryption/pin-store.d.ts.map +1 -0
  74. package/dist/records-encryption/transport.d.ts +23 -0
  75. package/dist/records-encryption/transport.d.ts.map +1 -0
  76. package/dist/records-encryption/words.d.ts +40 -0
  77. package/dist/records-encryption/words.d.ts.map +1 -0
  78. package/dist/records-encryption/workspace-secret.d.ts +9 -0
  79. package/dist/records-encryption/workspace-secret.d.ts.map +1 -0
  80. package/dist/resources/records.d.ts +112 -2
  81. package/dist/resources/records.d.ts.map +1 -1
  82. package/dist/types/common.d.ts +0 -8
  83. package/dist/types/common.d.ts.map +1 -1
  84. package/dist/types/config.d.ts +7 -5
  85. package/dist/types/config.d.ts.map +1 -1
  86. package/dist/types/records-encryption.d.ts +136 -0
  87. package/dist/types/records-encryption.d.ts.map +1 -0
  88. package/dist/types/records.d.ts +171 -20
  89. package/dist/types/records.d.ts.map +1 -1
  90. package/dist/types/verify.d.ts +84 -0
  91. package/dist/types/verify.d.ts.map +1 -0
  92. package/dist/webhooks/index.d.ts +1 -1
  93. package/dist/webhooks/index.d.ts.map +1 -1
  94. package/dist/webhooks/index.js +229 -5
  95. package/dist/webhooks/index.js.map +7 -1
  96. package/dist/webhooks/types.d.ts +15 -7
  97. package/dist/webhooks/types.d.ts.map +1 -1
  98. package/dist/workspace-secret-file.d.ts +18 -0
  99. package/dist/workspace-secret-file.d.ts.map +1 -0
  100. package/package.json +16 -13
  101. package/dist/client.js +0 -553
  102. package/dist/client.js.map +0 -1
  103. package/dist/errors/index.js +0 -223
  104. package/dist/errors/index.js.map +0 -1
  105. package/dist/fingerprint.js +0 -132
  106. package/dist/fingerprint.js.map +0 -1
  107. package/dist/resources/balance.d.ts +0 -384
  108. package/dist/resources/balance.d.ts.map +0 -1
  109. package/dist/resources/balance.js +0 -1120
  110. package/dist/resources/balance.js.map +0 -1
  111. package/dist/resources/customers.d.ts +0 -33
  112. package/dist/resources/customers.d.ts.map +0 -1
  113. package/dist/resources/customers.js +0 -26
  114. package/dist/resources/customers.js.map +0 -1
  115. package/dist/resources/internal/batch-transport.d.ts +0 -65
  116. package/dist/resources/internal/batch-transport.d.ts.map +0 -1
  117. package/dist/resources/internal/batch-transport.js +0 -42
  118. package/dist/resources/internal/batch-transport.js.map +0 -1
  119. package/dist/resources/receipts.d.ts +0 -46
  120. package/dist/resources/receipts.d.ts.map +0 -1
  121. package/dist/resources/receipts.js +0 -133
  122. package/dist/resources/receipts.js.map +0 -1
  123. package/dist/resources/records.js +0 -232
  124. package/dist/resources/records.js.map +0 -1
  125. package/dist/resources/submission.d.ts +0 -79
  126. package/dist/resources/submission.d.ts.map +0 -1
  127. package/dist/resources/submission.js +0 -398
  128. package/dist/resources/submission.js.map +0 -1
  129. package/dist/types/balance.d.ts +0 -966
  130. package/dist/types/balance.d.ts.map +0 -1
  131. package/dist/types/balance.js +0 -3
  132. package/dist/types/balance.js.map +0 -1
  133. package/dist/types/common.js +0 -3
  134. package/dist/types/common.js.map +0 -1
  135. package/dist/types/config.js +0 -3
  136. package/dist/types/config.js.map +0 -1
  137. package/dist/types/records.js +0 -5
  138. package/dist/types/records.js.map +0 -1
  139. package/dist/types/submission.d.ts +0 -125
  140. package/dist/types/submission.d.ts.map +0 -1
  141. package/dist/types/submission.js +0 -3
  142. package/dist/types/submission.js.map +0 -1
  143. package/dist/utils/polling.d.ts +0 -32
  144. package/dist/utils/polling.d.ts.map +0 -1
  145. package/dist/utils/polling.js +0 -52
  146. package/dist/utils/polling.js.map +0 -1
  147. package/dist/utils/retry.js +0 -21
  148. package/dist/utils/retry.js.map +0 -1
  149. package/dist/webhooks/types.js +0 -3
  150. package/dist/webhooks/types.js.map +0 -1
  151. package/dist/webhooks/verify.js +0 -191
  152. package/dist/webhooks/verify.js.map +0 -1
@@ -0,0 +1,132 @@
1
+ ../../node_modules/@noble/ciphers/_arx.js
2
+ ../../node_modules/@noble/ciphers/_poly1305.js
3
+ ../../node_modules/@noble/ciphers/_polyval.js
4
+ ../../node_modules/@noble/ciphers/aes.js
5
+ ../../node_modules/@noble/ciphers/chacha.js
6
+ ../../node_modules/@noble/ciphers/utils.js
7
+ ../../node_modules/@noble/post-quantum/_crystals.js
8
+ ../../node_modules/@noble/post-quantum/hybrid.js
9
+ ../../node_modules/@noble/post-quantum/ml-dsa.js
10
+ ../../node_modules/@noble/post-quantum/ml-kem.js
11
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/curve.js
12
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/der.js
13
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/edwards.js
14
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/fft.js
15
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/frost.js
16
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/hash-to-curve.js
17
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/modular.js
18
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/montgomery.js
19
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/oprf.js
20
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/abstract/weierstrass.js
21
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/ed25519.js
22
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/nist.js
23
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/curves/utils.js
24
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/_md.js
25
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/_u64.js
26
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/hkdf.js
27
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/hmac.js
28
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/sha2.js
29
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/sha3.js
30
+ ../../node_modules/@noble/post-quantum/node_modules/@noble/hashes/utils.js
31
+ ../../node_modules/@noble/post-quantum/utils.js
32
+ ../../node_modules/@panva/hpke-noble/index.js
33
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/curve.js
34
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/der.js
35
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/edwards.js
36
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/fft.js
37
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/frost.js
38
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/hash-to-curve.js
39
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/modular.js
40
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/montgomery.js
41
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/oprf.js
42
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/abstract/weierstrass.js
43
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/ed25519.js
44
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/ed448.js
45
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/nist.js
46
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/curves/utils.js
47
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/_md.js
48
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/_u64.js
49
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/hkdf.js
50
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/hmac.js
51
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/sha2.js
52
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/sha3-addons.js
53
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/sha3.js
54
+ ../../node_modules/@panva/hpke-noble/node_modules/@noble/hashes/utils.js
55
+ ../../node_modules/hpke/index.js
56
+ ../shared/src/chain/rpc-provider.ts
57
+ ../shared/src/demo/independent-verify-records.ts
58
+ ../shared/src/demo/mirror-node-record-chain-reader.ts
59
+ ../shared/src/proof/hiding-commitment-v1.ts
60
+ ../shared/src/proof/jcs.ts
61
+ ../shared/src/proof/layout-document-v1.ts
62
+ ../shared/src/proof/ledger-head-v1.ts
63
+ ../shared/src/proof/merkle-v2.ts
64
+ ../shared/src/proof/payload-ref-v1.ts
65
+ ../shared/src/proof/seal-input.ts
66
+ ../shared/src/proof/semantic-receipt-v2.ts
67
+ ../shared/src/proof/semantic-receipt-v3.ts
68
+ ../shared/src/proof/slot-encoding-v1.ts
69
+ ../shared/src/records-crypto/asymmetric/ack-flag-notes-v1.ts
70
+ ../shared/src/records-crypto/asymmetric/flag-notes-v1.ts
71
+ ../shared/src/records-crypto/asymmetric/index.ts
72
+ ../shared/src/records-crypto/asymmetric/reader-wraps-v1.ts
73
+ ../shared/src/records-crypto/asymmetric/records-asymmetric-v1.ts
74
+ ../shared/src/records-crypto/base64url.ts
75
+ ../shared/src/records-crypto/blinding-file.ts
76
+ ../shared/src/records-crypto/blinding-value.ts
77
+ ../shared/src/records-crypto/bundle-entry.ts
78
+ ../shared/src/records-crypto/disclosure-envelope-v1.ts
79
+ ../shared/src/records-crypto/held-file.ts
80
+ ../shared/src/records-crypto/hmac-node.ts
81
+ ../shared/src/records-crypto/hmac-web.ts
82
+ ../shared/src/records-crypto/index.ts
83
+ ../shared/src/records-crypto/platform-crypto.ts
84
+ ../shared/src/records-crypto/record-disclosure-v1.ts
85
+ ../shared/src/records-crypto/record-hash-v2.ts
86
+ ../shared/src/records-crypto/record-hash-v3.ts
87
+ ../shared/src/records-crypto/records-encryption-v1.ts
88
+ ../shared/src/records-crypto/wrap-shapes-v1.ts
89
+ ../shared/src/records/build-record.ts
90
+ ../shared/src/records/flag-threads-v1.ts
91
+ ../shared/src/records/inspect-record-calldata-v1.ts
92
+ ../shared/src/records/labels.ts
93
+ ../shared/src/records/layout-not-read.ts
94
+ ../shared/src/records/layouts.generated.ts
95
+ ../shared/src/records/layouts.ts
96
+ ../shared/src/records/ledger-write-search-v1.ts
97
+ ../shared/src/records/model-record-link-v1.ts
98
+ ../shared/src/records/reader-crypto-v1.ts
99
+ ../shared/src/records/reader-link-v1.ts
100
+ ../shared/src/records/record-admission-v1.ts
101
+ ../shared/src/records/record-content-v1.ts
102
+ ../shared/src/records/record-entry-kind-v1.ts
103
+ ../shared/src/records/record-history-bundle-v1.ts
104
+ ../shared/src/records/record-history-bundle-v2.ts
105
+ ../shared/src/records/record-history-bundle-v3.ts
106
+ ../shared/src/records/record-link-copy-v1.ts
107
+ ../shared/src/records/record-seal-history-v1.ts
108
+ ../shared/src/records/reserved-record-forms.ts
109
+ ../shared/src/records/shared-record-ack-v2.ts
110
+ ../shared/src/records/signed-acknowledgment-v2.ts
111
+ ../shared/src/records/trail-index-v1.ts
112
+ scripts/shared-surface.ts
113
+ src/blinding-file.ts
114
+ src/blinding-guard.ts
115
+ src/blinding.ts
116
+ src/client.ts
117
+ src/errors/index.ts
118
+ src/fingerprint.ts
119
+ src/index.ts
120
+ src/records-encryption/base64url.ts
121
+ src/records-encryption/encrypted-records.ts
122
+ src/records-encryption/keys.ts
123
+ src/records-encryption/loader.ts
124
+ src/records-encryption/pin-store-file.ts
125
+ src/records-encryption/pin-store.ts
126
+ src/records-encryption/words.ts
127
+ src/records-encryption/workspace-secret.ts
128
+ src/resources/records.ts
129
+ src/types/records.ts
130
+ src/webhooks/index.ts
131
+ src/webhooks/verify.ts
132
+ src/workspace-secret-file.ts
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "path": "node_modules/hpke",
4
+ "name": "hpke",
5
+ "version": "1.1.7"
6
+ },
7
+ {
8
+ "path": "node_modules/@panva/hpke-noble",
9
+ "name": "@panva/hpke-noble",
10
+ "version": "1.1.7"
11
+ },
12
+ {
13
+ "path": "node_modules/@panva/hpke-noble/node_modules/@noble/curves",
14
+ "name": "@noble/curves",
15
+ "version": "2.4.0"
16
+ },
17
+ {
18
+ "path": "node_modules/@panva/hpke-noble/node_modules/@noble/hashes",
19
+ "name": "@noble/hashes",
20
+ "version": "2.4.0"
21
+ },
22
+ {
23
+ "path": "node_modules/@noble/ciphers",
24
+ "name": "@noble/ciphers",
25
+ "version": "2.4.0"
26
+ },
27
+ {
28
+ "path": "node_modules/@noble/post-quantum",
29
+ "name": "@noble/post-quantum",
30
+ "version": "0.7.1"
31
+ },
32
+ {
33
+ "path": "node_modules/@noble/post-quantum/node_modules/@noble/curves",
34
+ "name": "@noble/curves",
35
+ "version": "2.4.0"
36
+ },
37
+ {
38
+ "path": "node_modules/@noble/post-quantum/node_modules/@noble/hashes",
39
+ "name": "@noble/hashes",
40
+ "version": "2.4.0"
41
+ }
42
+ ]
@@ -0,0 +1,19 @@
1
+ export declare const PROOF_ALGORITHM_HIDING_COMMITMENT_V1 = "hiding-commitment-v1";
2
+ export declare function generateBatchSeedV1(): string;
3
+ export declare function deriveItemOpeningV1(batchSeed: string, itemIndex: number, itemHash: string): string;
4
+ export declare function computePublishedLeafV1(itemIndex: number, itemHash: string, itemOpening: string): string;
5
+ export interface HidingCommitmentBatchV1 {
6
+ itemOpenings: string[];
7
+ publishedLeaves: string[];
8
+ publishedRoot: string;
9
+ }
10
+ export declare function buildHidingCommitmentsV1(batchSeed: string, itemHashes: string[]): HidingCommitmentBatchV1;
11
+ export declare function buildPublishedLeafProofV1(publishedLeaves: string[], itemIndex: number): string[];
12
+ export interface HiddenItemProofV1 {
13
+ itemHash: string;
14
+ itemIndex: number;
15
+ itemOpening: string;
16
+ proof: string[];
17
+ expectedRoot: string;
18
+ }
19
+ export declare function verifyHiddenItemProofV1(input: HiddenItemProofV1): boolean;
@@ -0,0 +1,4 @@
1
+ export declare class JcsError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare function canonicalizeJcs(value: unknown): string;
@@ -0,0 +1,72 @@
1
+ export declare const LAYOUT_DOCUMENT_SCHEMA_V1 = "layout-document/v1";
2
+ export type LayoutFieldType = 'enum' | 'flags' | 'counter' | 'quantity' | 'reserved';
3
+ export interface LayoutFieldBase {
4
+ name: string;
5
+ type: LayoutFieldType;
6
+ bits: number;
7
+ }
8
+ export interface LayoutEnumField extends LayoutFieldBase {
9
+ type: 'enum';
10
+ values: Record<string, number>;
11
+ }
12
+ export interface LayoutFlagsField extends LayoutFieldBase {
13
+ type: 'flags';
14
+ bitNames: Record<string, number>;
15
+ }
16
+ export interface LayoutCounterField extends LayoutFieldBase {
17
+ type: 'counter';
18
+ fixed?: number;
19
+ }
20
+ export interface LayoutQuantityField extends LayoutFieldBase {
21
+ type: 'quantity';
22
+ unitCode: string;
23
+ scale: number;
24
+ semantics: 'perRecord' | 'cumulative';
25
+ }
26
+ export interface LayoutReservedField extends LayoutFieldBase {
27
+ type: 'reserved';
28
+ }
29
+ export type LayoutField = LayoutEnumField | LayoutFlagsField | LayoutCounterField | LayoutQuantityField | LayoutReservedField;
30
+ export interface LayoutLifecycle {
31
+ field: string;
32
+ genesis: string[];
33
+ terminal: string[];
34
+ transitions: Record<string, string[]>;
35
+ }
36
+ export interface LayoutDocumentV1 {
37
+ schema: typeof LAYOUT_DOCUMENT_SCHEMA_V1;
38
+ layoutId: number;
39
+ layoutVersion: number;
40
+ name: string;
41
+ recordTypeId: string;
42
+ encodingVersion: number;
43
+ stateBits: number;
44
+ sealBits: number;
45
+ public: boolean;
46
+ recordAttempts: boolean;
47
+ fields: LayoutField[];
48
+ lifecycle: LayoutLifecycle;
49
+ sealedRecordSchema: string;
50
+ notes?: string[];
51
+ }
52
+ export type RecordIntakeErrorCode = 'LAYOUT_NOT_FOUND' | 'RECORD_LAYOUT_MISMATCH' | 'RECORD_STATE_UNKNOWN' | 'RECORD_RESERVED_BITS_SET' | 'RECORD_QUANTITY_OVERFLOW' | 'RECORD_FLAG_UNKNOWN' | 'RECORD_TRANSITION_FORBIDDEN' | 'RECORD_GENESIS_MISMATCH' | 'RECORD_PAYLOAD_ALG_UNSUPPORTED' | 'RECORD_CONTENT_INVALID' | 'RECORD_LAYOUT_INVALID' | 'RECORD_PAYLOADS_REQUIRED' | 'RECORD_TITLE_TOO_LONG' | 'RECORD_BLINDING_INCLUDED';
53
+ export type BlindingMaterialRule = 'B1' | 'B2' | 'B3';
54
+ export declare class RecordIntakeError extends Error {
55
+ readonly code: RecordIntakeErrorCode;
56
+ readonly rule?: BlindingMaterialRule;
57
+ constructor(code: RecordIntakeErrorCode, message?: string, rule?: BlindingMaterialRule);
58
+ }
59
+ export type StateFieldValues = Record<string, string | number | bigint | string[] | undefined>;
60
+ export type DecodedState = Record<string, string | string[]>;
61
+ export declare function computeLayoutDigestV1(doc: LayoutDocumentV1): string;
62
+ export declare function validateLayoutDocumentV1(doc: LayoutDocumentV1): void;
63
+ export declare function getLayoutField(doc: LayoutDocumentV1, name: string): LayoutField | undefined;
64
+ export declare function lifecycleValues(doc: LayoutDocumentV1): Record<string, number>;
65
+ export declare function isTransitionAllowedV1(doc: LayoutDocumentV1, from: string, to: string): boolean;
66
+ export declare function packStateV1(doc: LayoutDocumentV1, values: StateFieldValues): bigint;
67
+ export declare function decodeStateV1(doc: LayoutDocumentV1, state96: bigint): DecodedState;
68
+ export declare function readLayoutIdFromState(state96: bigint): {
69
+ layoutId: number;
70
+ layoutVersion: number;
71
+ };
72
+ export declare function formatQuantityV1(field: LayoutQuantityField, raw: string | bigint): string;
@@ -0,0 +1,22 @@
1
+ export interface LedgerBatchRef {
2
+ batchId: number | bigint | string;
3
+ merkleRoot: string;
4
+ }
5
+ export declare function nextLedgerHeadV1(previousHead: string, merkleRoot: string, batchId: number | bigint | string): string;
6
+ export declare function recomputeLedgerHeadsV1(genesisHead: string, batches: LedgerBatchRef[]): string[];
7
+ export interface LedgerChainCheck {
8
+ verified: boolean;
9
+ recomputedHead: string;
10
+ passesThrough: boolean;
11
+ endsAtExpected: boolean;
12
+ reason: string;
13
+ }
14
+ export declare function verifyLedgerChainV1(input: {
15
+ genesisHead: string;
16
+ batches: LedgerBatchRef[];
17
+ expectedHead: string;
18
+ receipt: {
19
+ batchId: number | bigint | string;
20
+ proofRoot: string;
21
+ };
22
+ }): LedgerChainCheck;
@@ -0,0 +1,5 @@
1
+ export declare const MERKLE_ITEMS_ROOT_ALGORITHM_V2 = "pair-sorted-keccak-v2";
2
+ export declare function normalizeProofHash(value: string, fieldName?: string): string;
3
+ export declare function normalizeFingerprintList(fingerprints: string[]): string[];
4
+ export declare function computeMerkleItemsRootV2(fingerprints: string[]): string;
5
+ export declare function buildMerkleProofV2(fingerprints: string[], targetIndex: number): string[];
@@ -0,0 +1,17 @@
1
+ export declare const PAYLOAD_REF_ALGS: readonly ["sha-256", "hmac-sha-256"];
2
+ export type PayloadRefAlg = (typeof PAYLOAD_REF_ALGS)[number];
3
+ export interface PayloadRefV1 {
4
+ alg: PayloadRefAlg;
5
+ digest: string;
6
+ byteLength: string;
7
+ }
8
+ export declare const BLINDING_FILE_SCHEMA_V1 = "pacspace-blinding/v1";
9
+ export declare const RECORD_BLINDING_INCLUDED_SENTENCES: {
10
+ readonly material: "This write includes a blinding file or its value. Send only the fingerprint's alg, digest and byteLength; the blinding file stays with you.";
11
+ readonly extraField: "A blinded fingerprint carries only alg, digest and byteLength. Move any other field out of it.";
12
+ };
13
+ export declare function validatePayloadRefV1(ref: unknown): PayloadRefV1;
14
+ export declare function validatePayloadRefsInContent(content: unknown): void;
15
+ export declare function assertNoBlindingMaterial(value: unknown): void;
16
+ export type PayloadByteSource = Uint8Array | Iterable<Uint8Array> | AsyncIterable<Uint8Array>;
17
+ export declare function digestPayload(source: PayloadByteSource, alg?: 'sha-256'): Promise<PayloadRefV1>;
@@ -0,0 +1,2 @@
1
+ export type SealedRecordHashVersion = 1 | 2 | 3;
2
+ export declare function sealInputHash(version: SealedRecordHashVersion, recordHash: string): string;
@@ -0,0 +1,89 @@
1
+ import { DecodedState } from './layout-document-v1';
2
+ import { LedgerBatchRef } from './ledger-head-v1';
3
+ import { type SealedRecordHashVersion } from './seal-input';
4
+ import { LayoutRegistry, SLOT_ITEM_KIND_V1 } from './slot-encoding-v1';
5
+ export declare const SEMANTIC_RECEIPT_SCHEMA_V2 = "semantic-receipt/v2";
6
+ export interface SemanticReceiptV2 {
7
+ schema: typeof SEMANTIC_RECEIPT_SCHEMA_V2;
8
+ itemKind: typeof SLOT_ITEM_KIND_V1;
9
+ encodingVersion: number;
10
+ derivationVersion: number;
11
+ recordKey: string;
12
+ seq: number;
13
+ previousWord: string;
14
+ newWord: string;
15
+ layoutId: number;
16
+ layoutVersion: number;
17
+ layoutDigest: string;
18
+ recordContent: Record<string, unknown>;
19
+ recordOpening: string;
20
+ itemIndex: number;
21
+ itemOpening: string;
22
+ merkleProof: string[];
23
+ proofRoot: string;
24
+ batchId: number;
25
+ previousHead: string;
26
+ ledgerHead: string;
27
+ receiptId?: string;
28
+ }
29
+ export type SlotVerificationCheck = 'schema' | 'layout' | 'state-read' | 'semantic' | 'chain' | 'rule' | 'inclusion' | 'ledger';
30
+ export type SlotVerificationLevel = 'state-read' | 'semantic' | 'ledger';
31
+ export interface SlotReceiptVerificationV2 {
32
+ verified: boolean;
33
+ level: SlotVerificationLevel | null;
34
+ failedCheck: SlotVerificationCheck | null;
35
+ checks: Partial<Record<SlotVerificationCheck, boolean>>;
36
+ decodedState: DecodedState | null;
37
+ recomputedRecordHash: string | null;
38
+ recomputedSeal: string | null;
39
+ recomputedSealTag: string | null;
40
+ expectedSealTag: string | null;
41
+ recomputedItemHash: string | null;
42
+ reason: string;
43
+ }
44
+ export interface VerifySlotReceiptOptionsV2 {
45
+ layouts: LayoutRegistry;
46
+ chainWord?: string | bigint;
47
+ expectedProofRoot?: string;
48
+ ledger?: {
49
+ genesisHead: string;
50
+ batches: LedgerBatchRef[];
51
+ expectedHead: string;
52
+ };
53
+ }
54
+ export declare function isSlotReceiptV2(value: unknown): value is SemanticReceiptV2;
55
+ export declare function verifySlotReceiptV2(receipt: SemanticReceiptV2, options: VerifySlotReceiptOptionsV2): SlotReceiptVerificationV2;
56
+ export type SlotReceiptCoreV1 = Omit<SemanticReceiptV2, 'schema' | 'recordContent'>;
57
+ export type OpenedRecordContentV1 = {
58
+ ok: true;
59
+ recordHash: string;
60
+ recordContent: Record<string, unknown>;
61
+ sealedVersion?: SealedRecordHashVersion;
62
+ } | {
63
+ ok: false;
64
+ reason: string;
65
+ };
66
+ export declare function verifySlotReceiptCoreV1(receipt: SlotReceiptCoreV1, opened: () => OpenedRecordContentV1, options: VerifySlotReceiptOptionsV2): SlotReceiptVerificationV2;
67
+ export interface RecordHistoryCheckV2 {
68
+ complete: boolean;
69
+ currentSeq: number | null;
70
+ expectedRecords: number | null;
71
+ verifiedRecords: number;
72
+ missingSeq: number[];
73
+ failedSeq: number[];
74
+ chainBreaks: Array<{
75
+ seq: number;
76
+ reason: string;
77
+ }>;
78
+ headMatchesChain: boolean | null;
79
+ perReceipt: Array<{
80
+ seq: number;
81
+ result: SlotReceiptVerificationV2;
82
+ }>;
83
+ }
84
+ export declare function verifyRecordHistoryV2(receipts: SemanticReceiptV2[], options: VerifySlotReceiptOptionsV2 & {
85
+ proofRoots?: Record<string, string>;
86
+ }): RecordHistoryCheckV2;
87
+ export declare function verifyRecordHistoryCoreV1<R extends SlotReceiptCoreV1>(receipts: R[], verifyOne: (receipt: R, options: VerifySlotReceiptOptionsV2) => SlotReceiptVerificationV2, options: VerifySlotReceiptOptionsV2 & {
88
+ proofRoots?: Record<string, string>;
89
+ }): RecordHistoryCheckV2;
@@ -0,0 +1,20 @@
1
+ import { type RevealedLeafV2 } from '../records-crypto/record-hash-v2';
2
+ import { type RecordHistoryCheckV2, type SemanticReceiptV2, type SlotReceiptVerificationV2, type VerifySlotReceiptOptionsV2 } from './semantic-receipt-v2';
3
+ export declare const SEMANTIC_RECEIPT_SCHEMA_V3: "semantic-receipt/v3";
4
+ export interface SemanticReceiptV3 extends Omit<SemanticReceiptV2, 'schema' | 'recordContent'> {
5
+ schema: typeof SEMANTIC_RECEIPT_SCHEMA_V3;
6
+ leaves: string[];
7
+ revealed: RevealedLeafV2[];
8
+ }
9
+ export type RecordReceipt = SemanticReceiptV2 | SemanticReceiptV3;
10
+ export declare function unreadableFormReason(schema: unknown): string;
11
+ export declare function isSlotReceiptV3(value: unknown): value is SemanticReceiptV3;
12
+ export declare function verifySlotReceiptV3(receipt: SemanticReceiptV3, options: VerifySlotReceiptOptionsV2): Promise<SlotReceiptVerificationV2>;
13
+ export declare function verifyRecordHistoryV3(receipts: SemanticReceiptV3[], options: VerifySlotReceiptOptionsV2 & {
14
+ proofRoots?: Record<string, string>;
15
+ }): Promise<RecordHistoryCheckV2>;
16
+ export declare function verifyRecordReceipt(receipt: unknown, options: VerifySlotReceiptOptionsV2): Promise<SlotReceiptVerificationV2>;
17
+ export declare function verifyRecordHistory(receipts: unknown[], options: VerifySlotReceiptOptionsV2 & {
18
+ proofRoots?: Record<string, string>;
19
+ }): Promise<RecordHistoryCheckV2>;
20
+ export declare function recordContentOfReceipt(receipt: unknown): Record<string, unknown> | null;
@@ -0,0 +1,169 @@
1
+ import { DecodedState, LayoutDocumentV1, StateFieldValues } from './layout-document-v1';
2
+ import { type SealedRecordHashVersion } from './seal-input';
3
+ export declare const SLOT_ENCODING_VERSION_V1 = 1;
4
+ export declare const SLOT_STATE_BITS = 96;
5
+ export declare const SLOT_SEAL_BITS = 160;
6
+ export declare const SLOT_SEAL_MASK: bigint;
7
+ export declare const SLOT_STATE_MASK: bigint;
8
+ export declare const SLOT_ITEM_KIND_V1 = "slot-v1";
9
+ export declare const SLOT_DOMAINS_V1: {
10
+ readonly slotKey: "pacspace:slot-key:v1";
11
+ readonly slotOpening: "pacspace:slot-opening:v1";
12
+ readonly slotCommit: "pacspace:slot-commit:v1";
13
+ readonly record: "pacspace:record:v1";
14
+ readonly slotItem: "pacspace:slot-item:v1";
15
+ readonly intake: "pacspace:record-intake:v1";
16
+ };
17
+ export declare const WRITE_RECORD_BATCH_SIGNATURE_V1 = "writeRecordBatchAndCommit(bytes32[],uint256[],uint256[],uint8,bytes32,uint256)";
18
+ export declare const FLAG_TRANSITION_NOT_APPLIED = "transition_not_applied";
19
+ export declare const FLAG_DELIVERY_FAILED = "delivery_failed";
20
+ export declare const hex256: (v: bigint | number | string) => string;
21
+ export declare const hex160: (v: bigint | number | string) => string;
22
+ export declare const hex96: (v: bigint | number | string) => string;
23
+ export interface RegisteredLayout {
24
+ doc: LayoutDocumentV1;
25
+ digest: string;
26
+ }
27
+ export type LayoutRegistry = ReadonlyMap<number, RegisteredLayout>;
28
+ export declare function buildLayoutRegistry(docs: LayoutDocumentV1[]): LayoutRegistry;
29
+ export declare function getLayoutOrThrow(registry: LayoutRegistry, layoutId: number): RegisteredLayout;
30
+ export declare function deriveRecordKeyV1(tenantKey: string, recordTypeId: string, entityId: string): string;
31
+ export declare function computeRecordHashV1(content: unknown): string;
32
+ export declare function deriveRecordOpeningV1(batchSeed: string, itemIndex: number, recordKey: string): string;
33
+ export interface SealInputV1 {
34
+ layoutId: number;
35
+ layoutVersion: number;
36
+ layoutDigest: string;
37
+ state96: bigint;
38
+ recordHash: string;
39
+ recordOpening: string;
40
+ }
41
+ export declare function computeSealV1(input: SealInputV1): string;
42
+ export declare function sealTagOfV1(seal: string): string;
43
+ export declare function composeWordV1(state96: bigint, seal: string): bigint;
44
+ export interface SplitWordV1 {
45
+ state96: bigint;
46
+ state96Hex: string;
47
+ sealTag: string;
48
+ layoutId: number;
49
+ layoutVersion: number;
50
+ }
51
+ export declare function splitWordV1(word: string | bigint): SplitWordV1;
52
+ export declare function decodeWordV1(registry: LayoutRegistry, word: string | bigint): SplitWordV1 & {
53
+ layout: RegisteredLayout;
54
+ decodedState: DecodedState;
55
+ };
56
+ export interface SlotItemInputV1 {
57
+ recordKey: string;
58
+ seq: number;
59
+ previousWord: string | bigint;
60
+ newWord: string | bigint;
61
+ seal: string;
62
+ }
63
+ export declare function computeSlotItemHashV1(input: SlotItemInputV1): string;
64
+ export declare function computeIntakeIdempotencyKeyV1(tenantId: string, recordTypeId: string, entityId: string, reportedEvent: unknown): string;
65
+ export interface RecordReportV1 {
66
+ lifecycle: string;
67
+ fields?: StateFieldValues;
68
+ flags?: string[];
69
+ content: Record<string, unknown>;
70
+ }
71
+ export interface PreviousRecordV1 {
72
+ seq: number;
73
+ word: string | bigint;
74
+ }
75
+ export type SlotRecordKind = 'transition' | 'attempt' | 'failure';
76
+ export interface BuiltSlotRecordV1 {
77
+ layoutId: number;
78
+ layoutVersion: number;
79
+ layoutDigest: string;
80
+ recordKey: string;
81
+ seq: number;
82
+ kind: SlotRecordKind;
83
+ applied: boolean;
84
+ ruleId: string | null;
85
+ decodedState: DecodedState;
86
+ state96: string;
87
+ recordContent: Record<string, unknown>;
88
+ recordBytes: string;
89
+ recordHash: string;
90
+ itemIndex: number;
91
+ recordOpening: string;
92
+ seal: string;
93
+ sealTag: string;
94
+ previousWord: string;
95
+ newWord: string;
96
+ itemHash: string;
97
+ }
98
+ export interface BuildSlotRecordInputV1 {
99
+ layout: RegisteredLayout;
100
+ recordKey: string;
101
+ previous: PreviousRecordV1 | null;
102
+ report: RecordReportV1;
103
+ batchSeed: string;
104
+ itemIndex: number;
105
+ kind?: 'transition' | 'failure';
106
+ }
107
+ export declare function buildSlotRecordV1(input: BuildSlotRecordInputV1): BuiltSlotRecordV1;
108
+ export interface PlannedSlotRecordV1 {
109
+ layout: RegisteredLayout;
110
+ recordKey: string;
111
+ seq: number;
112
+ kind: SlotRecordKind;
113
+ applied: boolean;
114
+ ruleId: string | null;
115
+ state96: bigint;
116
+ recordContent: Record<string, unknown>;
117
+ previousWord: bigint;
118
+ itemIndex: number;
119
+ batchSeed: string;
120
+ }
121
+ export declare function planSlotRecordV1(input: BuildSlotRecordInputV1): PlannedSlotRecordV1;
122
+ export declare function sealSlotRecordV1(plan: PlannedSlotRecordV1, recordHash: string, sealedVersion?: SealedRecordHashVersion): BuiltSlotRecordV1;
123
+ export interface CommittedSlotItemV1 extends BuiltSlotRecordV1 {
124
+ itemOpening: string;
125
+ publishedLeaf: string;
126
+ merkleProof: string[];
127
+ }
128
+ export interface SlotBatchCommitV1 {
129
+ batchId: number;
130
+ itemCount: number;
131
+ merkleRoot: string;
132
+ previousHead: string;
133
+ ledgerHead: string;
134
+ calldata: string;
135
+ items: CommittedSlotItemV1[];
136
+ }
137
+ export declare const WRITE_RECORD_BATCH_SELECTOR_V1: string;
138
+ export declare function encodeWriteRecordBatchCalldataV1(records: Array<Pick<BuiltSlotRecordV1, 'recordKey' | 'previousWord' | 'newWord'>>, merkleRoot: string): string;
139
+ export interface DecodedWriteRecordBatchCalldataV1 {
140
+ selector: string;
141
+ functionSignature: string;
142
+ recordKeys: string[];
143
+ expectedWords: string[];
144
+ newWords: string[];
145
+ encodingVersion: number;
146
+ merkleRoot: string;
147
+ itemCount: number;
148
+ }
149
+ export declare function decodeWriteRecordBatchCalldataV1(calldata: string): DecodedWriteRecordBatchCalldataV1;
150
+ export declare function commitSlotBatchV1(records: BuiltSlotRecordV1[], batchSeed: string, batchId: number, previousHead: string): SlotBatchCommitV1;
151
+ export interface SlotBatchCommitmentsV1 {
152
+ itemCount: number;
153
+ merkleRoot: string;
154
+ calldata: string;
155
+ items: CommittedSlotItemV1[];
156
+ }
157
+ export declare function commitSlotBatchWithSeedsV1(records: BuiltSlotRecordV1[], seeds: string[]): SlotBatchCommitmentsV1;
158
+ export interface TransitionRuleCheckV1 {
159
+ ok: boolean;
160
+ from: string | null;
161
+ to: string;
162
+ flags: string[];
163
+ reason: string;
164
+ }
165
+ export declare function checkTransitionRuleV1(doc: LayoutDocumentV1, input: {
166
+ previousWord: string | bigint;
167
+ newWord: string | bigint;
168
+ recordContent?: Record<string, unknown>;
169
+ }): TransitionRuleCheckV1;
@@ -0,0 +1,53 @@
1
+ import { type NoteNameV1, type SealedNoteV1 } from './reader-crypto-v1';
2
+ export declare const FLAG_REF_PATTERN_V1: RegExp;
3
+ export declare const FLAG_RESULTS_V1: readonly ["matches", "does-not-match", "copy-differs"];
4
+ export type FlagResultV1 = (typeof FLAG_RESULTS_V1)[number];
5
+ export type FlagStatusV1 = 'open' | 'answered' | 'closed';
6
+ export declare const FLAG_TEXT_MAX_V1 = 2000;
7
+ export declare const FLAG_SEALED_NOTE_MAX_CHARS_V1: number;
8
+ export declare const FLAG_DRAFTS_MAX_V1 = 100;
9
+ export declare const FLAG_DRAFT_NOTE_MAX_V1 = 500;
10
+ export declare const PLAIN_NOTE_SCHEMA_V1: "plain-note/v1";
11
+ export declare const FLAG_DRAFTS_SCHEMA_V1: "flag-drafts/v1";
12
+ export declare function flagRefV1(n: number): string;
13
+ export declare function flagNoteNameV1(input: {
14
+ handle: string;
15
+ kind: 'answer' | 'reply';
16
+ ref: string;
17
+ n: number;
18
+ }): NoteNameV1;
19
+ export declare function flagDraftsNoteNameV1(input: {
20
+ handle: string;
21
+ reference: string;
22
+ version: number;
23
+ }): NoteNameV1;
24
+ export declare function readFlagTextV1(value: unknown): string | null;
25
+ export interface PlainNoteV1 {
26
+ schema: typeof PLAIN_NOTE_SCHEMA_V1;
27
+ text: string;
28
+ salt: string;
29
+ }
30
+ export declare function plainNoteV1(value: string): PlainNoteV1;
31
+ export declare function readPlainNoteV1(value: unknown): {
32
+ ok: true;
33
+ text: string;
34
+ } | {
35
+ ok: false;
36
+ };
37
+ export declare function readFlagSealedNoteV1(value: unknown): SealedNoteV1 | null;
38
+ export declare function flagNoteDigestV1(note: SealedNoteV1 | PlainNoteV1): Promise<string>;
39
+ export interface FlagDraftV1 {
40
+ record: number;
41
+ entry: number;
42
+ note: string | null;
43
+ }
44
+ export interface FlagDraftsV1 {
45
+ schema: typeof FLAG_DRAFTS_SCHEMA_V1;
46
+ flags: FlagDraftV1[];
47
+ }
48
+ export declare function readFlagDraftsV1(value: unknown): {
49
+ ok: true;
50
+ drafts: FlagDraftsV1;
51
+ } | {
52
+ ok: false;
53
+ };