@permissionless-technologies/upp-sdk 0.1.0

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 (140) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +194 -0
  3. package/dist/asp-TXSAFFD3.cjs +53 -0
  4. package/dist/asp-TXSAFFD3.cjs.map +1 -0
  5. package/dist/asp-ZA3RGN7G.js +4 -0
  6. package/dist/asp-ZA3RGN7G.js.map +1 -0
  7. package/dist/babyjubjub-2MGQVCKB.js +5 -0
  8. package/dist/babyjubjub-2MGQVCKB.js.map +1 -0
  9. package/dist/babyjubjub-MWZLJOVZ.cjs +66 -0
  10. package/dist/babyjubjub-MWZLJOVZ.cjs.map +1 -0
  11. package/dist/chunk-2JQISXBD.js +150 -0
  12. package/dist/chunk-2JQISXBD.js.map +1 -0
  13. package/dist/chunk-3HQ7A6ZM.cjs +61 -0
  14. package/dist/chunk-3HQ7A6ZM.cjs.map +1 -0
  15. package/dist/chunk-5AKBSMEQ.cjs +1008 -0
  16. package/dist/chunk-5AKBSMEQ.cjs.map +1 -0
  17. package/dist/chunk-5V5HSN6Y.js +81 -0
  18. package/dist/chunk-5V5HSN6Y.js.map +1 -0
  19. package/dist/chunk-BH24DZ5S.cjs +91 -0
  20. package/dist/chunk-BH24DZ5S.cjs.map +1 -0
  21. package/dist/chunk-C7QQOJ7T.cjs +67 -0
  22. package/dist/chunk-C7QQOJ7T.cjs.map +1 -0
  23. package/dist/chunk-ERQE57IA.cjs +404 -0
  24. package/dist/chunk-ERQE57IA.cjs.map +1 -0
  25. package/dist/chunk-EUP7MBAH.cjs +165 -0
  26. package/dist/chunk-EUP7MBAH.cjs.map +1 -0
  27. package/dist/chunk-G7VZBCD6.cjs +35 -0
  28. package/dist/chunk-G7VZBCD6.cjs.map +1 -0
  29. package/dist/chunk-GQV47S3N.cjs +10 -0
  30. package/dist/chunk-GQV47S3N.cjs.map +1 -0
  31. package/dist/chunk-GXZ3MTCQ.cjs +527 -0
  32. package/dist/chunk-GXZ3MTCQ.cjs.map +1 -0
  33. package/dist/chunk-JWNXBALH.cjs +57 -0
  34. package/dist/chunk-JWNXBALH.cjs.map +1 -0
  35. package/dist/chunk-KIKBPJXJ.cjs +348 -0
  36. package/dist/chunk-KIKBPJXJ.cjs.map +1 -0
  37. package/dist/chunk-NCW4AE7L.js +8 -0
  38. package/dist/chunk-NCW4AE7L.js.map +1 -0
  39. package/dist/chunk-NDM5EJEV.cjs +70 -0
  40. package/dist/chunk-NDM5EJEV.cjs.map +1 -0
  41. package/dist/chunk-NUIQHTSA.js +489 -0
  42. package/dist/chunk-NUIQHTSA.js.map +1 -0
  43. package/dist/chunk-OQDSHMXU.js +1002 -0
  44. package/dist/chunk-OQDSHMXU.js.map +1 -0
  45. package/dist/chunk-P37MRZ73.js +58 -0
  46. package/dist/chunk-P37MRZ73.js.map +1 -0
  47. package/dist/chunk-PWHOUQOZ.js +335 -0
  48. package/dist/chunk-PWHOUQOZ.js.map +1 -0
  49. package/dist/chunk-S4B7GYLN.js +112 -0
  50. package/dist/chunk-S4B7GYLN.js.map +1 -0
  51. package/dist/chunk-SGZZL5AC.js +59 -0
  52. package/dist/chunk-SGZZL5AC.js.map +1 -0
  53. package/dist/chunk-SQKBT2SH.cjs +122 -0
  54. package/dist/chunk-SQKBT2SH.cjs.map +1 -0
  55. package/dist/chunk-TSF6HEVS.cjs +201 -0
  56. package/dist/chunk-TSF6HEVS.cjs.map +1 -0
  57. package/dist/chunk-V23OSL25.js +48 -0
  58. package/dist/chunk-V23OSL25.js.map +1 -0
  59. package/dist/chunk-W77GRBO4.js +53 -0
  60. package/dist/chunk-W77GRBO4.js.map +1 -0
  61. package/dist/chunk-XV72HNHN.js +399 -0
  62. package/dist/chunk-XV72HNHN.js.map +1 -0
  63. package/dist/chunk-YOWDERVC.js +186 -0
  64. package/dist/chunk-YOWDERVC.js.map +1 -0
  65. package/dist/chunk-Z6ZWNWWR.js +30 -0
  66. package/dist/chunk-Z6ZWNWWR.js.map +1 -0
  67. package/dist/chunk-ZKZV6OI3.cjs +165 -0
  68. package/dist/chunk-ZKZV6OI3.cjs.map +1 -0
  69. package/dist/chunk-ZU6J7KMY.js +159 -0
  70. package/dist/chunk-ZU6J7KMY.js.map +1 -0
  71. package/dist/core/index.cjs +300 -0
  72. package/dist/core/index.cjs.map +1 -0
  73. package/dist/core/index.d.cts +9 -0
  74. package/dist/core/index.d.ts +9 -0
  75. package/dist/core/index.js +11 -0
  76. package/dist/core/index.js.map +1 -0
  77. package/dist/index-BBzvvrhG.d.ts +757 -0
  78. package/dist/index-BGvapsJy.d.cts +2811 -0
  79. package/dist/index-C-jSNw6j.d.cts +757 -0
  80. package/dist/index-ChGaGPzP.d.ts +2811 -0
  81. package/dist/index.cjs +3652 -0
  82. package/dist/index.cjs.map +1 -0
  83. package/dist/index.d.cts +12 -0
  84. package/dist/index.d.ts +12 -0
  85. package/dist/index.js +3112 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/indexer/index.cjs +58 -0
  88. package/dist/indexer/index.cjs.map +1 -0
  89. package/dist/indexer/index.d.cts +206 -0
  90. package/dist/indexer/index.d.ts +206 -0
  91. package/dist/indexer/index.js +5 -0
  92. package/dist/indexer/index.js.map +1 -0
  93. package/dist/keccak-m31-B_AqBbRF.d.cts +70 -0
  94. package/dist/keccak-m31-B_AqBbRF.d.ts +70 -0
  95. package/dist/keys/index.cjs +68 -0
  96. package/dist/keys/index.cjs.map +1 -0
  97. package/dist/keys/index.d.cts +158 -0
  98. package/dist/keys/index.d.ts +158 -0
  99. package/dist/keys/index.js +7 -0
  100. package/dist/keys/index.js.map +1 -0
  101. package/dist/merkle-7KS2EHRF.js +5 -0
  102. package/dist/merkle-7KS2EHRF.js.map +1 -0
  103. package/dist/merkle-HGDC6OB4.cjs +30 -0
  104. package/dist/merkle-HGDC6OB4.cjs.map +1 -0
  105. package/dist/merkle-mteVOlDf.d.cts +188 -0
  106. package/dist/merkle-mteVOlDf.d.ts +188 -0
  107. package/dist/poseidon-UHTJLWQM.js +7 -0
  108. package/dist/poseidon-UHTJLWQM.js.map +1 -0
  109. package/dist/poseidon-WHJSZSNP.cjs +45 -0
  110. package/dist/poseidon-WHJSZSNP.cjs.map +1 -0
  111. package/dist/proof-5OECB3RQ.cjs +45 -0
  112. package/dist/proof-5OECB3RQ.cjs.map +1 -0
  113. package/dist/proof-C4YBP6RY.js +4 -0
  114. package/dist/proof-C4YBP6RY.js.map +1 -0
  115. package/dist/react/index.cjs +2641 -0
  116. package/dist/react/index.cjs.map +1 -0
  117. package/dist/react/index.d.cts +757 -0
  118. package/dist/react/index.d.ts +757 -0
  119. package/dist/react/index.js +2598 -0
  120. package/dist/react/index.js.map +1 -0
  121. package/dist/transfer-2UDHDS7Q.cjs +37 -0
  122. package/dist/transfer-2UDHDS7Q.cjs.map +1 -0
  123. package/dist/transfer-BlmbO-Rd.d.ts +1270 -0
  124. package/dist/transfer-DKZuJnRM.d.cts +1270 -0
  125. package/dist/transfer-KTCXKHS4.js +8 -0
  126. package/dist/transfer-KTCXKHS4.js.map +1 -0
  127. package/dist/types-CJSbxv4q.d.cts +143 -0
  128. package/dist/types-mLybMxNR.d.ts +143 -0
  129. package/dist/utils/index.cjs +178 -0
  130. package/dist/utils/index.cjs.map +1 -0
  131. package/dist/utils/index.d.cts +88 -0
  132. package/dist/utils/index.d.ts +88 -0
  133. package/dist/utils/index.js +9 -0
  134. package/dist/utils/index.js.map +1 -0
  135. package/package.json +119 -0
  136. package/src/contracts/interfaces/IASPRegistry.sol +36 -0
  137. package/src/contracts/interfaces/IUniversalPrivatePool.sol +260 -0
  138. package/src/contracts/interfaces/IVerifiers.sol +68 -0
  139. package/src/deployments/11155111.json +19 -0
  140. package/src/deployments/31337.json +19 -0
