@umbra-privacy/sdk 1.0.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.
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/addresses-Brzgurv_.d.ts +145 -0
- package/dist/addresses-D_0YAS6B.d.cts +145 -0
- package/dist/chunk-2Q75CQQJ.js +12 -0
- package/dist/chunk-2Q75CQQJ.js.map +1 -0
- package/dist/chunk-7QVYU63E.js +6 -0
- package/dist/chunk-7QVYU63E.js.map +1 -0
- package/dist/chunk-BM7N6N7E.js +1883 -0
- package/dist/chunk-BM7N6N7E.js.map +1 -0
- package/dist/chunk-GXKSUB2U.cjs +4416 -0
- package/dist/chunk-GXKSUB2U.cjs.map +1 -0
- package/dist/chunk-HOEXDXRC.cjs +792 -0
- package/dist/chunk-HOEXDXRC.cjs.map +1 -0
- package/dist/chunk-MDFSBU5W.cjs +2033 -0
- package/dist/chunk-MDFSBU5W.cjs.map +1 -0
- package/dist/chunk-MQY7HDIA.js +600 -0
- package/dist/chunk-MQY7HDIA.js.map +1 -0
- package/dist/chunk-MVKTV3FT.cjs +20 -0
- package/dist/chunk-MVKTV3FT.cjs.map +1 -0
- package/dist/chunk-PG2J6V6Y.js +4094 -0
- package/dist/chunk-PG2J6V6Y.js.map +1 -0
- package/dist/chunk-PK6SKIKE.cjs +8 -0
- package/dist/chunk-PK6SKIKE.cjs.map +1 -0
- package/dist/chunk-VEGLTTYQ.cjs +621 -0
- package/dist/chunk-VEGLTTYQ.cjs.map +1 -0
- package/dist/chunk-WVHQ46DD.js +758 -0
- package/dist/chunk-WVHQ46DD.js.map +1 -0
- package/dist/constants/index.cjs +316 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +739 -0
- package/dist/constants/index.d.ts +739 -0
- package/dist/constants/index.js +193 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/cryptography-BTGC72u-.d.cts +4809 -0
- package/dist/cryptography-BTGC72u-.d.ts +4809 -0
- package/dist/errors/index.cjs +141 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +1415 -0
- package/dist/errors/index.d.ts +1415 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index-B9pDY73x.d.ts +12933 -0
- package/dist/index-CLj_zWSD.d.ts +235 -0
- package/dist/index-CX6_pIRS.d.cts +235 -0
- package/dist/index-D33yo0qB.d.cts +12933 -0
- package/dist/index.cjs +22464 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11694 -0
- package/dist/index.d.ts +11694 -0
- package/dist/index.js +22314 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.cjs +4 -0
- package/dist/interfaces/index.cjs.map +1 -0
- package/dist/interfaces/index.d.cts +8 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/networks-C-orpSFW.d.ts +65 -0
- package/dist/networks-FxYERGD1.d.cts +65 -0
- package/dist/types/index.cjs +605 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +1853 -0
- package/dist/types/index.d.ts +1853 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types-BBuELtY8.d.cts +495 -0
- package/dist/types-n-sHFcgr.d.ts +495 -0
- package/dist/utils/index.cjs +1295 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +9559 -0
- package/dist/utils/index.d.ts +9559 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/versions-D9PqsEvj.d.cts +173 -0
- package/dist/versions-D9PqsEvj.d.ts +173 -0
- package/package.json +151 -0
|
@@ -0,0 +1,2033 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
4
|
+
|
|
5
|
+
// src/common/types.ts
|
|
6
|
+
var U8_MAX = 0xffn;
|
|
7
|
+
var U16_MAX = 0xffffn;
|
|
8
|
+
var U32_MAX = 0xffffffffn;
|
|
9
|
+
var U64_MAX = 0xffffffffffffffffn;
|
|
10
|
+
var U128_MAX = (1n << 128n) - 1n;
|
|
11
|
+
var U256_MAX = (1n << 256n) - 1n;
|
|
12
|
+
var U512_MAX = (1n << 512n) - 1n;
|
|
13
|
+
var U1024_MAX = (1n << 1024n) - 1n;
|
|
14
|
+
var I8_MIN = -(1n << 7n);
|
|
15
|
+
var I8_MAX = (1n << 7n) - 1n;
|
|
16
|
+
var I16_MIN = -(1n << 15n);
|
|
17
|
+
var I16_MAX = (1n << 15n) - 1n;
|
|
18
|
+
var I32_MIN = -(1n << 31n);
|
|
19
|
+
var I32_MAX = (1n << 31n) - 1n;
|
|
20
|
+
var I64_MIN = -(1n << 63n);
|
|
21
|
+
var I64_MAX = (1n << 63n) - 1n;
|
|
22
|
+
var I128_MIN = -(1n << 127n);
|
|
23
|
+
var I128_MAX = (1n << 127n) - 1n;
|
|
24
|
+
var I256_MIN = -(1n << 255n);
|
|
25
|
+
var I256_MAX = (1n << 255n) - 1n;
|
|
26
|
+
var I512_MIN = -(1n << 511n);
|
|
27
|
+
var I512_MAX = (1n << 511n) - 1n;
|
|
28
|
+
var I1024_MIN = -(1n << 1023n);
|
|
29
|
+
var I1024_MAX = (1n << 1023n) - 1n;
|
|
30
|
+
var U8_BYTE_LENGTH = 1;
|
|
31
|
+
var U16_BYTE_LENGTH = 2;
|
|
32
|
+
var U32_BYTE_LENGTH = 4;
|
|
33
|
+
var U64_BYTE_LENGTH = 8;
|
|
34
|
+
var U128_BYTE_LENGTH = 16;
|
|
35
|
+
var U256_BYTE_LENGTH = 32;
|
|
36
|
+
var U512_BYTE_LENGTH = 64;
|
|
37
|
+
var U1024_BYTE_LENGTH = 128;
|
|
38
|
+
var MathematicsAssertionError = class _MathematicsAssertionError extends Error {
|
|
39
|
+
static {
|
|
40
|
+
chunkPK6SKIKE_cjs.__name(this, "MathematicsAssertionError");
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The actual value that failed the assertion.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* This can be any type depending on what was being asserted.
|
|
47
|
+
* For integer assertions, this will be a `bigint`.
|
|
48
|
+
* For byte array assertions, this will be a `Uint8Array`.
|
|
49
|
+
*
|
|
50
|
+
* @readonly
|
|
51
|
+
*/
|
|
52
|
+
value;
|
|
53
|
+
/**
|
|
54
|
+
* The type that was expected.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* This is the branded type name (e.g., "U8", "U256", "U32LeBytes").
|
|
58
|
+
*
|
|
59
|
+
* @readonly
|
|
60
|
+
*/
|
|
61
|
+
expectedType;
|
|
62
|
+
/**
|
|
63
|
+
* Description of the constraint that was violated.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* This is `undefined` if only a type check failed (e.g., expected bigint, got string).
|
|
67
|
+
* It contains a human-readable constraint description when a value is out of range.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* - "0 <= value <= 255" for U8 range violations
|
|
71
|
+
* - "length === 32" for U256LeBytes length violations
|
|
72
|
+
* - "value >= 0" for negative unsigned integer attempts
|
|
73
|
+
*
|
|
74
|
+
* @readonly
|
|
75
|
+
*/
|
|
76
|
+
constraint;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new MathematicsAssertionError.
|
|
79
|
+
*
|
|
80
|
+
* @param message - Human-readable error message
|
|
81
|
+
* @param options - Error details
|
|
82
|
+
* @param options.value - The value that failed assertion
|
|
83
|
+
* @param options.expectedType - The expected type name
|
|
84
|
+
* @param options.constraint - Optional constraint description
|
|
85
|
+
*/
|
|
86
|
+
constructor(message, options) {
|
|
87
|
+
super(message);
|
|
88
|
+
this.name = "MathematicsAssertionError";
|
|
89
|
+
this.value = options.value;
|
|
90
|
+
this.expectedType = options.expectedType;
|
|
91
|
+
this.constraint = options.constraint;
|
|
92
|
+
Error.captureStackTrace(this, _MathematicsAssertionError);
|
|
93
|
+
Object.setPrototypeOf(this, _MathematicsAssertionError.prototype);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function assertBytes(value) {
|
|
97
|
+
if (!(value instanceof Uint8Array)) {
|
|
98
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
99
|
+
value,
|
|
100
|
+
expectedType: "Bytes"
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
chunkPK6SKIKE_cjs.__name(assertBytes, "assertBytes");
|
|
105
|
+
function assertLeBytes(value) {
|
|
106
|
+
if (!(value instanceof Uint8Array)) {
|
|
107
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
108
|
+
value,
|
|
109
|
+
expectedType: "LeBytes"
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
chunkPK6SKIKE_cjs.__name(assertLeBytes, "assertLeBytes");
|
|
114
|
+
function assertBeBytes(value) {
|
|
115
|
+
if (!(value instanceof Uint8Array)) {
|
|
116
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
117
|
+
value,
|
|
118
|
+
expectedType: "BeBytes"
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
chunkPK6SKIKE_cjs.__name(assertBeBytes, "assertBeBytes");
|
|
123
|
+
function assertU8LeBytes(value) {
|
|
124
|
+
if (!(value instanceof Uint8Array)) {
|
|
125
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
126
|
+
value,
|
|
127
|
+
expectedType: "U8LeBytes"
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (value.length !== U8_BYTE_LENGTH) {
|
|
131
|
+
throw new MathematicsAssertionError(
|
|
132
|
+
`Expected ${String(U8_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
133
|
+
{
|
|
134
|
+
value,
|
|
135
|
+
expectedType: "U8LeBytes",
|
|
136
|
+
constraint: `length === ${String(U8_BYTE_LENGTH)}`
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
chunkPK6SKIKE_cjs.__name(assertU8LeBytes, "assertU8LeBytes");
|
|
142
|
+
function assertU16LeBytes(value) {
|
|
143
|
+
if (!(value instanceof Uint8Array)) {
|
|
144
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
145
|
+
value,
|
|
146
|
+
expectedType: "U16LeBytes"
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (value.length !== U16_BYTE_LENGTH) {
|
|
150
|
+
throw new MathematicsAssertionError(
|
|
151
|
+
`Expected ${String(U16_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
152
|
+
{
|
|
153
|
+
value,
|
|
154
|
+
expectedType: "U16LeBytes",
|
|
155
|
+
constraint: `length === ${String(U16_BYTE_LENGTH)}`
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
chunkPK6SKIKE_cjs.__name(assertU16LeBytes, "assertU16LeBytes");
|
|
161
|
+
function assertU32LeBytes(value) {
|
|
162
|
+
if (!(value instanceof Uint8Array)) {
|
|
163
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
164
|
+
value,
|
|
165
|
+
expectedType: "U32LeBytes"
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (value.length !== U32_BYTE_LENGTH) {
|
|
169
|
+
throw new MathematicsAssertionError(
|
|
170
|
+
`Expected ${String(U32_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
171
|
+
{
|
|
172
|
+
value,
|
|
173
|
+
expectedType: "U32LeBytes",
|
|
174
|
+
constraint: `length === ${String(U32_BYTE_LENGTH)}`
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
chunkPK6SKIKE_cjs.__name(assertU32LeBytes, "assertU32LeBytes");
|
|
180
|
+
function assertU64LeBytes(value) {
|
|
181
|
+
if (!(value instanceof Uint8Array)) {
|
|
182
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
183
|
+
value,
|
|
184
|
+
expectedType: "U64LeBytes"
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (value.length !== U64_BYTE_LENGTH) {
|
|
188
|
+
throw new MathematicsAssertionError(
|
|
189
|
+
`Expected ${String(U64_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
190
|
+
{
|
|
191
|
+
value,
|
|
192
|
+
expectedType: "U64LeBytes",
|
|
193
|
+
constraint: `length === ${String(U64_BYTE_LENGTH)}`
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
chunkPK6SKIKE_cjs.__name(assertU64LeBytes, "assertU64LeBytes");
|
|
199
|
+
function assertU128LeBytes(value) {
|
|
200
|
+
if (!(value instanceof Uint8Array)) {
|
|
201
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
202
|
+
value,
|
|
203
|
+
expectedType: "U128LeBytes"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (value.length !== U128_BYTE_LENGTH) {
|
|
207
|
+
throw new MathematicsAssertionError(
|
|
208
|
+
`Expected ${String(U128_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
209
|
+
{
|
|
210
|
+
value,
|
|
211
|
+
expectedType: "U128LeBytes",
|
|
212
|
+
constraint: `length === ${String(U128_BYTE_LENGTH)}`
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
chunkPK6SKIKE_cjs.__name(assertU128LeBytes, "assertU128LeBytes");
|
|
218
|
+
function assertU256LeBytes(value) {
|
|
219
|
+
if (!(value instanceof Uint8Array)) {
|
|
220
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
221
|
+
value,
|
|
222
|
+
expectedType: "U256LeBytes"
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if (value.length !== U256_BYTE_LENGTH) {
|
|
226
|
+
throw new MathematicsAssertionError(
|
|
227
|
+
`Expected ${String(U256_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
228
|
+
{
|
|
229
|
+
value,
|
|
230
|
+
expectedType: "U256LeBytes",
|
|
231
|
+
constraint: `length === ${String(U256_BYTE_LENGTH)}`
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
chunkPK6SKIKE_cjs.__name(assertU256LeBytes, "assertU256LeBytes");
|
|
237
|
+
function assertU512LeBytes(value) {
|
|
238
|
+
if (!(value instanceof Uint8Array)) {
|
|
239
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
240
|
+
value,
|
|
241
|
+
expectedType: "U512LeBytes"
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (value.length !== U512_BYTE_LENGTH) {
|
|
245
|
+
throw new MathematicsAssertionError(
|
|
246
|
+
`Expected ${String(U512_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
247
|
+
{
|
|
248
|
+
value,
|
|
249
|
+
expectedType: "U512LeBytes",
|
|
250
|
+
constraint: `length === ${String(U512_BYTE_LENGTH)}`
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
chunkPK6SKIKE_cjs.__name(assertU512LeBytes, "assertU512LeBytes");
|
|
256
|
+
function assertU1024LeBytes(value) {
|
|
257
|
+
if (!(value instanceof Uint8Array)) {
|
|
258
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
259
|
+
value,
|
|
260
|
+
expectedType: "U1024LeBytes"
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
if (value.length !== U1024_BYTE_LENGTH) {
|
|
264
|
+
throw new MathematicsAssertionError(
|
|
265
|
+
`Expected ${String(U1024_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
266
|
+
{
|
|
267
|
+
value,
|
|
268
|
+
expectedType: "U1024LeBytes",
|
|
269
|
+
constraint: `length === ${String(U1024_BYTE_LENGTH)}`
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
chunkPK6SKIKE_cjs.__name(assertU1024LeBytes, "assertU1024LeBytes");
|
|
275
|
+
function assertU8BeBytes(value) {
|
|
276
|
+
if (!(value instanceof Uint8Array)) {
|
|
277
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
278
|
+
value,
|
|
279
|
+
expectedType: "U8BeBytes"
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
if (value.length !== U8_BYTE_LENGTH) {
|
|
283
|
+
throw new MathematicsAssertionError(
|
|
284
|
+
`Expected ${String(U8_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
285
|
+
{
|
|
286
|
+
value,
|
|
287
|
+
expectedType: "U8BeBytes",
|
|
288
|
+
constraint: `length === ${String(U8_BYTE_LENGTH)}`
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
chunkPK6SKIKE_cjs.__name(assertU8BeBytes, "assertU8BeBytes");
|
|
294
|
+
function assertU16BeBytes(value) {
|
|
295
|
+
if (!(value instanceof Uint8Array)) {
|
|
296
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
297
|
+
value,
|
|
298
|
+
expectedType: "U16BeBytes"
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (value.length !== U16_BYTE_LENGTH) {
|
|
302
|
+
throw new MathematicsAssertionError(
|
|
303
|
+
`Expected ${String(U16_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
304
|
+
{
|
|
305
|
+
value,
|
|
306
|
+
expectedType: "U16BeBytes",
|
|
307
|
+
constraint: `length === ${String(U16_BYTE_LENGTH)}`
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
chunkPK6SKIKE_cjs.__name(assertU16BeBytes, "assertU16BeBytes");
|
|
313
|
+
function assertU32BeBytes(value) {
|
|
314
|
+
if (!(value instanceof Uint8Array)) {
|
|
315
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
316
|
+
value,
|
|
317
|
+
expectedType: "U32BeBytes"
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
if (value.length !== U32_BYTE_LENGTH) {
|
|
321
|
+
throw new MathematicsAssertionError(
|
|
322
|
+
`Expected ${String(U32_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
323
|
+
{
|
|
324
|
+
value,
|
|
325
|
+
expectedType: "U32BeBytes",
|
|
326
|
+
constraint: `length === ${String(U32_BYTE_LENGTH)}`
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
chunkPK6SKIKE_cjs.__name(assertU32BeBytes, "assertU32BeBytes");
|
|
332
|
+
function assertU64BeBytes(value) {
|
|
333
|
+
if (!(value instanceof Uint8Array)) {
|
|
334
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
335
|
+
value,
|
|
336
|
+
expectedType: "U64BeBytes"
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (value.length !== U64_BYTE_LENGTH) {
|
|
340
|
+
throw new MathematicsAssertionError(
|
|
341
|
+
`Expected ${String(U64_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
342
|
+
{
|
|
343
|
+
value,
|
|
344
|
+
expectedType: "U64BeBytes",
|
|
345
|
+
constraint: `length === ${String(U64_BYTE_LENGTH)}`
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
chunkPK6SKIKE_cjs.__name(assertU64BeBytes, "assertU64BeBytes");
|
|
351
|
+
function assertU128BeBytes(value) {
|
|
352
|
+
if (!(value instanceof Uint8Array)) {
|
|
353
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
354
|
+
value,
|
|
355
|
+
expectedType: "U128BeBytes"
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
if (value.length !== U128_BYTE_LENGTH) {
|
|
359
|
+
throw new MathematicsAssertionError(
|
|
360
|
+
`Expected ${String(U128_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
361
|
+
{
|
|
362
|
+
value,
|
|
363
|
+
expectedType: "U128BeBytes",
|
|
364
|
+
constraint: `length === ${String(U128_BYTE_LENGTH)}`
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
chunkPK6SKIKE_cjs.__name(assertU128BeBytes, "assertU128BeBytes");
|
|
370
|
+
function assertU256BeBytes(value) {
|
|
371
|
+
if (!(value instanceof Uint8Array)) {
|
|
372
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
373
|
+
value,
|
|
374
|
+
expectedType: "U256BeBytes"
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
if (value.length !== U256_BYTE_LENGTH) {
|
|
378
|
+
throw new MathematicsAssertionError(
|
|
379
|
+
`Expected ${String(U256_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
380
|
+
{
|
|
381
|
+
value,
|
|
382
|
+
expectedType: "U256BeBytes",
|
|
383
|
+
constraint: `length === ${String(U256_BYTE_LENGTH)}`
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
chunkPK6SKIKE_cjs.__name(assertU256BeBytes, "assertU256BeBytes");
|
|
389
|
+
function assertU512BeBytes(value) {
|
|
390
|
+
if (!(value instanceof Uint8Array)) {
|
|
391
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
392
|
+
value,
|
|
393
|
+
expectedType: "U512BeBytes"
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
if (value.length !== U512_BYTE_LENGTH) {
|
|
397
|
+
throw new MathematicsAssertionError(
|
|
398
|
+
`Expected ${String(U512_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
399
|
+
{
|
|
400
|
+
value,
|
|
401
|
+
expectedType: "U512BeBytes",
|
|
402
|
+
constraint: `length === ${String(U512_BYTE_LENGTH)}`
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
chunkPK6SKIKE_cjs.__name(assertU512BeBytes, "assertU512BeBytes");
|
|
408
|
+
function assertU1024BeBytes(value) {
|
|
409
|
+
if (!(value instanceof Uint8Array)) {
|
|
410
|
+
throw new MathematicsAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
411
|
+
value,
|
|
412
|
+
expectedType: "U1024BeBytes"
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (value.length !== U1024_BYTE_LENGTH) {
|
|
416
|
+
throw new MathematicsAssertionError(
|
|
417
|
+
`Expected ${String(U1024_BYTE_LENGTH)} byte(s), got ${String(value.length)}`,
|
|
418
|
+
{
|
|
419
|
+
value,
|
|
420
|
+
expectedType: "U1024BeBytes",
|
|
421
|
+
constraint: `length === ${String(U1024_BYTE_LENGTH)}`
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
chunkPK6SKIKE_cjs.__name(assertU1024BeBytes, "assertU1024BeBytes");
|
|
427
|
+
function assertUnsignedInteger(value) {
|
|
428
|
+
if (typeof value !== "bigint") {
|
|
429
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
430
|
+
value,
|
|
431
|
+
expectedType: "UnsignedInteger"
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
if (value < 0n) {
|
|
435
|
+
throw new MathematicsAssertionError(`Expected non-negative value, got ${String(value)}`, {
|
|
436
|
+
value,
|
|
437
|
+
expectedType: "UnsignedInteger",
|
|
438
|
+
constraint: "value >= 0"
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
chunkPK6SKIKE_cjs.__name(assertUnsignedInteger, "assertUnsignedInteger");
|
|
443
|
+
function assertSignedInteger(value) {
|
|
444
|
+
if (typeof value !== "bigint") {
|
|
445
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
446
|
+
value,
|
|
447
|
+
expectedType: "SignedInteger"
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
chunkPK6SKIKE_cjs.__name(assertSignedInteger, "assertSignedInteger");
|
|
452
|
+
function assertU8(value) {
|
|
453
|
+
if (typeof value !== "bigint") {
|
|
454
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
455
|
+
value,
|
|
456
|
+
expectedType: "U8"
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
if (value < 0n || value > U8_MAX) {
|
|
460
|
+
throw new MathematicsAssertionError(
|
|
461
|
+
`Value ${String(value)} is out of range for U8 [0, ${String(U8_MAX)}]`,
|
|
462
|
+
{
|
|
463
|
+
value,
|
|
464
|
+
expectedType: "U8",
|
|
465
|
+
constraint: `0 <= value <= ${String(U8_MAX)}`
|
|
466
|
+
}
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
chunkPK6SKIKE_cjs.__name(assertU8, "assertU8");
|
|
471
|
+
function assertU16(value) {
|
|
472
|
+
if (typeof value !== "bigint") {
|
|
473
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
474
|
+
value,
|
|
475
|
+
expectedType: "U16"
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
if (value < 0n || value > U16_MAX) {
|
|
479
|
+
throw new MathematicsAssertionError(
|
|
480
|
+
`Value ${String(value)} is out of range for U16 [0, ${String(U16_MAX)}]`,
|
|
481
|
+
{
|
|
482
|
+
value,
|
|
483
|
+
expectedType: "U16",
|
|
484
|
+
constraint: `0 <= value <= ${String(U16_MAX)}`
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
chunkPK6SKIKE_cjs.__name(assertU16, "assertU16");
|
|
490
|
+
function assertU32(value) {
|
|
491
|
+
if (typeof value !== "bigint") {
|
|
492
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
493
|
+
value,
|
|
494
|
+
expectedType: "U32"
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
if (value < 0n || value > U32_MAX) {
|
|
498
|
+
throw new MathematicsAssertionError(
|
|
499
|
+
`Value ${String(value)} is out of range for U32 [0, ${String(U32_MAX)}]`,
|
|
500
|
+
{
|
|
501
|
+
value,
|
|
502
|
+
expectedType: "U32",
|
|
503
|
+
constraint: `0 <= value <= ${String(U32_MAX)}`
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
chunkPK6SKIKE_cjs.__name(assertU32, "assertU32");
|
|
509
|
+
function assertU64(value, name = "value") {
|
|
510
|
+
if (typeof value !== "bigint") {
|
|
511
|
+
throw new MathematicsAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
512
|
+
value,
|
|
513
|
+
expectedType: "U64"
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
if (value < 0n || value > U64_MAX) {
|
|
517
|
+
throw new MathematicsAssertionError(
|
|
518
|
+
`${name}: Value ${String(value)} is out of range for U64 [0, ${String(U64_MAX)}]`,
|
|
519
|
+
{
|
|
520
|
+
value,
|
|
521
|
+
expectedType: "U64",
|
|
522
|
+
constraint: `0 <= value <= ${String(U64_MAX)}`
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
chunkPK6SKIKE_cjs.__name(assertU64, "assertU64");
|
|
528
|
+
function assertU128(value, name = "value") {
|
|
529
|
+
if (typeof value !== "bigint") {
|
|
530
|
+
throw new MathematicsAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
531
|
+
value,
|
|
532
|
+
expectedType: "U128"
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
if (value < 0n || value > U128_MAX) {
|
|
536
|
+
throw new MathematicsAssertionError(
|
|
537
|
+
`${name}: Value ${String(value)} is out of range for U128 [0, 2^128 - 1]`,
|
|
538
|
+
{
|
|
539
|
+
value,
|
|
540
|
+
expectedType: "U128",
|
|
541
|
+
constraint: "0 <= value <= 2^128 - 1"
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
chunkPK6SKIKE_cjs.__name(assertU128, "assertU128");
|
|
547
|
+
function assertU256(value, name = "value") {
|
|
548
|
+
if (typeof value !== "bigint") {
|
|
549
|
+
throw new MathematicsAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
550
|
+
value,
|
|
551
|
+
expectedType: "U256"
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
if (value < 0n || value > U256_MAX) {
|
|
555
|
+
throw new MathematicsAssertionError(
|
|
556
|
+
`${name}: Value ${String(value)} is out of range for U256 [0, 2^256 - 1]`,
|
|
557
|
+
{
|
|
558
|
+
value,
|
|
559
|
+
expectedType: "U256",
|
|
560
|
+
constraint: "0 <= value <= 2^256 - 1"
|
|
561
|
+
}
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
chunkPK6SKIKE_cjs.__name(assertU256, "assertU256");
|
|
566
|
+
function assertU512(value) {
|
|
567
|
+
if (typeof value !== "bigint") {
|
|
568
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
569
|
+
value,
|
|
570
|
+
expectedType: "U512"
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
if (value < 0n || value > U512_MAX) {
|
|
574
|
+
throw new MathematicsAssertionError(
|
|
575
|
+
`Value ${String(value)} is out of range for U512 [0, 2^512 - 1]`,
|
|
576
|
+
{
|
|
577
|
+
value,
|
|
578
|
+
expectedType: "U512",
|
|
579
|
+
constraint: "0 <= value <= 2^512 - 1"
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
chunkPK6SKIKE_cjs.__name(assertU512, "assertU512");
|
|
585
|
+
function assertU1024(value) {
|
|
586
|
+
if (typeof value !== "bigint") {
|
|
587
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
588
|
+
value,
|
|
589
|
+
expectedType: "U1024"
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
if (value < 0n || value > U1024_MAX) {
|
|
593
|
+
throw new MathematicsAssertionError(
|
|
594
|
+
`Value ${String(value)} is out of range for U1024 [0, 2^1024 - 1]`,
|
|
595
|
+
{
|
|
596
|
+
value,
|
|
597
|
+
expectedType: "U1024",
|
|
598
|
+
constraint: "0 <= value <= 2^1024 - 1"
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
chunkPK6SKIKE_cjs.__name(assertU1024, "assertU1024");
|
|
604
|
+
function assertI8(value) {
|
|
605
|
+
if (typeof value !== "bigint") {
|
|
606
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
607
|
+
value,
|
|
608
|
+
expectedType: "I8"
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
if (value < I8_MIN || value > I8_MAX) {
|
|
612
|
+
throw new MathematicsAssertionError(
|
|
613
|
+
`Value ${String(value)} is out of range for I8 [${String(I8_MIN)}, ${String(I8_MAX)}]`,
|
|
614
|
+
{
|
|
615
|
+
value,
|
|
616
|
+
expectedType: "I8",
|
|
617
|
+
constraint: `${String(I8_MIN)} <= value <= ${String(I8_MAX)}`
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
chunkPK6SKIKE_cjs.__name(assertI8, "assertI8");
|
|
623
|
+
function assertI16(value) {
|
|
624
|
+
if (typeof value !== "bigint") {
|
|
625
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
626
|
+
value,
|
|
627
|
+
expectedType: "I16"
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
if (value < I16_MIN || value > I16_MAX) {
|
|
631
|
+
throw new MathematicsAssertionError(
|
|
632
|
+
`Value ${String(value)} is out of range for I16 [${String(I16_MIN)}, ${String(I16_MAX)}]`,
|
|
633
|
+
{
|
|
634
|
+
value,
|
|
635
|
+
expectedType: "I16",
|
|
636
|
+
constraint: `${String(I16_MIN)} <= value <= ${String(I16_MAX)}`
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
chunkPK6SKIKE_cjs.__name(assertI16, "assertI16");
|
|
642
|
+
function assertI32(value) {
|
|
643
|
+
if (typeof value !== "bigint") {
|
|
644
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
645
|
+
value,
|
|
646
|
+
expectedType: "I32"
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
if (value < I32_MIN || value > I32_MAX) {
|
|
650
|
+
throw new MathematicsAssertionError(
|
|
651
|
+
`Value ${String(value)} is out of range for I32 [${String(I32_MIN)}, ${String(I32_MAX)}]`,
|
|
652
|
+
{
|
|
653
|
+
value,
|
|
654
|
+
expectedType: "I32",
|
|
655
|
+
constraint: `${String(I32_MIN)} <= value <= ${String(I32_MAX)}`
|
|
656
|
+
}
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
chunkPK6SKIKE_cjs.__name(assertI32, "assertI32");
|
|
661
|
+
function assertI64(value) {
|
|
662
|
+
if (typeof value !== "bigint") {
|
|
663
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
664
|
+
value,
|
|
665
|
+
expectedType: "I64"
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
if (value < I64_MIN || value > I64_MAX) {
|
|
669
|
+
throw new MathematicsAssertionError(
|
|
670
|
+
`Value ${String(value)} is out of range for I64 [-2^63, 2^63 - 1]`,
|
|
671
|
+
{
|
|
672
|
+
value,
|
|
673
|
+
expectedType: "I64",
|
|
674
|
+
constraint: "-2^63 <= value <= 2^63 - 1"
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
chunkPK6SKIKE_cjs.__name(assertI64, "assertI64");
|
|
680
|
+
function assertI128(value) {
|
|
681
|
+
if (typeof value !== "bigint") {
|
|
682
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
683
|
+
value,
|
|
684
|
+
expectedType: "I128"
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
if (value < I128_MIN || value > I128_MAX) {
|
|
688
|
+
throw new MathematicsAssertionError(
|
|
689
|
+
`Value ${String(value)} is out of range for I128 [-2^127, 2^127 - 1]`,
|
|
690
|
+
{
|
|
691
|
+
value,
|
|
692
|
+
expectedType: "I128",
|
|
693
|
+
constraint: "-2^127 <= value <= 2^127 - 1"
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
chunkPK6SKIKE_cjs.__name(assertI128, "assertI128");
|
|
699
|
+
function assertI256(value) {
|
|
700
|
+
if (typeof value !== "bigint") {
|
|
701
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
702
|
+
value,
|
|
703
|
+
expectedType: "I256"
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
if (value < I256_MIN || value > I256_MAX) {
|
|
707
|
+
throw new MathematicsAssertionError(
|
|
708
|
+
`Value ${String(value)} is out of range for I256 [-2^255, 2^255 - 1]`,
|
|
709
|
+
{
|
|
710
|
+
value,
|
|
711
|
+
expectedType: "I256",
|
|
712
|
+
constraint: "-2^255 <= value <= 2^255 - 1"
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
chunkPK6SKIKE_cjs.__name(assertI256, "assertI256");
|
|
718
|
+
function assertI512(value) {
|
|
719
|
+
if (typeof value !== "bigint") {
|
|
720
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
721
|
+
value,
|
|
722
|
+
expectedType: "I512"
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
if (value < I512_MIN || value > I512_MAX) {
|
|
726
|
+
throw new MathematicsAssertionError(
|
|
727
|
+
`Value ${String(value)} is out of range for I512 [-2^511, 2^511 - 1]`,
|
|
728
|
+
{
|
|
729
|
+
value,
|
|
730
|
+
expectedType: "I512",
|
|
731
|
+
constraint: "-2^511 <= value <= 2^511 - 1"
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
chunkPK6SKIKE_cjs.__name(assertI512, "assertI512");
|
|
737
|
+
function assertI1024(value) {
|
|
738
|
+
if (typeof value !== "bigint") {
|
|
739
|
+
throw new MathematicsAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
740
|
+
value,
|
|
741
|
+
expectedType: "I1024"
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
if (value < I1024_MIN || value > I1024_MAX) {
|
|
745
|
+
throw new MathematicsAssertionError(
|
|
746
|
+
`Value ${String(value)} is out of range for I1024 [-2^1023, 2^1023 - 1]`,
|
|
747
|
+
{
|
|
748
|
+
value,
|
|
749
|
+
expectedType: "I1024",
|
|
750
|
+
constraint: "-2^1023 <= value <= 2^1023 - 1"
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
chunkPK6SKIKE_cjs.__name(assertI1024, "assertI1024");
|
|
756
|
+
|
|
757
|
+
// src/types/cryptography.ts
|
|
758
|
+
var BN254_FIELD_PRIME = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
|
|
759
|
+
var CURVE25519_FIELD_PRIME = (1n << 255n) - 19n;
|
|
760
|
+
var CryptographyAssertionError = class _CryptographyAssertionError extends Error {
|
|
761
|
+
static {
|
|
762
|
+
chunkPK6SKIKE_cjs.__name(this, "CryptographyAssertionError");
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* The actual value that failed the assertion.
|
|
766
|
+
* @readonly
|
|
767
|
+
*/
|
|
768
|
+
value;
|
|
769
|
+
/**
|
|
770
|
+
* The type that was expected (e.g., "Bn254FieldElement", "PoseidonKey").
|
|
771
|
+
* @readonly
|
|
772
|
+
*/
|
|
773
|
+
expectedType;
|
|
774
|
+
/**
|
|
775
|
+
* Description of the constraint that was violated.
|
|
776
|
+
*
|
|
777
|
+
* @remarks
|
|
778
|
+
* Will be `undefined` when the failure is purely a type mismatch (e.g., received a string
|
|
779
|
+
* instead of a bigint). Contains a human-readable range or length constraint when the value
|
|
780
|
+
* was the correct type but out of the valid range.
|
|
781
|
+
*
|
|
782
|
+
* @example `"value >= 0"`, `"value < BN254_FIELD_PRIME"`, `"length === 32"`
|
|
783
|
+
* @readonly
|
|
784
|
+
*/
|
|
785
|
+
constraint;
|
|
786
|
+
/**
|
|
787
|
+
* Creates a new CryptographyAssertionError.
|
|
788
|
+
*
|
|
789
|
+
* @param message - Human-readable error message describing what went wrong
|
|
790
|
+
* @param options - Structured error details for programmatic inspection
|
|
791
|
+
* @param options.value - The value that failed the assertion
|
|
792
|
+
* @param options.expectedType - Name of the branded type that was expected
|
|
793
|
+
* @param options.constraint - Optional human-readable constraint that was violated
|
|
794
|
+
*/
|
|
795
|
+
constructor(message, options) {
|
|
796
|
+
super(message);
|
|
797
|
+
this.name = "CryptographyAssertionError";
|
|
798
|
+
this.value = options.value;
|
|
799
|
+
this.expectedType = options.expectedType;
|
|
800
|
+
this.constraint = options.constraint;
|
|
801
|
+
Error.captureStackTrace(this, _CryptographyAssertionError);
|
|
802
|
+
Object.setPrototypeOf(this, _CryptographyAssertionError.prototype);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
var X25519_BYTE_LENGTH = 32;
|
|
806
|
+
function assertBn254FieldElement(value, name = "value") {
|
|
807
|
+
if (typeof value !== "bigint") {
|
|
808
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
809
|
+
value,
|
|
810
|
+
expectedType: "Bn254FieldElement"
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
if (value < 0n) {
|
|
814
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
815
|
+
value,
|
|
816
|
+
expectedType: "Bn254FieldElement",
|
|
817
|
+
constraint: "value >= 0"
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
821
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds BN254 field prime`, {
|
|
822
|
+
value,
|
|
823
|
+
expectedType: "Bn254FieldElement",
|
|
824
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
chunkPK6SKIKE_cjs.__name(assertBn254FieldElement, "assertBn254FieldElement");
|
|
829
|
+
function assertCurve25519FieldElement(value, name = "value") {
|
|
830
|
+
if (typeof value !== "bigint") {
|
|
831
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
832
|
+
value,
|
|
833
|
+
expectedType: "Curve25519FieldElement"
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
if (value < 0n) {
|
|
837
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
838
|
+
value,
|
|
839
|
+
expectedType: "Curve25519FieldElement",
|
|
840
|
+
constraint: "value >= 0"
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
if (value >= CURVE25519_FIELD_PRIME) {
|
|
844
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds Curve25519 field prime`, {
|
|
845
|
+
value,
|
|
846
|
+
expectedType: "Curve25519FieldElement",
|
|
847
|
+
constraint: "value < 2^255 - 19"
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
chunkPK6SKIKE_cjs.__name(assertCurve25519FieldElement, "assertCurve25519FieldElement");
|
|
852
|
+
function assertX25519Bytes(value) {
|
|
853
|
+
if (!(value instanceof Uint8Array)) {
|
|
854
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
855
|
+
value,
|
|
856
|
+
expectedType: "X25519Bytes"
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
if (value.length !== X25519_BYTE_LENGTH) {
|
|
860
|
+
throw new CryptographyAssertionError(
|
|
861
|
+
`Expected ${String(X25519_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
862
|
+
{
|
|
863
|
+
value,
|
|
864
|
+
expectedType: "X25519Bytes",
|
|
865
|
+
constraint: `length === ${String(X25519_BYTE_LENGTH)}`
|
|
866
|
+
}
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
chunkPK6SKIKE_cjs.__name(assertX25519Bytes, "assertX25519Bytes");
|
|
871
|
+
function assertX25519PrivateKey(value) {
|
|
872
|
+
if (!(value instanceof Uint8Array)) {
|
|
873
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
874
|
+
value,
|
|
875
|
+
expectedType: "X25519PrivateKey"
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (value.length !== X25519_BYTE_LENGTH) {
|
|
879
|
+
throw new CryptographyAssertionError(
|
|
880
|
+
`Expected ${String(X25519_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
881
|
+
{
|
|
882
|
+
value,
|
|
883
|
+
expectedType: "X25519PrivateKey",
|
|
884
|
+
constraint: `length === ${String(X25519_BYTE_LENGTH)}`
|
|
885
|
+
}
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
chunkPK6SKIKE_cjs.__name(assertX25519PrivateKey, "assertX25519PrivateKey");
|
|
890
|
+
function assertX25519PublicKey(value) {
|
|
891
|
+
if (!(value instanceof Uint8Array)) {
|
|
892
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
893
|
+
value,
|
|
894
|
+
expectedType: "X25519PublicKey"
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
if (value.length !== X25519_BYTE_LENGTH) {
|
|
898
|
+
throw new CryptographyAssertionError(
|
|
899
|
+
`Expected ${String(X25519_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
900
|
+
{
|
|
901
|
+
value,
|
|
902
|
+
expectedType: "X25519PublicKey",
|
|
903
|
+
constraint: `length === ${String(X25519_BYTE_LENGTH)}`
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
chunkPK6SKIKE_cjs.__name(assertX25519PublicKey, "assertX25519PublicKey");
|
|
909
|
+
function assertSharedSecret(value) {
|
|
910
|
+
if (!(value instanceof Uint8Array)) {
|
|
911
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
912
|
+
value,
|
|
913
|
+
expectedType: "SharedSecret"
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
if (value.length !== X25519_BYTE_LENGTH) {
|
|
917
|
+
throw new CryptographyAssertionError(
|
|
918
|
+
`Expected ${String(X25519_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
919
|
+
{
|
|
920
|
+
value,
|
|
921
|
+
expectedType: "SharedSecret",
|
|
922
|
+
constraint: `length === ${String(X25519_BYTE_LENGTH)}`
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
chunkPK6SKIKE_cjs.__name(assertSharedSecret, "assertSharedSecret");
|
|
928
|
+
function assertPoseidonPlaintext(value) {
|
|
929
|
+
if (typeof value !== "bigint") {
|
|
930
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
931
|
+
value,
|
|
932
|
+
expectedType: "PoseidonPlaintext"
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
if (value < 0n) {
|
|
936
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
937
|
+
value,
|
|
938
|
+
expectedType: "PoseidonPlaintext",
|
|
939
|
+
constraint: "value >= 0"
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
943
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
944
|
+
value,
|
|
945
|
+
expectedType: "PoseidonPlaintext",
|
|
946
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
chunkPK6SKIKE_cjs.__name(assertPoseidonPlaintext, "assertPoseidonPlaintext");
|
|
951
|
+
function assertPoseidonHash(value) {
|
|
952
|
+
if (typeof value !== "bigint") {
|
|
953
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
954
|
+
value,
|
|
955
|
+
expectedType: "PoseidonHash"
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
if (value < 0n) {
|
|
959
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
960
|
+
value,
|
|
961
|
+
expectedType: "PoseidonHash",
|
|
962
|
+
constraint: "value >= 0"
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
966
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
967
|
+
value,
|
|
968
|
+
expectedType: "PoseidonHash",
|
|
969
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
chunkPK6SKIKE_cjs.__name(assertPoseidonHash, "assertPoseidonHash");
|
|
974
|
+
function assertPoseidonKey(value) {
|
|
975
|
+
if (typeof value !== "bigint") {
|
|
976
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
977
|
+
value,
|
|
978
|
+
expectedType: "PoseidonKey"
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
if (value < 0n) {
|
|
982
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
983
|
+
value,
|
|
984
|
+
expectedType: "PoseidonKey",
|
|
985
|
+
constraint: "value >= 0"
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
989
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
990
|
+
value,
|
|
991
|
+
expectedType: "PoseidonKey",
|
|
992
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
chunkPK6SKIKE_cjs.__name(assertPoseidonKey, "assertPoseidonKey");
|
|
997
|
+
function assertPoseidonCiphertext(value) {
|
|
998
|
+
if (typeof value !== "bigint") {
|
|
999
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1000
|
+
value,
|
|
1001
|
+
expectedType: "PoseidonCiphertext"
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
if (value < 0n) {
|
|
1005
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
1006
|
+
value,
|
|
1007
|
+
expectedType: "PoseidonCiphertext",
|
|
1008
|
+
constraint: "value >= 0"
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
1012
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
1013
|
+
value,
|
|
1014
|
+
expectedType: "PoseidonCiphertext",
|
|
1015
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
chunkPK6SKIKE_cjs.__name(assertPoseidonCiphertext, "assertPoseidonCiphertext");
|
|
1020
|
+
function assertPoseidonCounter(value) {
|
|
1021
|
+
if (typeof value !== "bigint") {
|
|
1022
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1023
|
+
value,
|
|
1024
|
+
expectedType: "PoseidonCounter"
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
if (value < 0n) {
|
|
1028
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
1029
|
+
value,
|
|
1030
|
+
expectedType: "PoseidonCounter",
|
|
1031
|
+
constraint: "value >= 0"
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
1035
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
1036
|
+
value,
|
|
1037
|
+
expectedType: "PoseidonCounter",
|
|
1038
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
chunkPK6SKIKE_cjs.__name(assertPoseidonCounter, "assertPoseidonCounter");
|
|
1043
|
+
function assertPoseidonKeystream(value) {
|
|
1044
|
+
if (typeof value !== "bigint") {
|
|
1045
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1046
|
+
value,
|
|
1047
|
+
expectedType: "PoseidonKeystream"
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
if (value < 0n) {
|
|
1051
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
1052
|
+
value,
|
|
1053
|
+
expectedType: "PoseidonKeystream",
|
|
1054
|
+
constraint: "value >= 0"
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
1058
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
1059
|
+
value,
|
|
1060
|
+
expectedType: "PoseidonKeystream",
|
|
1061
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
chunkPK6SKIKE_cjs.__name(assertPoseidonKeystream, "assertPoseidonKeystream");
|
|
1066
|
+
function assertRcCiphertext(value, name = "value") {
|
|
1067
|
+
if (typeof value !== "bigint") {
|
|
1068
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
1069
|
+
value,
|
|
1070
|
+
expectedType: "RcCiphertext"
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
if (value < 0n) {
|
|
1074
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
1075
|
+
value,
|
|
1076
|
+
expectedType: "RcCiphertext",
|
|
1077
|
+
constraint: "value >= 0"
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
if (value >= CURVE25519_FIELD_PRIME) {
|
|
1081
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds Curve25519 field prime`, {
|
|
1082
|
+
value,
|
|
1083
|
+
expectedType: "RcCiphertext",
|
|
1084
|
+
constraint: "value < 2^255 - 19"
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
chunkPK6SKIKE_cjs.__name(assertRcCiphertext, "assertRcCiphertext");
|
|
1089
|
+
function assertRcPlaintext(value, name = "value") {
|
|
1090
|
+
if (typeof value !== "bigint") {
|
|
1091
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
1092
|
+
value,
|
|
1093
|
+
expectedType: "RcPlaintext"
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
if (value < 0n) {
|
|
1097
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
1098
|
+
value,
|
|
1099
|
+
expectedType: "RcPlaintext",
|
|
1100
|
+
constraint: "value >= 0"
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
if (value >= CURVE25519_FIELD_PRIME) {
|
|
1104
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds Curve25519 field prime`, {
|
|
1105
|
+
value,
|
|
1106
|
+
expectedType: "RcPlaintext",
|
|
1107
|
+
constraint: "value < 2^255 - 19"
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
chunkPK6SKIKE_cjs.__name(assertRcPlaintext, "assertRcPlaintext");
|
|
1112
|
+
function assertRcKey(value, name = "value") {
|
|
1113
|
+
if (typeof value !== "bigint") {
|
|
1114
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
1115
|
+
value,
|
|
1116
|
+
expectedType: "RcKey"
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
if (value < 0n) {
|
|
1120
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
1121
|
+
value,
|
|
1122
|
+
expectedType: "RcKey",
|
|
1123
|
+
constraint: "value >= 0"
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
if (value >= CURVE25519_FIELD_PRIME) {
|
|
1127
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds Curve25519 field prime`, {
|
|
1128
|
+
value,
|
|
1129
|
+
expectedType: "RcKey",
|
|
1130
|
+
constraint: "value < 2^255 - 19"
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
chunkPK6SKIKE_cjs.__name(assertRcKey, "assertRcKey");
|
|
1135
|
+
function assertRcCounter(value) {
|
|
1136
|
+
if (typeof value !== "bigint") {
|
|
1137
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1138
|
+
value,
|
|
1139
|
+
expectedType: "RcCounter"
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
if (value < 0n) {
|
|
1143
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
1144
|
+
value,
|
|
1145
|
+
expectedType: "RcCounter",
|
|
1146
|
+
constraint: "value >= 0"
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
if (value >= CURVE25519_FIELD_PRIME) {
|
|
1150
|
+
throw new CryptographyAssertionError(`Value exceeds Curve25519 field prime`, {
|
|
1151
|
+
value,
|
|
1152
|
+
expectedType: "RcCounter",
|
|
1153
|
+
constraint: "value < 2^255 - 19"
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
chunkPK6SKIKE_cjs.__name(assertRcCounter, "assertRcCounter");
|
|
1158
|
+
function assertRcEncryptionNonce(value, name = "value") {
|
|
1159
|
+
if (typeof value !== "bigint") {
|
|
1160
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
1161
|
+
value,
|
|
1162
|
+
expectedType: "RcEncryptionNonce"
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
if (value < 0n) {
|
|
1166
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
1167
|
+
value,
|
|
1168
|
+
expectedType: "RcEncryptionNonce",
|
|
1169
|
+
constraint: "value >= 0"
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
if (value > U128_MAX) {
|
|
1173
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds U128 maximum`, {
|
|
1174
|
+
value,
|
|
1175
|
+
expectedType: "RcEncryptionNonce",
|
|
1176
|
+
constraint: "value <= 2^128 - 1"
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
chunkPK6SKIKE_cjs.__name(assertRcEncryptionNonce, "assertRcEncryptionNonce");
|
|
1181
|
+
function assertKeccak256Hash(value) {
|
|
1182
|
+
if (!(value instanceof Uint8Array)) {
|
|
1183
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1184
|
+
value,
|
|
1185
|
+
expectedType: "Keccak256Hash"
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
if (value.length !== U256_BYTE_LENGTH) {
|
|
1189
|
+
throw new CryptographyAssertionError(
|
|
1190
|
+
`Expected ${String(U256_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1191
|
+
{
|
|
1192
|
+
value,
|
|
1193
|
+
expectedType: "Keccak256Hash",
|
|
1194
|
+
constraint: `length === ${String(U256_BYTE_LENGTH)}`
|
|
1195
|
+
}
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
chunkPK6SKIKE_cjs.__name(assertKeccak256Hash, "assertKeccak256Hash");
|
|
1200
|
+
function assertKeccak512Hash(value) {
|
|
1201
|
+
if (!(value instanceof Uint8Array)) {
|
|
1202
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1203
|
+
value,
|
|
1204
|
+
expectedType: "Keccak512Hash"
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
if (value.length !== U512_BYTE_LENGTH) {
|
|
1208
|
+
throw new CryptographyAssertionError(
|
|
1209
|
+
`Expected ${String(U512_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1210
|
+
{
|
|
1211
|
+
value,
|
|
1212
|
+
expectedType: "Keccak512Hash",
|
|
1213
|
+
constraint: `length === ${String(U512_BYTE_LENGTH)}`
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
chunkPK6SKIKE_cjs.__name(assertKeccak512Hash, "assertKeccak512Hash");
|
|
1219
|
+
function assertMasterSeed(value) {
|
|
1220
|
+
if (!(value instanceof Uint8Array)) {
|
|
1221
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1222
|
+
value,
|
|
1223
|
+
expectedType: "MasterSeed"
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
if (value.length !== U512_BYTE_LENGTH) {
|
|
1227
|
+
throw new CryptographyAssertionError(
|
|
1228
|
+
`Expected ${String(U512_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1229
|
+
{
|
|
1230
|
+
value,
|
|
1231
|
+
expectedType: "MasterSeed",
|
|
1232
|
+
constraint: `length === ${String(U512_BYTE_LENGTH)}`
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
chunkPK6SKIKE_cjs.__name(assertMasterSeed, "assertMasterSeed");
|
|
1238
|
+
function assertGenerationSeed(value) {
|
|
1239
|
+
if (!(value instanceof Uint8Array)) {
|
|
1240
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1241
|
+
value,
|
|
1242
|
+
expectedType: "GenerationSeed"
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
if (value.length !== U512_BYTE_LENGTH) {
|
|
1246
|
+
throw new CryptographyAssertionError(
|
|
1247
|
+
`Expected ${String(U512_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1248
|
+
{
|
|
1249
|
+
value,
|
|
1250
|
+
expectedType: "GenerationSeed",
|
|
1251
|
+
constraint: `length === ${String(U512_BYTE_LENGTH)}`
|
|
1252
|
+
}
|
|
1253
|
+
);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
chunkPK6SKIKE_cjs.__name(assertGenerationSeed, "assertGenerationSeed");
|
|
1257
|
+
function assertMasterViewingKey(value) {
|
|
1258
|
+
if (typeof value !== "bigint") {
|
|
1259
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1260
|
+
value,
|
|
1261
|
+
expectedType: "MasterViewingKey"
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
if (value < 0n) {
|
|
1265
|
+
throw new CryptographyAssertionError(`Value ${String(value)} is negative`, {
|
|
1266
|
+
value,
|
|
1267
|
+
expectedType: "MasterViewingKey",
|
|
1268
|
+
constraint: "value >= 0"
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
if (value >= BN254_FIELD_PRIME) {
|
|
1272
|
+
throw new CryptographyAssertionError(`Value exceeds BN254 field prime`, {
|
|
1273
|
+
value,
|
|
1274
|
+
expectedType: "MasterViewingKey",
|
|
1275
|
+
constraint: `value < ${String(BN254_FIELD_PRIME)}`
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
chunkPK6SKIKE_cjs.__name(assertMasterViewingKey, "assertMasterViewingKey");
|
|
1280
|
+
function assertYearlyViewingKey(value) {
|
|
1281
|
+
if (typeof value !== "bigint") {
|
|
1282
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1283
|
+
value,
|
|
1284
|
+
expectedType: "YearlyViewingKey"
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1288
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1289
|
+
value,
|
|
1290
|
+
expectedType: "YearlyViewingKey",
|
|
1291
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
chunkPK6SKIKE_cjs.__name(assertYearlyViewingKey, "assertYearlyViewingKey");
|
|
1296
|
+
function assertMonthlyViewingKey(value) {
|
|
1297
|
+
if (typeof value !== "bigint") {
|
|
1298
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1299
|
+
value,
|
|
1300
|
+
expectedType: "MonthlyViewingKey"
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1304
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1305
|
+
value,
|
|
1306
|
+
expectedType: "MonthlyViewingKey",
|
|
1307
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
chunkPK6SKIKE_cjs.__name(assertMonthlyViewingKey, "assertMonthlyViewingKey");
|
|
1312
|
+
function assertDailyViewingKey(value) {
|
|
1313
|
+
if (typeof value !== "bigint") {
|
|
1314
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1315
|
+
value,
|
|
1316
|
+
expectedType: "DailyViewingKey"
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1320
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1321
|
+
value,
|
|
1322
|
+
expectedType: "DailyViewingKey",
|
|
1323
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
chunkPK6SKIKE_cjs.__name(assertDailyViewingKey, "assertDailyViewingKey");
|
|
1328
|
+
function assertHourlyViewingKey(value) {
|
|
1329
|
+
if (typeof value !== "bigint") {
|
|
1330
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1331
|
+
value,
|
|
1332
|
+
expectedType: "HourlyViewingKey"
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1336
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1337
|
+
value,
|
|
1338
|
+
expectedType: "HourlyViewingKey",
|
|
1339
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
chunkPK6SKIKE_cjs.__name(assertHourlyViewingKey, "assertHourlyViewingKey");
|
|
1344
|
+
function assertMinuteViewingKey(value) {
|
|
1345
|
+
if (typeof value !== "bigint") {
|
|
1346
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1347
|
+
value,
|
|
1348
|
+
expectedType: "MinuteViewingKey"
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1352
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1353
|
+
value,
|
|
1354
|
+
expectedType: "MinuteViewingKey",
|
|
1355
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
chunkPK6SKIKE_cjs.__name(assertMinuteViewingKey, "assertMinuteViewingKey");
|
|
1360
|
+
function assertSecondViewingKey(value) {
|
|
1361
|
+
if (typeof value !== "bigint") {
|
|
1362
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1363
|
+
value,
|
|
1364
|
+
expectedType: "SecondViewingKey"
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1368
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1369
|
+
value,
|
|
1370
|
+
expectedType: "SecondViewingKey",
|
|
1371
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
chunkPK6SKIKE_cjs.__name(assertSecondViewingKey, "assertSecondViewingKey");
|
|
1376
|
+
function assertMintViewingKey(value) {
|
|
1377
|
+
if (typeof value !== "bigint") {
|
|
1378
|
+
throw new CryptographyAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1379
|
+
value,
|
|
1380
|
+
expectedType: "MintViewingKey"
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
if (value < 0n || value >= BN254_FIELD_PRIME) {
|
|
1384
|
+
throw new CryptographyAssertionError(`Value out of BN254 field range`, {
|
|
1385
|
+
value,
|
|
1386
|
+
expectedType: "MintViewingKey",
|
|
1387
|
+
constraint: `0 <= value < ${String(BN254_FIELD_PRIME)}`
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
chunkPK6SKIKE_cjs.__name(assertMintViewingKey, "assertMintViewingKey");
|
|
1392
|
+
function assertX25519Keypair(value) {
|
|
1393
|
+
if (!("privateKey" in value) || !("publicKey" in value)) {
|
|
1394
|
+
throw new CryptographyAssertionError(
|
|
1395
|
+
`Expected object with privateKey and publicKey properties`,
|
|
1396
|
+
{
|
|
1397
|
+
value,
|
|
1398
|
+
expectedType: "X25519Keypair",
|
|
1399
|
+
constraint: "must have privateKey and publicKey"
|
|
1400
|
+
}
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
assertX25519PrivateKey(value.privateKey);
|
|
1404
|
+
assertX25519PublicKey(value.publicKey);
|
|
1405
|
+
}
|
|
1406
|
+
chunkPK6SKIKE_cjs.__name(assertX25519Keypair, "assertX25519Keypair");
|
|
1407
|
+
var BASE85_LIMB_MAX = (1n << 85n) - 1n;
|
|
1408
|
+
function assertBase85Limb(value, name = "value") {
|
|
1409
|
+
if (typeof value !== "bigint") {
|
|
1410
|
+
throw new CryptographyAssertionError(`${name}: Expected bigint, got ${typeof value}`, {
|
|
1411
|
+
value,
|
|
1412
|
+
expectedType: "Base85Limb"
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
if (value < 0n) {
|
|
1416
|
+
throw new CryptographyAssertionError(`${name}: Value ${String(value)} is negative`, {
|
|
1417
|
+
value,
|
|
1418
|
+
expectedType: "Base85Limb",
|
|
1419
|
+
constraint: "value >= 0"
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
if (value > BASE85_LIMB_MAX) {
|
|
1423
|
+
throw new CryptographyAssertionError(`${name}: Value exceeds Base85 limb maximum`, {
|
|
1424
|
+
value,
|
|
1425
|
+
expectedType: "Base85Limb",
|
|
1426
|
+
constraint: `value <= 2^85 - 1`
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
chunkPK6SKIKE_cjs.__name(assertBase85Limb, "assertBase85Limb");
|
|
1431
|
+
var GROTH16_G1_BYTE_LENGTH = 64;
|
|
1432
|
+
var GROTH16_G2_BYTE_LENGTH = 128;
|
|
1433
|
+
function assertGroth16ProofA(value, name) {
|
|
1434
|
+
if (!(value instanceof Uint8Array)) {
|
|
1435
|
+
throw new TypeError(`${name ?? "value"} must be a Uint8Array, got ${typeof value}`);
|
|
1436
|
+
}
|
|
1437
|
+
if (value.length !== GROTH16_G1_BYTE_LENGTH) {
|
|
1438
|
+
throw new TypeError(
|
|
1439
|
+
`${name ?? "Groth16ProofA"} must be exactly ${String(GROTH16_G1_BYTE_LENGTH)} bytes, got ${String(value.length)}`
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
chunkPK6SKIKE_cjs.__name(assertGroth16ProofA, "assertGroth16ProofA");
|
|
1444
|
+
function assertGroth16ProofB(value, name) {
|
|
1445
|
+
if (!(value instanceof Uint8Array)) {
|
|
1446
|
+
throw new TypeError(`${name ?? "value"} must be a Uint8Array, got ${typeof value}`);
|
|
1447
|
+
}
|
|
1448
|
+
if (value.length !== GROTH16_G2_BYTE_LENGTH) {
|
|
1449
|
+
throw new TypeError(
|
|
1450
|
+
`${name ?? "Groth16ProofB"} must be exactly ${String(GROTH16_G2_BYTE_LENGTH)} bytes, got ${String(value.length)}`
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
chunkPK6SKIKE_cjs.__name(assertGroth16ProofB, "assertGroth16ProofB");
|
|
1455
|
+
function assertGroth16ProofC(value, name) {
|
|
1456
|
+
if (!(value instanceof Uint8Array)) {
|
|
1457
|
+
throw new TypeError(`${name ?? "value"} must be a Uint8Array, got ${typeof value}`);
|
|
1458
|
+
}
|
|
1459
|
+
if (value.length !== GROTH16_G1_BYTE_LENGTH) {
|
|
1460
|
+
throw new TypeError(
|
|
1461
|
+
`${name ?? "Groth16ProofC"} must be exactly ${String(GROTH16_G1_BYTE_LENGTH)} bytes, got ${String(value.length)}`
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
chunkPK6SKIKE_cjs.__name(assertGroth16ProofC, "assertGroth16ProofC");
|
|
1466
|
+
var ZK_PROOF_BYTE_LENGTH = 256;
|
|
1467
|
+
function assertZkProofBytes(value) {
|
|
1468
|
+
if (!(value instanceof Uint8Array)) {
|
|
1469
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1470
|
+
value,
|
|
1471
|
+
expectedType: "ZkProofBytes"
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
if (value.length !== ZK_PROOF_BYTE_LENGTH) {
|
|
1475
|
+
throw new CryptographyAssertionError(
|
|
1476
|
+
`Expected ${String(ZK_PROOF_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1477
|
+
{
|
|
1478
|
+
value,
|
|
1479
|
+
expectedType: "ZkProofBytes",
|
|
1480
|
+
constraint: `length === ${String(ZK_PROOF_BYTE_LENGTH)}`
|
|
1481
|
+
}
|
|
1482
|
+
);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
chunkPK6SKIKE_cjs.__name(assertZkProofBytes, "assertZkProofBytes");
|
|
1486
|
+
var AES_KEY_LENGTH = 32;
|
|
1487
|
+
var AES_IV_LENGTH = 12;
|
|
1488
|
+
var AES_AUTH_TAG_LENGTH = 16;
|
|
1489
|
+
var AES_METADATA_OVERHEAD = AES_IV_LENGTH + AES_AUTH_TAG_LENGTH;
|
|
1490
|
+
function assertAesKey(value) {
|
|
1491
|
+
if (!(value instanceof Uint8Array)) {
|
|
1492
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1493
|
+
value,
|
|
1494
|
+
expectedType: "AesKey"
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
if (value.length !== AES_KEY_LENGTH) {
|
|
1498
|
+
throw new CryptographyAssertionError(
|
|
1499
|
+
`Expected ${String(AES_KEY_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1500
|
+
{
|
|
1501
|
+
value,
|
|
1502
|
+
expectedType: "AesKey",
|
|
1503
|
+
constraint: `length === ${String(AES_KEY_LENGTH)}`
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
chunkPK6SKIKE_cjs.__name(assertAesKey, "assertAesKey");
|
|
1509
|
+
function assertAesPlaintext(value) {
|
|
1510
|
+
if (!(value instanceof Uint8Array)) {
|
|
1511
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1512
|
+
value,
|
|
1513
|
+
expectedType: "AesPlaintext"
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
chunkPK6SKIKE_cjs.__name(assertAesPlaintext, "assertAesPlaintext");
|
|
1518
|
+
function assertAesCiphertextWithMetadata(value) {
|
|
1519
|
+
if (!(value instanceof Uint8Array)) {
|
|
1520
|
+
throw new CryptographyAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1521
|
+
value,
|
|
1522
|
+
expectedType: "AesCiphertextWithMetadata"
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
if (value.length < AES_METADATA_OVERHEAD) {
|
|
1526
|
+
throw new CryptographyAssertionError(
|
|
1527
|
+
`Expected at least ${String(AES_METADATA_OVERHEAD)} bytes (IV + AuthTag), got ${String(value.length)}`,
|
|
1528
|
+
{
|
|
1529
|
+
value,
|
|
1530
|
+
expectedType: "AesCiphertextWithMetadata",
|
|
1531
|
+
constraint: `length >= ${String(AES_METADATA_OVERHEAD)}`
|
|
1532
|
+
}
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
chunkPK6SKIKE_cjs.__name(assertAesCiphertextWithMetadata, "assertAesCiphertextWithMetadata");
|
|
1537
|
+
var OPTIONAL_DATA_BYTE_LENGTH = 32;
|
|
1538
|
+
function assertOptionalData32(value, name) {
|
|
1539
|
+
if (!(value instanceof Uint8Array)) {
|
|
1540
|
+
throw new CryptographyAssertionError(
|
|
1541
|
+
`${name ?? "OptionalData32"}: Expected Uint8Array, got ${typeof value}`,
|
|
1542
|
+
{
|
|
1543
|
+
value,
|
|
1544
|
+
expectedType: "OptionalData32"
|
|
1545
|
+
}
|
|
1546
|
+
);
|
|
1547
|
+
}
|
|
1548
|
+
if (value.length !== OPTIONAL_DATA_BYTE_LENGTH) {
|
|
1549
|
+
throw new CryptographyAssertionError(
|
|
1550
|
+
`${name ?? "OptionalData32"} must be exactly ${String(OPTIONAL_DATA_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1551
|
+
{
|
|
1552
|
+
value,
|
|
1553
|
+
expectedType: "OptionalData32",
|
|
1554
|
+
constraint: `length === ${String(OPTIONAL_DATA_BYTE_LENGTH)}`
|
|
1555
|
+
}
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
chunkPK6SKIKE_cjs.__name(assertOptionalData32, "assertOptionalData32");
|
|
1560
|
+
|
|
1561
|
+
// src/solana/types.ts
|
|
1562
|
+
var SIGNATURE_BYTE_LENGTH = 64;
|
|
1563
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
1564
|
+
var BASE58_REGEX = /^[1-9A-HJ-NP-Za-km-z]+$/;
|
|
1565
|
+
var SolanaAssertionError = class _SolanaAssertionError extends Error {
|
|
1566
|
+
static {
|
|
1567
|
+
chunkPK6SKIKE_cjs.__name(this, "SolanaAssertionError");
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* The actual value that was passed to the assertion function and failed
|
|
1571
|
+
* the type check.
|
|
1572
|
+
*
|
|
1573
|
+
* @remarks
|
|
1574
|
+
* Typed as `unknown` because assertion functions accept values of unknown
|
|
1575
|
+
* type before narrowing. Inspect carefully — the value may be `undefined`,
|
|
1576
|
+
* `null`, or any primitive or object.
|
|
1577
|
+
*/
|
|
1578
|
+
value;
|
|
1579
|
+
/**
|
|
1580
|
+
* The name of the expected type (e.g., `"TransactionSignature"`,
|
|
1581
|
+
* `"SignatureBytes"`).
|
|
1582
|
+
*
|
|
1583
|
+
* @remarks
|
|
1584
|
+
* Matches the TypeScript type name for the intended branded type, not a
|
|
1585
|
+
* JavaScript `typeof` string.
|
|
1586
|
+
*/
|
|
1587
|
+
expectedType;
|
|
1588
|
+
/**
|
|
1589
|
+
* A human-readable description of the specific constraint that was violated,
|
|
1590
|
+
* if applicable.
|
|
1591
|
+
*
|
|
1592
|
+
* @remarks
|
|
1593
|
+
* Examples:
|
|
1594
|
+
* - `"length > 0"` — empty string passed to `assertTransactionSignature`
|
|
1595
|
+
* - `"length === 64"` — wrong byte count passed to `assertSignatureBytes`
|
|
1596
|
+
* - `"characters must be in base58 alphabet: 123...xyz"` — invalid character
|
|
1597
|
+
*
|
|
1598
|
+
* `undefined` when the only constraint is the TypeScript type itself
|
|
1599
|
+
* (e.g., `assertString` only checks `typeof value === "string"`).
|
|
1600
|
+
*/
|
|
1601
|
+
constraint;
|
|
1602
|
+
/**
|
|
1603
|
+
* Creates a new `SolanaAssertionError`.
|
|
1604
|
+
*
|
|
1605
|
+
* @param message - Human-readable description of the assertion failure.
|
|
1606
|
+
* @param options - Structured context for the failed assertion.
|
|
1607
|
+
* @param options.value - The value that failed the assertion.
|
|
1608
|
+
* @param options.expectedType - The name of the expected branded type.
|
|
1609
|
+
* @param options.constraint - The specific constraint that was violated, if any.
|
|
1610
|
+
*/
|
|
1611
|
+
constructor(message, options) {
|
|
1612
|
+
super(message);
|
|
1613
|
+
this.name = "SolanaAssertionError";
|
|
1614
|
+
this.value = options.value;
|
|
1615
|
+
this.expectedType = options.expectedType;
|
|
1616
|
+
this.constraint = options.constraint;
|
|
1617
|
+
Error.captureStackTrace(this, _SolanaAssertionError);
|
|
1618
|
+
Object.setPrototypeOf(this, _SolanaAssertionError.prototype);
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
function assertString(value) {
|
|
1622
|
+
if (typeof value !== "string") {
|
|
1623
|
+
throw new SolanaAssertionError(`Expected string, got ${typeof value}`, {
|
|
1624
|
+
value,
|
|
1625
|
+
expectedType: "String"
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
chunkPK6SKIKE_cjs.__name(assertString, "assertString");
|
|
1630
|
+
function assertTransactionSignature(value) {
|
|
1631
|
+
if (typeof value !== "string") {
|
|
1632
|
+
throw new SolanaAssertionError(`Expected string, got ${typeof value}`, {
|
|
1633
|
+
value,
|
|
1634
|
+
expectedType: "TransactionSignature"
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
if (value.length === 0) {
|
|
1638
|
+
throw new SolanaAssertionError("Transaction signature cannot be empty", {
|
|
1639
|
+
value,
|
|
1640
|
+
expectedType: "TransactionSignature",
|
|
1641
|
+
constraint: "length > 0"
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
if (!BASE58_REGEX.test(value)) {
|
|
1645
|
+
let invalidChar = "";
|
|
1646
|
+
let invalidIndex = -1;
|
|
1647
|
+
for (const [index, element] of Array.from(value).entries()) {
|
|
1648
|
+
if (!BASE58_ALPHABET.includes(element)) {
|
|
1649
|
+
invalidChar = element;
|
|
1650
|
+
invalidIndex = index;
|
|
1651
|
+
break;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
throw new SolanaAssertionError(
|
|
1655
|
+
`Invalid base58 character '${invalidChar}' at position ${String(invalidIndex)}`,
|
|
1656
|
+
{
|
|
1657
|
+
value,
|
|
1658
|
+
expectedType: "TransactionSignature",
|
|
1659
|
+
constraint: `characters must be in base58 alphabet: ${BASE58_ALPHABET}`
|
|
1660
|
+
}
|
|
1661
|
+
);
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
chunkPK6SKIKE_cjs.__name(assertTransactionSignature, "assertTransactionSignature");
|
|
1665
|
+
function assertSolanaBytes(value) {
|
|
1666
|
+
if (!(value instanceof Uint8Array)) {
|
|
1667
|
+
throw new SolanaAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1668
|
+
value,
|
|
1669
|
+
expectedType: "SolanaBytes"
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
chunkPK6SKIKE_cjs.__name(assertSolanaBytes, "assertSolanaBytes");
|
|
1674
|
+
function assertSignatureBytes(value) {
|
|
1675
|
+
if (!(value instanceof Uint8Array)) {
|
|
1676
|
+
throw new SolanaAssertionError(`Expected Uint8Array, got ${typeof value}`, {
|
|
1677
|
+
value,
|
|
1678
|
+
expectedType: "SignatureBytes"
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
if (value.length !== SIGNATURE_BYTE_LENGTH) {
|
|
1682
|
+
throw new SolanaAssertionError(
|
|
1683
|
+
`Expected ${String(SIGNATURE_BYTE_LENGTH)} bytes, got ${String(value.length)}`,
|
|
1684
|
+
{
|
|
1685
|
+
value,
|
|
1686
|
+
expectedType: "SignatureBytes",
|
|
1687
|
+
constraint: `length === ${String(SIGNATURE_BYTE_LENGTH)}`
|
|
1688
|
+
}
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
chunkPK6SKIKE_cjs.__name(assertSignatureBytes, "assertSignatureBytes");
|
|
1693
|
+
function asRelayableSignedTransaction(tx) {
|
|
1694
|
+
return tx;
|
|
1695
|
+
}
|
|
1696
|
+
chunkPK6SKIKE_cjs.__name(asRelayableSignedTransaction, "asRelayableSignedTransaction");
|
|
1697
|
+
|
|
1698
|
+
// src/common/temporal/types.ts
|
|
1699
|
+
var YEAR_MIN = 0n;
|
|
1700
|
+
var YEAR_MAX = 9999n;
|
|
1701
|
+
var MONTH_MIN = 1n;
|
|
1702
|
+
var MONTH_MAX = 12n;
|
|
1703
|
+
var DAY_MIN = 1n;
|
|
1704
|
+
var DAY_MAX = 31n;
|
|
1705
|
+
var HOUR_MIN = 0n;
|
|
1706
|
+
var HOUR_MAX = 23n;
|
|
1707
|
+
var MINUTE_MIN = 0n;
|
|
1708
|
+
var MINUTE_MAX = 59n;
|
|
1709
|
+
var SECOND_MIN = 0n;
|
|
1710
|
+
var SECOND_MAX = 59n;
|
|
1711
|
+
var TemporalAssertionError = class extends Error {
|
|
1712
|
+
static {
|
|
1713
|
+
chunkPK6SKIKE_cjs.__name(this, "TemporalAssertionError");
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* The actual value that failed the assertion.
|
|
1717
|
+
* @readonly
|
|
1718
|
+
*/
|
|
1719
|
+
value;
|
|
1720
|
+
/**
|
|
1721
|
+
* The type that was expected (e.g., `"Month"`, `"Hour"`).
|
|
1722
|
+
* @readonly
|
|
1723
|
+
*/
|
|
1724
|
+
expectedType;
|
|
1725
|
+
/**
|
|
1726
|
+
* Description of the constraint that was violated.
|
|
1727
|
+
*
|
|
1728
|
+
* @remarks
|
|
1729
|
+
* `undefined` when the failure was a type mismatch (e.g., received a number instead of a
|
|
1730
|
+
* bigint). Contains a human-readable range string (e.g., `"1 <= value <= 12"`) when the
|
|
1731
|
+
* value was the correct type but out of the valid range.
|
|
1732
|
+
* @readonly
|
|
1733
|
+
*/
|
|
1734
|
+
constraint;
|
|
1735
|
+
/**
|
|
1736
|
+
* Creates a new TemporalAssertionError.
|
|
1737
|
+
*
|
|
1738
|
+
* @param message - Human-readable description of what went wrong
|
|
1739
|
+
* @param details - Structured error details for programmatic inspection
|
|
1740
|
+
* @param details.value - The value that failed the assertion
|
|
1741
|
+
* @param details.expectedType - Name of the branded type that was expected
|
|
1742
|
+
* @param details.constraint - Optional human-readable constraint that was violated
|
|
1743
|
+
*/
|
|
1744
|
+
constructor(message, details) {
|
|
1745
|
+
super(message);
|
|
1746
|
+
this.name = "TemporalAssertionError";
|
|
1747
|
+
this.value = details.value;
|
|
1748
|
+
this.expectedType = details.expectedType;
|
|
1749
|
+
this.constraint = details.constraint;
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
function assertTimestampComponent(value) {
|
|
1753
|
+
if (typeof value !== "bigint") {
|
|
1754
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1755
|
+
value,
|
|
1756
|
+
expectedType: "TimestampComponent"
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
if (value < 0n) {
|
|
1760
|
+
throw new TemporalAssertionError(`TimestampComponent must be non-negative`, {
|
|
1761
|
+
value,
|
|
1762
|
+
expectedType: "TimestampComponent",
|
|
1763
|
+
constraint: "value >= 0"
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
chunkPK6SKIKE_cjs.__name(assertTimestampComponent, "assertTimestampComponent");
|
|
1768
|
+
function assertYear(value) {
|
|
1769
|
+
if (typeof value !== "bigint") {
|
|
1770
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1771
|
+
value,
|
|
1772
|
+
expectedType: "Year"
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
if (value < YEAR_MIN || value > YEAR_MAX) {
|
|
1776
|
+
throw new TemporalAssertionError(
|
|
1777
|
+
`Year must be in range [${String(YEAR_MIN)}, ${String(YEAR_MAX)}]`,
|
|
1778
|
+
{
|
|
1779
|
+
value,
|
|
1780
|
+
expectedType: "Year",
|
|
1781
|
+
constraint: `${String(YEAR_MIN)} <= value <= ${String(YEAR_MAX)}`
|
|
1782
|
+
}
|
|
1783
|
+
);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
chunkPK6SKIKE_cjs.__name(assertYear, "assertYear");
|
|
1787
|
+
function assertMonth(value) {
|
|
1788
|
+
if (typeof value !== "bigint") {
|
|
1789
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1790
|
+
value,
|
|
1791
|
+
expectedType: "Month"
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
if (value < MONTH_MIN || value > MONTH_MAX) {
|
|
1795
|
+
throw new TemporalAssertionError(
|
|
1796
|
+
`Month must be in range [${String(MONTH_MIN)}, ${String(MONTH_MAX)}]`,
|
|
1797
|
+
{
|
|
1798
|
+
value,
|
|
1799
|
+
expectedType: "Month",
|
|
1800
|
+
constraint: `${String(MONTH_MIN)} <= value <= ${String(MONTH_MAX)}`
|
|
1801
|
+
}
|
|
1802
|
+
);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
chunkPK6SKIKE_cjs.__name(assertMonth, "assertMonth");
|
|
1806
|
+
function assertDay(value) {
|
|
1807
|
+
if (typeof value !== "bigint") {
|
|
1808
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1809
|
+
value,
|
|
1810
|
+
expectedType: "Day"
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
if (value < DAY_MIN || value > DAY_MAX) {
|
|
1814
|
+
throw new TemporalAssertionError(
|
|
1815
|
+
`Day must be in range [${String(DAY_MIN)}, ${String(DAY_MAX)}]`,
|
|
1816
|
+
{
|
|
1817
|
+
value,
|
|
1818
|
+
expectedType: "Day",
|
|
1819
|
+
constraint: `${String(DAY_MIN)} <= value <= ${String(DAY_MAX)}`
|
|
1820
|
+
}
|
|
1821
|
+
);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
chunkPK6SKIKE_cjs.__name(assertDay, "assertDay");
|
|
1825
|
+
function assertHour(value) {
|
|
1826
|
+
if (typeof value !== "bigint") {
|
|
1827
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1828
|
+
value,
|
|
1829
|
+
expectedType: "Hour"
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
if (value < HOUR_MIN || value > HOUR_MAX) {
|
|
1833
|
+
throw new TemporalAssertionError(
|
|
1834
|
+
`Hour must be in range [${String(HOUR_MIN)}, ${String(HOUR_MAX)}]`,
|
|
1835
|
+
{
|
|
1836
|
+
value,
|
|
1837
|
+
expectedType: "Hour",
|
|
1838
|
+
constraint: `${String(HOUR_MIN)} <= value <= ${String(HOUR_MAX)}`
|
|
1839
|
+
}
|
|
1840
|
+
);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
chunkPK6SKIKE_cjs.__name(assertHour, "assertHour");
|
|
1844
|
+
function assertMinute(value) {
|
|
1845
|
+
if (typeof value !== "bigint") {
|
|
1846
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1847
|
+
value,
|
|
1848
|
+
expectedType: "Minute"
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
if (value < MINUTE_MIN || value > MINUTE_MAX) {
|
|
1852
|
+
throw new TemporalAssertionError(
|
|
1853
|
+
`Minute must be in range [${String(MINUTE_MIN)}, ${String(MINUTE_MAX)}]`,
|
|
1854
|
+
{
|
|
1855
|
+
value,
|
|
1856
|
+
expectedType: "Minute",
|
|
1857
|
+
constraint: `${String(MINUTE_MIN)} <= value <= ${String(MINUTE_MAX)}`
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
chunkPK6SKIKE_cjs.__name(assertMinute, "assertMinute");
|
|
1863
|
+
function assertSecond(value) {
|
|
1864
|
+
if (typeof value !== "bigint") {
|
|
1865
|
+
throw new TemporalAssertionError(`Expected bigint, got ${typeof value}`, {
|
|
1866
|
+
value,
|
|
1867
|
+
expectedType: "Second"
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
if (value < SECOND_MIN || value > SECOND_MAX) {
|
|
1871
|
+
throw new TemporalAssertionError(
|
|
1872
|
+
`Second must be in range [${String(SECOND_MIN)}, ${String(SECOND_MAX)}]`,
|
|
1873
|
+
{
|
|
1874
|
+
value,
|
|
1875
|
+
expectedType: "Second",
|
|
1876
|
+
constraint: `${String(SECOND_MIN)} <= value <= ${String(SECOND_MAX)}`
|
|
1877
|
+
}
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
chunkPK6SKIKE_cjs.__name(assertSecond, "assertSecond");
|
|
1882
|
+
|
|
1883
|
+
exports.AES_AUTH_TAG_LENGTH = AES_AUTH_TAG_LENGTH;
|
|
1884
|
+
exports.AES_IV_LENGTH = AES_IV_LENGTH;
|
|
1885
|
+
exports.AES_KEY_LENGTH = AES_KEY_LENGTH;
|
|
1886
|
+
exports.AES_METADATA_OVERHEAD = AES_METADATA_OVERHEAD;
|
|
1887
|
+
exports.BASE85_LIMB_MAX = BASE85_LIMB_MAX;
|
|
1888
|
+
exports.BN254_FIELD_PRIME = BN254_FIELD_PRIME;
|
|
1889
|
+
exports.CURVE25519_FIELD_PRIME = CURVE25519_FIELD_PRIME;
|
|
1890
|
+
exports.CryptographyAssertionError = CryptographyAssertionError;
|
|
1891
|
+
exports.DAY_MAX = DAY_MAX;
|
|
1892
|
+
exports.DAY_MIN = DAY_MIN;
|
|
1893
|
+
exports.GROTH16_G1_BYTE_LENGTH = GROTH16_G1_BYTE_LENGTH;
|
|
1894
|
+
exports.GROTH16_G2_BYTE_LENGTH = GROTH16_G2_BYTE_LENGTH;
|
|
1895
|
+
exports.HOUR_MAX = HOUR_MAX;
|
|
1896
|
+
exports.HOUR_MIN = HOUR_MIN;
|
|
1897
|
+
exports.I1024_MAX = I1024_MAX;
|
|
1898
|
+
exports.I1024_MIN = I1024_MIN;
|
|
1899
|
+
exports.I128_MAX = I128_MAX;
|
|
1900
|
+
exports.I128_MIN = I128_MIN;
|
|
1901
|
+
exports.I16_MAX = I16_MAX;
|
|
1902
|
+
exports.I16_MIN = I16_MIN;
|
|
1903
|
+
exports.I256_MAX = I256_MAX;
|
|
1904
|
+
exports.I256_MIN = I256_MIN;
|
|
1905
|
+
exports.I32_MAX = I32_MAX;
|
|
1906
|
+
exports.I32_MIN = I32_MIN;
|
|
1907
|
+
exports.I512_MAX = I512_MAX;
|
|
1908
|
+
exports.I512_MIN = I512_MIN;
|
|
1909
|
+
exports.I64_MAX = I64_MAX;
|
|
1910
|
+
exports.I64_MIN = I64_MIN;
|
|
1911
|
+
exports.I8_MAX = I8_MAX;
|
|
1912
|
+
exports.I8_MIN = I8_MIN;
|
|
1913
|
+
exports.MINUTE_MAX = MINUTE_MAX;
|
|
1914
|
+
exports.MINUTE_MIN = MINUTE_MIN;
|
|
1915
|
+
exports.MONTH_MAX = MONTH_MAX;
|
|
1916
|
+
exports.MONTH_MIN = MONTH_MIN;
|
|
1917
|
+
exports.MathematicsAssertionError = MathematicsAssertionError;
|
|
1918
|
+
exports.OPTIONAL_DATA_BYTE_LENGTH = OPTIONAL_DATA_BYTE_LENGTH;
|
|
1919
|
+
exports.SECOND_MAX = SECOND_MAX;
|
|
1920
|
+
exports.SECOND_MIN = SECOND_MIN;
|
|
1921
|
+
exports.SIGNATURE_BYTE_LENGTH = SIGNATURE_BYTE_LENGTH;
|
|
1922
|
+
exports.SolanaAssertionError = SolanaAssertionError;
|
|
1923
|
+
exports.TemporalAssertionError = TemporalAssertionError;
|
|
1924
|
+
exports.U1024_BYTE_LENGTH = U1024_BYTE_LENGTH;
|
|
1925
|
+
exports.U1024_MAX = U1024_MAX;
|
|
1926
|
+
exports.U128_BYTE_LENGTH = U128_BYTE_LENGTH;
|
|
1927
|
+
exports.U128_MAX = U128_MAX;
|
|
1928
|
+
exports.U16_BYTE_LENGTH = U16_BYTE_LENGTH;
|
|
1929
|
+
exports.U16_MAX = U16_MAX;
|
|
1930
|
+
exports.U256_BYTE_LENGTH = U256_BYTE_LENGTH;
|
|
1931
|
+
exports.U256_MAX = U256_MAX;
|
|
1932
|
+
exports.U32_BYTE_LENGTH = U32_BYTE_LENGTH;
|
|
1933
|
+
exports.U32_MAX = U32_MAX;
|
|
1934
|
+
exports.U512_BYTE_LENGTH = U512_BYTE_LENGTH;
|
|
1935
|
+
exports.U512_MAX = U512_MAX;
|
|
1936
|
+
exports.U64_BYTE_LENGTH = U64_BYTE_LENGTH;
|
|
1937
|
+
exports.U64_MAX = U64_MAX;
|
|
1938
|
+
exports.U8_BYTE_LENGTH = U8_BYTE_LENGTH;
|
|
1939
|
+
exports.U8_MAX = U8_MAX;
|
|
1940
|
+
exports.X25519_BYTE_LENGTH = X25519_BYTE_LENGTH;
|
|
1941
|
+
exports.YEAR_MAX = YEAR_MAX;
|
|
1942
|
+
exports.YEAR_MIN = YEAR_MIN;
|
|
1943
|
+
exports.ZK_PROOF_BYTE_LENGTH = ZK_PROOF_BYTE_LENGTH;
|
|
1944
|
+
exports.asRelayableSignedTransaction = asRelayableSignedTransaction;
|
|
1945
|
+
exports.assertAesCiphertextWithMetadata = assertAesCiphertextWithMetadata;
|
|
1946
|
+
exports.assertAesKey = assertAesKey;
|
|
1947
|
+
exports.assertAesPlaintext = assertAesPlaintext;
|
|
1948
|
+
exports.assertBase85Limb = assertBase85Limb;
|
|
1949
|
+
exports.assertBeBytes = assertBeBytes;
|
|
1950
|
+
exports.assertBn254FieldElement = assertBn254FieldElement;
|
|
1951
|
+
exports.assertBytes = assertBytes;
|
|
1952
|
+
exports.assertCurve25519FieldElement = assertCurve25519FieldElement;
|
|
1953
|
+
exports.assertDailyViewingKey = assertDailyViewingKey;
|
|
1954
|
+
exports.assertDay = assertDay;
|
|
1955
|
+
exports.assertGenerationSeed = assertGenerationSeed;
|
|
1956
|
+
exports.assertGroth16ProofA = assertGroth16ProofA;
|
|
1957
|
+
exports.assertGroth16ProofB = assertGroth16ProofB;
|
|
1958
|
+
exports.assertGroth16ProofC = assertGroth16ProofC;
|
|
1959
|
+
exports.assertHour = assertHour;
|
|
1960
|
+
exports.assertHourlyViewingKey = assertHourlyViewingKey;
|
|
1961
|
+
exports.assertI1024 = assertI1024;
|
|
1962
|
+
exports.assertI128 = assertI128;
|
|
1963
|
+
exports.assertI16 = assertI16;
|
|
1964
|
+
exports.assertI256 = assertI256;
|
|
1965
|
+
exports.assertI32 = assertI32;
|
|
1966
|
+
exports.assertI512 = assertI512;
|
|
1967
|
+
exports.assertI64 = assertI64;
|
|
1968
|
+
exports.assertI8 = assertI8;
|
|
1969
|
+
exports.assertKeccak256Hash = assertKeccak256Hash;
|
|
1970
|
+
exports.assertKeccak512Hash = assertKeccak512Hash;
|
|
1971
|
+
exports.assertLeBytes = assertLeBytes;
|
|
1972
|
+
exports.assertMasterSeed = assertMasterSeed;
|
|
1973
|
+
exports.assertMasterViewingKey = assertMasterViewingKey;
|
|
1974
|
+
exports.assertMintViewingKey = assertMintViewingKey;
|
|
1975
|
+
exports.assertMinute = assertMinute;
|
|
1976
|
+
exports.assertMinuteViewingKey = assertMinuteViewingKey;
|
|
1977
|
+
exports.assertMonth = assertMonth;
|
|
1978
|
+
exports.assertMonthlyViewingKey = assertMonthlyViewingKey;
|
|
1979
|
+
exports.assertOptionalData32 = assertOptionalData32;
|
|
1980
|
+
exports.assertPoseidonCiphertext = assertPoseidonCiphertext;
|
|
1981
|
+
exports.assertPoseidonCounter = assertPoseidonCounter;
|
|
1982
|
+
exports.assertPoseidonHash = assertPoseidonHash;
|
|
1983
|
+
exports.assertPoseidonKey = assertPoseidonKey;
|
|
1984
|
+
exports.assertPoseidonKeystream = assertPoseidonKeystream;
|
|
1985
|
+
exports.assertPoseidonPlaintext = assertPoseidonPlaintext;
|
|
1986
|
+
exports.assertRcCiphertext = assertRcCiphertext;
|
|
1987
|
+
exports.assertRcCounter = assertRcCounter;
|
|
1988
|
+
exports.assertRcEncryptionNonce = assertRcEncryptionNonce;
|
|
1989
|
+
exports.assertRcKey = assertRcKey;
|
|
1990
|
+
exports.assertRcPlaintext = assertRcPlaintext;
|
|
1991
|
+
exports.assertSecond = assertSecond;
|
|
1992
|
+
exports.assertSecondViewingKey = assertSecondViewingKey;
|
|
1993
|
+
exports.assertSharedSecret = assertSharedSecret;
|
|
1994
|
+
exports.assertSignatureBytes = assertSignatureBytes;
|
|
1995
|
+
exports.assertSignedInteger = assertSignedInteger;
|
|
1996
|
+
exports.assertSolanaBytes = assertSolanaBytes;
|
|
1997
|
+
exports.assertString = assertString;
|
|
1998
|
+
exports.assertTimestampComponent = assertTimestampComponent;
|
|
1999
|
+
exports.assertTransactionSignature = assertTransactionSignature;
|
|
2000
|
+
exports.assertU1024 = assertU1024;
|
|
2001
|
+
exports.assertU1024BeBytes = assertU1024BeBytes;
|
|
2002
|
+
exports.assertU1024LeBytes = assertU1024LeBytes;
|
|
2003
|
+
exports.assertU128 = assertU128;
|
|
2004
|
+
exports.assertU128BeBytes = assertU128BeBytes;
|
|
2005
|
+
exports.assertU128LeBytes = assertU128LeBytes;
|
|
2006
|
+
exports.assertU16 = assertU16;
|
|
2007
|
+
exports.assertU16BeBytes = assertU16BeBytes;
|
|
2008
|
+
exports.assertU16LeBytes = assertU16LeBytes;
|
|
2009
|
+
exports.assertU256 = assertU256;
|
|
2010
|
+
exports.assertU256BeBytes = assertU256BeBytes;
|
|
2011
|
+
exports.assertU256LeBytes = assertU256LeBytes;
|
|
2012
|
+
exports.assertU32 = assertU32;
|
|
2013
|
+
exports.assertU32BeBytes = assertU32BeBytes;
|
|
2014
|
+
exports.assertU32LeBytes = assertU32LeBytes;
|
|
2015
|
+
exports.assertU512 = assertU512;
|
|
2016
|
+
exports.assertU512BeBytes = assertU512BeBytes;
|
|
2017
|
+
exports.assertU512LeBytes = assertU512LeBytes;
|
|
2018
|
+
exports.assertU64 = assertU64;
|
|
2019
|
+
exports.assertU64BeBytes = assertU64BeBytes;
|
|
2020
|
+
exports.assertU64LeBytes = assertU64LeBytes;
|
|
2021
|
+
exports.assertU8 = assertU8;
|
|
2022
|
+
exports.assertU8BeBytes = assertU8BeBytes;
|
|
2023
|
+
exports.assertU8LeBytes = assertU8LeBytes;
|
|
2024
|
+
exports.assertUnsignedInteger = assertUnsignedInteger;
|
|
2025
|
+
exports.assertX25519Bytes = assertX25519Bytes;
|
|
2026
|
+
exports.assertX25519Keypair = assertX25519Keypair;
|
|
2027
|
+
exports.assertX25519PrivateKey = assertX25519PrivateKey;
|
|
2028
|
+
exports.assertX25519PublicKey = assertX25519PublicKey;
|
|
2029
|
+
exports.assertYear = assertYear;
|
|
2030
|
+
exports.assertYearlyViewingKey = assertYearlyViewingKey;
|
|
2031
|
+
exports.assertZkProofBytes = assertZkProofBytes;
|
|
2032
|
+
//# sourceMappingURL=chunk-MDFSBU5W.cjs.map
|
|
2033
|
+
//# sourceMappingURL=chunk-MDFSBU5W.cjs.map
|