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