@@ -0,0 +1,8 @@
1
+ export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-PWHOUQOZ.js';
2
+ import './chunk-P37MRZ73.js';
3
+ import './chunk-ZU6J7KMY.js';
4
+ import './chunk-V23OSL25.js';
5
+ import './chunk-S4B7GYLN.js';
6
+ import './chunk-Z6ZWNWWR.js';
7
+ //# sourceMappingURL=transfer-KTCXKHS4.js.map
8
+ //# sourceMappingURL=transfer-KTCXKHS4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-KTCXKHS4.js"}
@@ -0,0 +1,143 @@
1
+ import { Hex, Address } from 'viem';
2
+ import { M as M31Secret, a as M31Digest } from './keccak-m31-B_AqBbRF.cjs';
3
+
4
+ /**
5
+ * Key Type Definitions for UPP SDK
6
+ *
7
+ * Post-quantum key structure (hash-based, no elliptic curves):
8
+ *
9
+ * Wallet Signature → Seed
10
+ * ├── Spending Secret → Owner Hash = Poseidon(spendingSecret)
11
+ * └── Viewing Secret (for note encryption, derived from seed)
12
+ *
13
+ * Ownership is proven via hash preimage: "I know secret such that Poseidon(secret) == ownerHash"
14
+ * This replaces the previous BabyJubJub ECDLP-based ownership proof.
15
+ */
16
+
17
+ /**
18
+ * Master keys derived from wallet signature
19
+ *
20
+ * Post-quantum: uses hash-based ownership instead of BabyJubJub curve.
21
+ * ownerHash = Poseidon(spendingSecret) replaces spendingPubKey (curve point).
22
+ */
23
+ interface MasterKeys {
24
+ /** Spending secret - for note ownership proofs (hash preimage) */
25
+ spendingSecret: bigint;
26
+ /** Owner hash = Poseidon(spendingSecret) - publicly committed in notes */
27
+ ownerHash: bigint;
28
+ /** Viewing secret - for note encryption/decryption (symmetric key derivation) */
29
+ viewingSecret: bigint;
30
+ /** Viewing hash = Poseidon(viewingSecret) - for search tags and indexing */
31
+ viewingHash: bigint;
32
+ }
33
+ /**
34
+ * Per-transaction viewing key (for decryption)
35
+ *
36
+ * Can be shared with auditors to reveal specific transactions
37
+ * without compromising the master viewing secret.
38
+ *
39
+ * Post-quantum: uses hash-based key derivation instead of ECDH.
40
+ */
41
+ interface TransactionViewingKey {
42
+ /** The Merkle leaf index (for locating the on-chain event) */
43
+ leafIndex: number;
44
+ /** The per-note nonce (used in key derivation) */
45
+ nonce: bigint;
46
+ /** The per-note decryption key (derived from viewingSecret + nonce) */
47
+ decryptionKey: Hex;
48
+ }
49
+ /**
50
+ * Exported viewing keys for audit
51
+ *
52
+ * Contains the minimum information needed for an auditor
53
+ * to decrypt specific transactions.
54
+ */
55
+ interface AuditKeyExport {
56
+ /** Version for forward compatibility (v4 = post-quantum hash-based) */
57
+ version: 4;
58
+ /** Ethereum address that signed to derive keys (for identification) */
59
+ signerAddress: Address;
60
+ /** The viewing hash (for verification) */
61
+ viewingHash: bigint;
62
+ /** Per-transaction viewing keys */
63
+ viewingKeys: TransactionViewingKey[];
64
+ /** Instructions for auditor */
65
+ instructions: string;
66
+ }
67
+ /**
68
+ * Stealth address components (simplified for hash-based system)
69
+ * Published once, used by senders to encrypt notes
70
+ */
71
+ interface StealthAddressComponents {
72
+ /** Owner hash = Poseidon(spendingSecret) */
73
+ ownerHash: bigint;
74
+ /** Viewing hash = Poseidon(viewingSecret) - for encryption */
75
+ viewingHash: bigint;
76
+ /** Optional chain ID (for multi-chain support) */
77
+ chainId?: number;
78
+ }
79
+ /**
80
+ * Configuration for key derivation
81
+ */
82
+ interface KeyDerivationConfig {
83
+ /** The message to sign for key derivation */
84
+ message: string;
85
+ /** Version number for the key derivation scheme */
86
+ version: 1;
87
+ }
88
+ /**
89
+ * Default key derivation configuration
90
+ */
91
+ declare const DEFAULT_KEY_DERIVATION_CONFIG: KeyDerivationConfig;
92
+ /**
93
+ * Result of deriving one-time keys for a transaction (hash-based)
94
+ */
95
+ interface OneTimeKeys {
96
+ /** One-time secret (for the owner to spend the note) */
97
+ oneTimeSecret: bigint;
98
+ /** One-time owner hash = Poseidon(oneTimeSecret) - in the commitment */
99
+ ownerHash: bigint;
100
+ }
101
+ /**
102
+ * Serialized key format for storage
103
+ */
104
+ interface SerializedKeys {
105
+ version: 1;
106
+ /** Hex-encoded encrypted key data */
107
+ encryptedData: Hex;
108
+ /** Salt for key derivation (if password protected) */
109
+ salt?: Hex;
110
+ /** Nonce for encryption */
111
+ nonce: Hex;
112
+ }
113
+
114
+ /** Which proving system to use */
115
+ type ProvingSystem = 'snark' | 'stark';
116
+ /**
117
+ * STARK master keys derived from wallet signature.
118
+ *
119
+ * Uses M31 field and keccak-256 hashing — no elliptic curves.
120
+ * ownerHash = keccak_m31(starkSecret) — 4 M31 elements.
121
+ */
122
+ interface StarkMasterKeys {
123
+ /** 8 M31 limbs (248 bits of entropy) — for ownership proofs */
124
+ starkSecret: M31Secret;
125
+ /** keccak_m31(starkSecret) — publicly committed in STARK notes */
126
+ starkOwnerHash: M31Digest;
127
+ /** 8 M31 limbs — for note encryption/decryption */
128
+ starkViewingSecret: M31Secret;
129
+ /** keccak_m31(starkViewingSecret) — for search tags and indexing */
130
+ starkViewingHash: M31Digest;
131
+ }
132
+ /**
133
+ * Dual master keys: both SNARK (BN254/Poseidon) and STARK (M31/Keccak).
134
+ *
135
+ * Derived from the same wallet signature via domain-separated keccak256.
136
+ * Breaking BJJ (quantum) does NOT compromise STARK keys (keccak preimage resistance).
137
+ */
138
+ interface DualMasterKeys {
139
+ snark: MasterKeys;
140
+ stark: StarkMasterKeys;
141
+ }
142
+
143
+ export { type AuditKeyExport as A, DEFAULT_KEY_DERIVATION_CONFIG as D, type KeyDerivationConfig as K, type MasterKeys as M, type OneTimeKeys as O, type ProvingSystem as P, type SerializedKeys as S, type TransactionViewingKey as T, type DualMasterKeys as a, type StarkMasterKeys as b, type StealthAddressComponents as c };
@@ -0,0 +1,143 @@
1
+ import { Hex, Address } from 'viem';
2
+ import { M as M31Secret, a as M31Digest } from './keccak-m31-B_AqBbRF.js';
3
+
4
+ /**
5
+ * Key Type Definitions for UPP SDK
6
+ *
7
+ * Post-quantum key structure (hash-based, no elliptic curves):
8
+ *
9
+ * Wallet Signature → Seed
10
+ * ├── Spending Secret → Owner Hash = Poseidon(spendingSecret)
11
+ * └── Viewing Secret (for note encryption, derived from seed)
12
+ *
13
+ * Ownership is proven via hash preimage: "I know secret such that Poseidon(secret) == ownerHash"
14
+ * This replaces the previous BabyJubJub ECDLP-based ownership proof.
15
+ */
16
+
17
+ /**
18
+ * Master keys derived from wallet signature
19
+ *
20
+ * Post-quantum: uses hash-based ownership instead of BabyJubJub curve.
21
+ * ownerHash = Poseidon(spendingSecret) replaces spendingPubKey (curve point).
22
+ */
23
+ interface MasterKeys {
24
+ /** Spending secret - for note ownership proofs (hash preimage) */
25
+ spendingSecret: bigint;
26
+ /** Owner hash = Poseidon(spendingSecret) - publicly committed in notes */
27
+ ownerHash: bigint;
28
+ /** Viewing secret - for note encryption/decryption (symmetric key derivation) */
29
+ viewingSecret: bigint;
30
+ /** Viewing hash = Poseidon(viewingSecret) - for search tags and indexing */
31
+ viewingHash: bigint;
32
+ }
33
+ /**
34
+ * Per-transaction viewing key (for decryption)
35
+ *
36
+ * Can be shared with auditors to reveal specific transactions
37
+ * without compromising the master viewing secret.
38
+ *
39
+ * Post-quantum: uses hash-based key derivation instead of ECDH.
40
+ */
41
+ interface TransactionViewingKey {
42
+ /** The Merkle leaf index (for locating the on-chain event) */
43
+ leafIndex: number;
44
+ /** The per-note nonce (used in key derivation) */
45
+ nonce: bigint;
46
+ /** The per-note decryption key (derived from viewingSecret + nonce) */
47
+ decryptionKey: Hex;
48
+ }
49
+ /**
50
+ * Exported viewing keys for audit
51
+ *
52
+ * Contains the minimum information needed for an auditor
53
+ * to decrypt specific transactions.
54
+ */
55
+ interface AuditKeyExport {
56
+ /** Version for forward compatibility (v4 = post-quantum hash-based) */
57
+ version: 4;
58
+ /** Ethereum address that signed to derive keys (for identification) */
59
+ signerAddress: Address;
60
+ /** The viewing hash (for verification) */
61
+ viewingHash: bigint;
62
+ /** Per-transaction viewing keys */
63
+ viewingKeys: TransactionViewingKey[];
64
+ /** Instructions for auditor */
65
+ instructions: string;
66
+ }
67
+ /**
68
+ * Stealth address components (simplified for hash-based system)
69
+ * Published once, used by senders to encrypt notes
70
+ */
71
+ interface StealthAddressComponents {
72
+ /** Owner hash = Poseidon(spendingSecret) */
73
+ ownerHash: bigint;
74
+ /** Viewing hash = Poseidon(viewingSecret) - for encryption */
75
+ viewingHash: bigint;
76
+ /** Optional chain ID (for multi-chain support) */
77
+ chainId?: number;
78
+ }
79
+ /**
80
+ * Configuration for key derivation
81
+ */
82
+ interface KeyDerivationConfig {
83
+ /** The message to sign for key derivation */
84
+ message: string;
85
+ /** Version number for the key derivation scheme */
86
+ version: 1;
87
+ }
88
+ /**
89
+ * Default key derivation configuration
90
+ */
91
+ declare const DEFAULT_KEY_DERIVATION_CONFIG: KeyDerivationConfig;
92
+ /**
93
+ * Result of deriving one-time keys for a transaction (hash-based)
94
+ */
95
+ interface OneTimeKeys {
96
+ /** One-time secret (for the owner to spend the note) */
97
+ oneTimeSecret: bigint;
98
+ /** One-time owner hash = Poseidon(oneTimeSecret) - in the commitment */
99
+ ownerHash: bigint;
100
+ }
101
+ /**
102
+ * Serialized key format for storage
103
+ */
104
+ interface SerializedKeys {
105
+ version: 1;
106
+ /** Hex-encoded encrypted key data */
107
+ encryptedData: Hex;
108
+ /** Salt for key derivation (if password protected) */
109
+ salt?: Hex;
110
+ /** Nonce for encryption */
111
+ nonce: Hex;
112
+ }
113
+
114
+ /** Which proving system to use */
115
+ type ProvingSystem = 'snark' | 'stark';
116
+ /**
117
+ * STARK master keys derived from wallet signature.
118
+ *
119
+ * Uses M31 field and keccak-256 hashing — no elliptic curves.
120
+ * ownerHash = keccak_m31(starkSecret) — 4 M31 elements.
121
+ */
122
+ interface StarkMasterKeys {
123
+ /** 8 M31 limbs (248 bits of entropy) — for ownership proofs */
124
+ starkSecret: M31Secret;
125
+ /** keccak_m31(starkSecret) — publicly committed in STARK notes */
126
+ starkOwnerHash: M31Digest;
127
+ /** 8 M31 limbs — for note encryption/decryption */
128
+ starkViewingSecret: M31Secret;
129
+ /** keccak_m31(starkViewingSecret) — for search tags and indexing */
130
+ starkViewingHash: M31Digest;
131
+ }
132
+ /**
133
+ * Dual master keys: both SNARK (BN254/Poseidon) and STARK (M31/Keccak).
134
+ *
135
+ * Derived from the same wallet signature via domain-separated keccak256.
136
+ * Breaking BJJ (quantum) does NOT compromise STARK keys (keccak preimage resistance).
137
+ */
138
+ interface DualMasterKeys {
139
+ snark: MasterKeys;
140
+ stark: StarkMasterKeys;
141
+ }
142
+
143
+ export { type AuditKeyExport as A, DEFAULT_KEY_DERIVATION_CONFIG as D, type KeyDerivationConfig as K, type MasterKeys as M, type OneTimeKeys as O, type ProvingSystem as P, type SerializedKeys as S, type TransactionViewingKey as T, type DualMasterKeys as a, type StarkMasterKeys as b, type StealthAddressComponents as c };
@@ -0,0 +1,178 @@
1
+ 'use strict';
2
+
3
+ require('../chunk-GQV47S3N.cjs');
4
+ var chunkTSF6HEVS_cjs = require('../chunk-TSF6HEVS.cjs');
5
+ var chunkEUP7MBAH_cjs = require('../chunk-EUP7MBAH.cjs');
6
+ var chunkBH24DZ5S_cjs = require('../chunk-BH24DZ5S.cjs');
7
+ var chunk3HQ7A6ZM_cjs = require('../chunk-3HQ7A6ZM.cjs');
8
+ var chunkJWNXBALH_cjs = require('../chunk-JWNXBALH.cjs');
9
+ require('../chunk-G7VZBCD6.cjs');
10
+
11
+
12
+
13
+ Object.defineProperty(exports, "addPoints", {
14
+ enumerable: true,
15
+ get: function () { return chunkTSF6HEVS_cjs.addPoints; }
16
+ });
17
+ Object.defineProperty(exports, "computeSharedSecret", {
18
+ enumerable: true,
19
+ get: function () { return chunkTSF6HEVS_cjs.computeSharedSecret; }
20
+ });
21
+ Object.defineProperty(exports, "deriveDecryptionViewingKey", {
22
+ enumerable: true,
23
+ get: function () { return chunkTSF6HEVS_cjs.deriveDecryptionViewingKey; }
24
+ });
25
+ Object.defineProperty(exports, "deriveEncryptionViewingKey", {
26
+ enumerable: true,
27
+ get: function () { return chunkTSF6HEVS_cjs.deriveEncryptionViewingKey; }
28
+ });
29
+ Object.defineProperty(exports, "getBasePoint", {
30
+ enumerable: true,
31
+ get: function () { return chunkTSF6HEVS_cjs.getBasePoint; }
32
+ });
33
+ Object.defineProperty(exports, "getSubOrder", {
34
+ enumerable: true,
35
+ get: function () { return chunkTSF6HEVS_cjs.getSubOrder; }
36
+ });
37
+ Object.defineProperty(exports, "isOnCurve", {
38
+ enumerable: true,
39
+ get: function () { return chunkTSF6HEVS_cjs.isOnCurve; }
40
+ });
41
+ Object.defineProperty(exports, "mulPointScalar", {
42
+ enumerable: true,
43
+ get: function () { return chunkTSF6HEVS_cjs.mulPointScalar; }
44
+ });
45
+ Object.defineProperty(exports, "packPoint", {
46
+ enumerable: true,
47
+ get: function () { return chunkTSF6HEVS_cjs.packPoint; }
48
+ });
49
+ Object.defineProperty(exports, "pointToTuple", {
50
+ enumerable: true,
51
+ get: function () { return chunkTSF6HEVS_cjs.pointToTuple; }
52
+ });
53
+ Object.defineProperty(exports, "privateToPublic", {
54
+ enumerable: true,
55
+ get: function () { return chunkTSF6HEVS_cjs.privateToPublic; }
56
+ });
57
+ Object.defineProperty(exports, "tupleToPoint", {
58
+ enumerable: true,
59
+ get: function () { return chunkTSF6HEVS_cjs.tupleToPoint; }
60
+ });
61
+ Object.defineProperty(exports, "MAX_TREE_DEPTH", {
62
+ enumerable: true,
63
+ get: function () { return chunkEUP7MBAH_cjs.MAX_TREE_DEPTH; }
64
+ });
65
+ Object.defineProperty(exports, "MerkleTree", {
66
+ enumerable: true,
67
+ get: function () { return chunkEUP7MBAH_cjs.MerkleTree; }
68
+ });
69
+ Object.defineProperty(exports, "buildMerkleTree", {
70
+ enumerable: true,
71
+ get: function () { return chunkEUP7MBAH_cjs.buildMerkleTree; }
72
+ });
73
+ Object.defineProperty(exports, "getMerkleProof", {
74
+ enumerable: true,
75
+ get: function () { return chunkEUP7MBAH_cjs.getMerkleProof; }
76
+ });
77
+ Object.defineProperty(exports, "verifyMerkleProof", {
78
+ enumerable: true,
79
+ get: function () { return chunkEUP7MBAH_cjs.verifyMerkleProof; }
80
+ });
81
+ Object.defineProperty(exports, "DIGEST_SIZE", {
82
+ enumerable: true,
83
+ get: function () { return chunkBH24DZ5S_cjs.DIGEST_SIZE; }
84
+ });
85
+ Object.defineProperty(exports, "M31_P", {
86
+ enumerable: true,
87
+ get: function () { return chunkBH24DZ5S_cjs.M31_P; }
88
+ });
89
+ Object.defineProperty(exports, "SECRET_LIMBS", {
90
+ enumerable: true,
91
+ get: function () { return chunkBH24DZ5S_cjs.SECRET_LIMBS; }
92
+ });
93
+ Object.defineProperty(exports, "computeStarkCommitment", {
94
+ enumerable: true,
95
+ get: function () { return chunkBH24DZ5S_cjs.computeStarkCommitment; }
96
+ });
97
+ Object.defineProperty(exports, "computeStarkNullifier", {
98
+ enumerable: true,
99
+ get: function () { return chunkBH24DZ5S_cjs.computeStarkNullifier; }
100
+ });
101
+ Object.defineProperty(exports, "computeStarkOwnerHash", {
102
+ enumerable: true,
103
+ get: function () { return chunkBH24DZ5S_cjs.computeStarkOwnerHash; }
104
+ });
105
+ Object.defineProperty(exports, "keccakHashTwo", {
106
+ enumerable: true,
107
+ get: function () { return chunkBH24DZ5S_cjs.keccakHashTwo; }
108
+ });
109
+ Object.defineProperty(exports, "keccakM31", {
110
+ enumerable: true,
111
+ get: function () { return chunkBH24DZ5S_cjs.keccakM31; }
112
+ });
113
+ Object.defineProperty(exports, "splitToM31Limbs", {
114
+ enumerable: true,
115
+ get: function () { return chunkBH24DZ5S_cjs.splitToM31Limbs; }
116
+ });
117
+ Object.defineProperty(exports, "bigintToBytes", {
118
+ enumerable: true,
119
+ get: function () { return chunk3HQ7A6ZM_cjs.bigintToBytes; }
120
+ });
121
+ Object.defineProperty(exports, "bytesToBigint", {
122
+ enumerable: true,
123
+ get: function () { return chunk3HQ7A6ZM_cjs.bytesToBigint; }
124
+ });
125
+ Object.defineProperty(exports, "bytesToHex", {
126
+ enumerable: true,
127
+ get: function () { return chunk3HQ7A6ZM_cjs.bytesToHex; }
128
+ });
129
+ Object.defineProperty(exports, "hexToBytes", {
130
+ enumerable: true,
131
+ get: function () { return chunk3HQ7A6ZM_cjs.hexToBytes; }
132
+ });
133
+ Object.defineProperty(exports, "randomBytes", {
134
+ enumerable: true,
135
+ get: function () { return chunk3HQ7A6ZM_cjs.randomBytes; }
136
+ });
137
+ Object.defineProperty(exports, "randomFieldElement", {
138
+ enumerable: true,
139
+ get: function () { return chunk3HQ7A6ZM_cjs.randomFieldElement; }
140
+ });
141
+ Object.defineProperty(exports, "BABYJUBJUB_SUBORDER", {
142
+ enumerable: true,
143
+ get: function () { return chunkJWNXBALH_cjs.BABYJUBJUB_SUBORDER; }
144
+ });
145
+ Object.defineProperty(exports, "FIELD_PRIME", {
146
+ enumerable: true,
147
+ get: function () { return chunkJWNXBALH_cjs.FIELD_PRIME; }
148
+ });
149
+ Object.defineProperty(exports, "addressToField", {
150
+ enumerable: true,
151
+ get: function () { return chunkJWNXBALH_cjs.addressToField; }
152
+ });
153
+ Object.defineProperty(exports, "fieldToAddress", {
154
+ enumerable: true,
155
+ get: function () { return chunkJWNXBALH_cjs.fieldToAddress; }
156
+ });
157
+ Object.defineProperty(exports, "isValidFieldElement", {
158
+ enumerable: true,
159
+ get: function () { return chunkJWNXBALH_cjs.isValidFieldElement; }
160
+ });
161
+ Object.defineProperty(exports, "poseidon", {
162
+ enumerable: true,
163
+ get: function () { return chunkJWNXBALH_cjs.poseidon; }
164
+ });
165
+ Object.defineProperty(exports, "poseidonHash", {
166
+ enumerable: true,
167
+ get: function () { return chunkJWNXBALH_cjs.poseidonHash; }
168
+ });
169
+ Object.defineProperty(exports, "poseidonScalar", {
170
+ enumerable: true,
171
+ get: function () { return chunkJWNXBALH_cjs.poseidonScalar; }
172
+ });
173
+ Object.defineProperty(exports, "toFieldElement", {
174
+ enumerable: true,
175
+ get: function () { return chunkJWNXBALH_cjs.toFieldElement; }
176
+ });
177
+ //# sourceMappingURL=index.cjs.map
178
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,88 @@
1
+ export { M as MAX_TREE_DEPTH, a as MerkleProof, b as MerkleTree, P as Point, c as addPoints, d as buildMerkleTree, e as computeSharedSecret, f as deriveDecryptionViewingKey, g as deriveEncryptionViewingKey, h as getBasePoint, i as getMerkleProof, j as getSubOrder, k as isOnCurve, m as mulPointScalar, p as packPoint, l as pointToTuple, n as privateToPublic, t as tupleToPoint, v as verifyMerkleProof } from '../merkle-mteVOlDf.cjs';
2
+ export { D as DIGEST_SIZE, a as M31Digest, M as M31Secret, b as M31_P, S as SECRET_LIMBS, c as computeStarkCommitment, d as computeStarkNullifier, e as computeStarkOwnerHash, k as keccakHashTwo, f as keccakM31, s as splitToM31Limbs } from '../keccak-m31-B_AqBbRF.cjs';
3
+
4
+ /**
5
+ * Poseidon Hash Utilities
6
+ *
7
+ * Wrapper around circomlibjs Poseidon hash implementation.
8
+ * Used for commitments, nullifiers, and key derivation.
9
+ */
10
+ /**
11
+ * BN254 field prime (same as used in Circom/snarkjs)
12
+ */
13
+ declare const FIELD_PRIME = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
14
+ /**
15
+ * BabyJubJub subgroup order
16
+ */
17
+ declare const BABYJUBJUB_SUBORDER = 2736030358979909402780800718157159386076813972158567259200215660948447373041n;
18
+ /**
19
+ * Compute Poseidon hash of inputs
20
+ *
21
+ * @param inputs - Array of field elements to hash (up to 16 elements)
22
+ * @returns Hash as bigint
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const commitment = await poseidon([amount, blinding, origin, token])
27
+ * ```
28
+ */
29
+ declare function poseidon(inputs: bigint[]): Promise<bigint>;
30
+ /**
31
+ * Compute Poseidon hash and return as hex string
32
+ */
33
+ declare function poseidonHash(inputs: bigint[]): Promise<`0x${string}`>;
34
+ /**
35
+ * Compute Poseidon hash modulo BabyJubJub suborder
36
+ * Used for deriving scalars for curve operations
37
+ */
38
+ declare function poseidonScalar(inputs: bigint[]): Promise<bigint>;
39
+ /**
40
+ * Convert an address to a field element
41
+ */
42
+ declare function addressToField(address: `0x${string}`): bigint;
43
+ /**
44
+ * Convert a field element to an address (20 bytes)
45
+ */
46
+ declare function fieldToAddress(field: bigint): `0x${string}`;
47
+ /**
48
+ * Check if a value is within the field
49
+ */
50
+ declare function isValidFieldElement(value: bigint): boolean;
51
+ /**
52
+ * Reduce a value modulo field prime
53
+ */
54
+ declare function toFieldElement(value: bigint): bigint;
55
+
56
+ /**
57
+ * Cryptographic Utilities
58
+ *
59
+ * Secure random number generation and field arithmetic.
60
+ */
61
+ /**
62
+ * Generate cryptographically secure random bytes
63
+ */
64
+ declare function randomBytes(length: number): Uint8Array;
65
+ /**
66
+ * Generate a random field element (for blinding factors, etc.)
67
+ *
68
+ * Returns a value in range [0, FIELD_PRIME)
69
+ */
70
+ declare function randomFieldElement(): bigint;
71
+ /**
72
+ * Convert bytes to hex string
73
+ */
74
+ declare function bytesToHex(bytes: Uint8Array): `0x${string}`;
75
+ /**
76
+ * Convert hex string to bytes
77
+ */
78
+ declare function hexToBytes(hex: `0x${string}`): Uint8Array;
79
+ /**
80
+ * Convert bigint to bytes (big-endian)
81
+ */
82
+ declare function bigintToBytes(value: bigint, length: number): Uint8Array;
83
+ /**
84
+ * Convert bytes to bigint (big-endian)
85
+ */
86
+ declare function bytesToBigint(bytes: Uint8Array): bigint;
87
+
88
+ export { BABYJUBJUB_SUBORDER, FIELD_PRIME, addressToField, bigintToBytes, bytesToBigint, bytesToHex, fieldToAddress, hexToBytes, isValidFieldElement, poseidon, poseidonHash, poseidonScalar, randomBytes, randomFieldElement, toFieldElement };
@@ -0,0 +1,88 @@
1
+ export { M as MAX_TREE_DEPTH, a as MerkleProof, b as MerkleTree, P as Point, c as addPoints, d as buildMerkleTree, e as computeSharedSecret, f as deriveDecryptionViewingKey, g as deriveEncryptionViewingKey, h as getBasePoint, i as getMerkleProof, j as getSubOrder, k as isOnCurve, m as mulPointScalar, p as packPoint, l as pointToTuple, n as privateToPublic, t as tupleToPoint, v as verifyMerkleProof } from '../merkle-mteVOlDf.js';
2
+ export { D as DIGEST_SIZE, a as M31Digest, M as M31Secret, b as M31_P, S as SECRET_LIMBS, c as computeStarkCommitment, d as computeStarkNullifier, e as computeStarkOwnerHash, k as keccakHashTwo, f as keccakM31, s as splitToM31Limbs } from '../keccak-m31-B_AqBbRF.js';
3
+
4
+ /**
5
+ * Poseidon Hash Utilities
6
+ *
7
+ * Wrapper around circomlibjs Poseidon hash implementation.
8
+ * Used for commitments, nullifiers, and key derivation.
9
+ */
10
+ /**
11
+ * BN254 field prime (same as used in Circom/snarkjs)
12
+ */
13
+ declare const FIELD_PRIME = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
14
+ /**
15
+ * BabyJubJub subgroup order
16
+ */
17
+ declare const BABYJUBJUB_SUBORDER = 2736030358979909402780800718157159386076813972158567259200215660948447373041n;
18
+ /**
19
+ * Compute Poseidon hash of inputs
20
+ *
21
+ * @param inputs - Array of field elements to hash (up to 16 elements)
22
+ * @returns Hash as bigint
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const commitment = await poseidon([amount, blinding, origin, token])
27
+ * ```
28
+ */
29
+ declare function poseidon(inputs: bigint[]): Promise<bigint>;
30
+ /**
31
+ * Compute Poseidon hash and return as hex string
32
+ */
33
+ declare function poseidonHash(inputs: bigint[]): Promise<`0x${string}`>;
34
+ /**
35
+ * Compute Poseidon hash modulo BabyJubJub suborder
36
+ * Used for deriving scalars for curve operations
37
+ */
38
+ declare function poseidonScalar(inputs: bigint[]): Promise<bigint>;
39
+ /**
40
+ * Convert an address to a field element
41
+ */
42
+ declare function addressToField(address: `0x${string}`): bigint;
43
+ /**
44
+ * Convert a field element to an address (20 bytes)
45
+ */
46
+ declare function fieldToAddress(field: bigint): `0x${string}`;
47
+ /**
48
+ * Check if a value is within the field
49
+ */
50
+ declare function isValidFieldElement(value: bigint): boolean;
51
+ /**
52
+ * Reduce a value modulo field prime
53
+ */
54
+ declare function toFieldElement(value: bigint): bigint;
55
+
56
+ /**
57
+ * Cryptographic Utilities
58
+ *
59
+ * Secure random number generation and field arithmetic.
60
+ */
61
+ /**
62
+ * Generate cryptographically secure random bytes
63
+ */
64
+ declare function randomBytes(length: number): Uint8Array;
65
+ /**
66
+ * Generate a random field element (for blinding factors, etc.)
67
+ *
68
+ * Returns a value in range [0, FIELD_PRIME)
69
+ */
70
+ declare function randomFieldElement(): bigint;
71
+ /**
72
+ * Convert bytes to hex string
73
+ */
74
+ declare function bytesToHex(bytes: Uint8Array): `0x${string}`;
75
+ /**
76
+ * Convert hex string to bytes
77
+ */
78
+ declare function hexToBytes(hex: `0x${string}`): Uint8Array;
79
+ /**
80
+ * Convert bigint to bytes (big-endian)
81
+ */
82
+ declare function bigintToBytes(value: bigint, length: number): Uint8Array;
83
+ /**
84
+ * Convert bytes to bigint (big-endian)
85
+ */
86
+ declare function bytesToBigint(bytes: Uint8Array): bigint;
87
+
88
+ export { BABYJUBJUB_SUBORDER, FIELD_PRIME, addressToField, bigintToBytes, bytesToBigint, bytesToHex, fieldToAddress, hexToBytes, isValidFieldElement, poseidon, poseidonHash, poseidonScalar, randomBytes, randomFieldElement, toFieldElement };
@@ -0,0 +1,9 @@
1
+ import '../chunk-NCW4AE7L.js';
2
+ export { addPoints, computeSharedSecret, deriveDecryptionViewingKey, deriveEncryptionViewingKey, getBasePoint, getSubOrder, isOnCurve, mulPointScalar, packPoint, pointToTuple, privateToPublic, tupleToPoint } from '../chunk-YOWDERVC.js';
3
+ export { MAX_TREE_DEPTH, MerkleTree, buildMerkleTree, getMerkleProof, verifyMerkleProof } from '../chunk-ZU6J7KMY.js';
4
+ export { DIGEST_SIZE, M31_P, SECRET_LIMBS, computeStarkCommitment, computeStarkNullifier, computeStarkOwnerHash, keccakHashTwo, keccakM31, splitToM31Limbs } from '../chunk-5V5HSN6Y.js';
5
+ export { bigintToBytes, bytesToBigint, bytesToHex, hexToBytes, randomBytes, randomFieldElement } from '../chunk-W77GRBO4.js';
6
+ export { BABYJUBJUB_SUBORDER, FIELD_PRIME, addressToField, fieldToAddress, isValidFieldElement, poseidon, poseidonHash, poseidonScalar, toFieldElement } from '../chunk-V23OSL25.js';
7
+ import '../chunk-Z6ZWNWWR.js';
8
+ //# sourceMappingURL=index.js.map
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}