@typeberry/native 0.0.1-64ee5ed → 0.0.1-7c38bfd

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.
@@ -0,0 +1,15 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ };
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
12
+ });
13
+
14
+ //#endregion
15
+ export { __export, __require };
package/index.d.ts ADDED
@@ -0,0 +1,245 @@
1
+ declare namespace bandersnatch_d_exports {
2
+ export { InitInput$2 as InitInput, InitOutput$2 as InitOutput, SyncInitInput$2 as SyncInitInput, batch_verify_tickets, __wbg_init$2 as default, derive_public_key, initSync$2 as initSync, ring_commitment, verify_seal };
3
+ }
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ /**
7
+ * @param {Uint8Array} keys
8
+ * @returns {Uint8Array}
9
+ */
10
+ declare function ring_commitment(keys: Uint8Array): Uint8Array;
11
+ /**
12
+ * Derive Private and Public Key from Seed
13
+ *
14
+ * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
15
+ * @param {Uint8Array} seed
16
+ * @returns {Uint8Array}
17
+ */
18
+ declare function derive_public_key(seed: Uint8Array): Uint8Array;
19
+ /**
20
+ * Seal verification as defined in:
21
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
22
+ * or
23
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
24
+ * @param {Uint8Array} keys
25
+ * @param {number} signer_key_index
26
+ * @param {Uint8Array} seal_data
27
+ * @param {Uint8Array} payload
28
+ * @param {Uint8Array} aux_data
29
+ * @returns {Uint8Array}
30
+ */
31
+ declare function verify_seal(keys: Uint8Array, signer_key_index: number, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
32
+ /**
33
+ * Verify multiple tickets at once as defined in:
34
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
35
+ *
36
+ * NOTE: the aux_data of VRF function is empty!
37
+ * @param {Uint8Array} keys
38
+ * @param {Uint8Array} tickets_data
39
+ * @param {number} vrf_input_data_len
40
+ * @returns {Uint8Array}
41
+ */
42
+ declare function batch_verify_tickets(keys: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
43
+ type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
44
+ interface InitOutput$2 {
45
+ readonly memory: WebAssembly.Memory;
46
+ readonly ring_commitment: (a: number, b: number, c: number) => void;
47
+ readonly derive_public_key: (a: number, b: number, c: number) => void;
48
+ readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
49
+ readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
50
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
51
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
52
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
53
+ }
54
+ type SyncInitInput$2 = BufferSource | WebAssembly.Module;
55
+ /**
56
+ * Instantiates the given `module`, which can either be bytes or
57
+ * a precompiled `WebAssembly.Module`.
58
+ *
59
+ * @param {SyncInitInput} module
60
+ *
61
+ * @returns {InitOutput}
62
+ */
63
+ declare function initSync$2(module: SyncInitInput$2): InitOutput$2;
64
+
65
+ /**
66
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
67
+ * for everything else, calls `WebAssembly.instantiate` directly.
68
+ *
69
+ * @param {InitInput | Promise<InitInput>} module_or_path
70
+ *
71
+ * @returns {Promise<InitOutput>}
72
+ */
73
+ declare function __wbg_init$2(module_or_path?: InitInput$2 | Promise<InitInput$2>): Promise<InitOutput$2>;
74
+ declare namespace ed25519_wasm_d_exports {
75
+ export { InitInput$1 as InitInput, InitOutput$1 as InitOutput, SyncInitInput$1 as SyncInitInput, __wbg_init$1 as default, initSync$1 as initSync, verify_ed25519, verify_ed25519_batch };
76
+ }
77
+ /* tslint:disable */
78
+ /* eslint-disable */
79
+ /**
80
+ *
81
+ * * Verify Ed25519 signatures one by one using strict verification.
82
+ * *
83
+ * * This function is slower but does strict verification.
84
+ *
85
+ */
86
+ declare function verify_ed25519(data: Uint8Array): Uint8Array;
87
+ /**
88
+ *
89
+ * * Verify Ed25519 signatures using build-in batch verification.
90
+ * *
91
+ * * This function is faster but does not do strict verification.
92
+ * * See https://crates.io/crates/ed25519-dalek#batch-verification for more information.
93
+ *
94
+ */
95
+ declare function verify_ed25519_batch(data: Uint8Array): boolean;
96
+ type InitInput$1 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
97
+ interface InitOutput$1 {
98
+ readonly memory: WebAssembly.Memory;
99
+ readonly verify_ed25519: (a: number, b: number) => [number, number];
100
+ readonly verify_ed25519_batch: (a: number, b: number) => number;
101
+ readonly __wbindgen_export_0: WebAssembly.Table;
102
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
103
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
104
+ readonly __wbindgen_start: () => void;
105
+ }
106
+ type SyncInitInput$1 = BufferSource | WebAssembly.Module;
107
+ /**
108
+ * Instantiates the given `module`, which can either be bytes or
109
+ * a precompiled `WebAssembly.Module`.
110
+ *
111
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
112
+ *
113
+ * @returns {InitOutput}
114
+ */
115
+ declare function initSync$1(module: {
116
+ module: SyncInitInput$1;
117
+ } | SyncInitInput$1): InitOutput$1;
118
+
119
+ /**
120
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
121
+ * for everything else, calls `WebAssembly.instantiate` directly.
122
+ *
123
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
124
+ *
125
+ * @returns {Promise<InitOutput>}
126
+ */
127
+ declare function __wbg_init$1(module_or_path?: {
128
+ module_or_path: InitInput$1 | Promise<InitInput$1>;
129
+ } | InitInput$1 | Promise<InitInput$1>): Promise<InitOutput$1>;
130
+ declare namespace reed_solomon_wasm_d_exports {
131
+ export { InitInput, InitOutput, ShardsCollection, SyncInitInput, decode, __wbg_init as default, encode, initSync };
132
+ }
133
+ /* tslint:disable */
134
+ /* eslint-disable */
135
+ /**
136
+ * @param {number} recovery_count
137
+ * @param {ShardsCollection} shards
138
+ * @returns {ShardsCollection}
139
+ */
140
+ declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
141
+ /**
142
+ * @param {number} original_count
143
+ * @param {number} recovery_count
144
+ * @param {ShardsCollection} shards
145
+ * @returns {ShardsCollection}
146
+ */
147
+ declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
148
+ /**
149
+ * Collection of shards (either input or output).
150
+ *
151
+ * To efficiently pass data between JS and WASM all of the shards
152
+ * are passed as one big vector of bytes.
153
+ * It's assumed that every shard has the same length (`shard_len`).
154
+ * If the shards are NOT passed in the exact order they were created
155
+ * it's possible to pass `indices` array.
156
+ * A value of `indices` array at position `idx` is the shard index
157
+ * that resides at `[ idx * shard_len .. idx * shard_len + shard_len )`
158
+ * in `data` array.
159
+ *
160
+ * This collection is only used to get the data from JS or pass the data back.
161
+ * Internally we convert it to [`RsShardsCollection`], which copies
162
+ * the memory to/from WASM.
163
+ */
164
+ declare class ShardsCollection {
165
+ free(): void;
166
+ /**
167
+ * @param {number} shard_len
168
+ * @param {Uint8Array} data
169
+ * @param {Uint16Array | undefined} [indices]
170
+ */
171
+ constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array);
172
+ /**
173
+ * Extract the `indices` from this shards container.
174
+ *
175
+ * Should be called on the JS side to avoid copying.
176
+ * NOTE that subsequent calls to that method will return `None`.
177
+ * @returns {Uint16Array | undefined}
178
+ */
179
+ take_indices(): Uint16Array | undefined;
180
+ /**
181
+ * Take the underlying `data` to the JS side.
182
+ *
183
+ * NOTE this object is destroyed after the data is consumed,
184
+ * so make sure to [`take_indices`] first.
185
+ * @returns {Uint8Array}
186
+ */
187
+ take_data(): Uint8Array;
188
+ /**
189
+ * Number of shards within the collection.
190
+ */
191
+ length: number;
192
+ /**
193
+ * The length of each shard.
194
+ */
195
+ shard_len: number;
196
+ }
197
+ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
198
+ interface InitOutput {
199
+ readonly memory: WebAssembly.Memory;
200
+ readonly __wbg_shardscollection_free: (a: number, b: number) => void;
201
+ readonly __wbg_get_shardscollection_length: (a: number) => number;
202
+ readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
203
+ readonly __wbg_get_shardscollection_shard_len: (a: number) => number;
204
+ readonly __wbg_set_shardscollection_shard_len: (a: number, b: number) => void;
205
+ readonly shardscollection_new: (a: number, b: number, c: number) => number;
206
+ readonly shardscollection_take_indices: (a: number) => number;
207
+ readonly shardscollection_take_data: (a: number) => number;
208
+ readonly encode: (a: number, b: number, c: number) => void;
209
+ readonly decode: (a: number, b: number, c: number, d: number) => void;
210
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
211
+ }
212
+ type SyncInitInput = BufferSource | WebAssembly.Module;
213
+ /**
214
+ * Instantiates the given `module`, which can either be bytes or
215
+ * a precompiled `WebAssembly.Module`.
216
+ *
217
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
218
+ *
219
+ * @returns {InitOutput}
220
+ */
221
+ declare function initSync(module: {
222
+ module: SyncInitInput;
223
+ } | SyncInitInput): InitOutput;
224
+
225
+ /**
226
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
227
+ * for everything else, calls `WebAssembly.instantiate` directly.
228
+ *
229
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
230
+ *
231
+ * @returns {Promise<InitOutput>}
232
+ */
233
+ declare function __wbg_init(module_or_path?: {
234
+ module_or_path: InitInput | Promise<InitInput>;
235
+ } | InitInput | Promise<InitInput>): Promise<InitOutput>;
236
+ //#endregion
237
+ //#region native/index.d.ts
238
+ declare function initAll(): Promise<void>;
239
+ declare const init: {
240
+ bandersnatch: () => Promise<InitOutput$2>;
241
+ ed25519: () => Promise<InitOutput$1>;
242
+ reedSolomon: () => Promise<InitOutput>;
243
+ };
244
+ //#endregion
245
+ export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };