@typeberry/native 0.0.4-22d630b → 0.0.4-51b82bc
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/index.d.ts +69 -29
- package/index.js +147 -73
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
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 };
|
|
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, generate_seal, initSync$2 as initSync, ring_commitment, verify_seal, vrf_output_hash };
|
|
3
3
|
}
|
|
4
4
|
/* tslint:disable */
|
|
5
5
|
/* eslint-disable */
|
|
6
|
-
/**
|
|
7
|
-
* Generate ring commitment given concatenation of ring keys.
|
|
8
|
-
*/
|
|
9
|
-
declare function ring_commitment(keys: Uint8Array): Uint8Array;
|
|
10
|
-
/**
|
|
11
|
-
* Derive Private and Public Key from Seed
|
|
12
|
-
*
|
|
13
|
-
* returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
|
|
14
|
-
*/
|
|
15
|
-
declare function derive_public_key(seed: Uint8Array): Uint8Array;
|
|
16
6
|
/**
|
|
17
7
|
* Seal verification as defined in:
|
|
18
8
|
* https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
|
|
@@ -27,13 +17,67 @@ declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payl
|
|
|
27
17
|
* NOTE: the aux_data of VRF function is empty!
|
|
28
18
|
*/
|
|
29
19
|
declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* Generate seal that is verifiable using `verify_seal` function.
|
|
22
|
+
*
|
|
23
|
+
* # Arguments
|
|
24
|
+
* * `secret_seed` - Seed used to derive the secret key
|
|
25
|
+
* * `input` - VRF input data
|
|
26
|
+
* * `aux_data` - Auxiliary data for the VRF proof
|
|
27
|
+
*
|
|
28
|
+
* # Returns
|
|
29
|
+
* A byte vector with the following format:
|
|
30
|
+
* - On success (97 bytes):
|
|
31
|
+
* - Byte 0: Status code `0` (RESULT_OK)
|
|
32
|
+
* - Bytes 1-32: Serialized VRF output (32 bytes, compressed) NOTE: not output hash!
|
|
33
|
+
* - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
|
|
34
|
+
* - On error (1 byte):
|
|
35
|
+
* - Byte 0: Status code `1` (RESULT_ERR)
|
|
36
|
+
*
|
|
37
|
+
* Returns an error if the input cannot be converted to a valid VRF input point
|
|
38
|
+
* or if serialization of the output or proof fails.
|
|
39
|
+
*/
|
|
40
|
+
declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
41
|
+
/**
|
|
42
|
+
* Derive Private and Public Key from Seed
|
|
43
|
+
*
|
|
44
|
+
* returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
|
|
45
|
+
*/
|
|
46
|
+
declare function derive_public_key(seed: Uint8Array): Uint8Array;
|
|
47
|
+
/**
|
|
48
|
+
* Compute VRF output hash from a secret seed and input data.
|
|
49
|
+
*
|
|
50
|
+
* This function derives a deterministic VRF output hash without generating a proof.
|
|
51
|
+
* Unlike `generate_seal`, this produces only the output hash, not a verifiable signature.
|
|
52
|
+
*
|
|
53
|
+
* # Arguments
|
|
54
|
+
* * `secret_seed` - Seed used to derive the secret key
|
|
55
|
+
* * `input` - VRF input data to be hashed
|
|
56
|
+
*
|
|
57
|
+
* # Returns
|
|
58
|
+
* A byte vector with the following format:
|
|
59
|
+
* - On success (33 bytes):
|
|
60
|
+
* - Byte 0: Status code `0` (RESULT_OK)
|
|
61
|
+
* - Bytes 1-32: VRF output hash (32 bytes)
|
|
62
|
+
* - On error (1 byte):
|
|
63
|
+
* - Byte 0: Status code `1` (RESULT_ERR)
|
|
64
|
+
*
|
|
65
|
+
* Returns an error if the input cannot be converted to a valid VRF input point.
|
|
66
|
+
*/
|
|
67
|
+
declare function vrf_output_hash(secret_seed: Uint8Array, input: Uint8Array): Uint8Array;
|
|
68
|
+
/**
|
|
69
|
+
* Generate ring commitment given concatenation of ring keys.
|
|
70
|
+
*/
|
|
71
|
+
declare function ring_commitment(keys: Uint8Array): Uint8Array;
|
|
30
72
|
type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
31
73
|
interface InitOutput$2 {
|
|
32
74
|
readonly memory: WebAssembly.Memory;
|
|
33
|
-
readonly
|
|
75
|
+
readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
34
76
|
readonly derive_public_key: (a: number, b: number) => [number, number];
|
|
77
|
+
readonly generate_seal: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
78
|
+
readonly ring_commitment: (a: number, b: number) => [number, number];
|
|
35
79
|
readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
36
|
-
readonly
|
|
80
|
+
readonly vrf_output_hash: (a: number, b: number, c: number, d: number) => [number, number];
|
|
37
81
|
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
38
82
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
39
83
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
@@ -70,18 +114,14 @@ declare namespace ed25519_wasm_d_exports {
|
|
|
70
114
|
/* eslint-disable */
|
|
71
115
|
/**
|
|
72
116
|
*
|
|
73
|
-
* * Verify Ed25519 signatures one by one
|
|
117
|
+
* * Verify Ed25519 signatures one by one.
|
|
74
118
|
* *
|
|
75
|
-
* *
|
|
76
|
-
*
|
|
119
|
+
* * ed25519-consensus always does strict verification (ZIP-215 compatible).
|
|
77
120
|
*/
|
|
78
121
|
declare function verify_ed25519(data: Uint8Array): Uint8Array;
|
|
79
122
|
/**
|
|
80
123
|
*
|
|
81
|
-
* *
|
|
82
|
-
* *
|
|
83
|
-
* * This function is faster but does not do strict verification.
|
|
84
|
-
* * See https://crates.io/crates/ed25519-dalek#batch-verification for more information.
|
|
124
|
+
* * ed25519-consensus doesn't have built-in batch verification.
|
|
85
125
|
*
|
|
86
126
|
*/
|
|
87
127
|
declare function verify_ed25519_batch(data: Uint8Array): boolean;
|
|
@@ -144,7 +184,6 @@ declare function decode(original_count: number, recovery_count: number, shards:
|
|
|
144
184
|
*/
|
|
145
185
|
declare class ShardsCollection {
|
|
146
186
|
free(): void;
|
|
147
|
-
constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
|
|
148
187
|
/**
|
|
149
188
|
* Extract the `indices` from this shards container.
|
|
150
189
|
*
|
|
@@ -152,6 +191,7 @@ declare class ShardsCollection {
|
|
|
152
191
|
* NOTE that subsequent calls to that method will return `None`.
|
|
153
192
|
*/
|
|
154
193
|
take_indices(): Uint16Array | undefined;
|
|
194
|
+
constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
|
|
155
195
|
/**
|
|
156
196
|
* Take the underlying `data` to the JS side.
|
|
157
197
|
*
|
|
@@ -171,16 +211,16 @@ declare class ShardsCollection {
|
|
|
171
211
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
172
212
|
interface InitOutput {
|
|
173
213
|
readonly memory: WebAssembly.Memory;
|
|
174
|
-
readonly __wbg_shardscollection_free: (a: number, b: number) => void;
|
|
175
214
|
readonly __wbg_get_shardscollection_length: (a: number) => number;
|
|
176
|
-
readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
|
|
177
215
|
readonly __wbg_get_shardscollection_shard_len: (a: number) => number;
|
|
216
|
+
readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
|
|
178
217
|
readonly __wbg_set_shardscollection_shard_len: (a: number, b: number) => void;
|
|
218
|
+
readonly __wbg_shardscollection_free: (a: number, b: number) => void;
|
|
219
|
+
readonly decode: (a: number, b: number, c: number) => [number, number, number];
|
|
220
|
+
readonly encode: (a: number, b: number) => [number, number, number];
|
|
179
221
|
readonly shardscollection_new: (a: number, b: any, c: number) => number;
|
|
180
|
-
readonly shardscollection_take_indices: (a: number) => any;
|
|
181
222
|
readonly shardscollection_take_data: (a: number) => any;
|
|
182
|
-
readonly
|
|
183
|
-
readonly decode: (a: number, b: number, c: number) => [number, number, number];
|
|
223
|
+
readonly shardscollection_take_indices: (a: number) => any;
|
|
184
224
|
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
185
225
|
readonly __externref_table_alloc: () => number;
|
|
186
226
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
@@ -214,9 +254,9 @@ declare function __wbg_init(module_or_path?: {
|
|
|
214
254
|
//#region native/index.d.ts
|
|
215
255
|
declare function initAll(): Promise<void>;
|
|
216
256
|
declare const init: {
|
|
217
|
-
bandersnatch:
|
|
218
|
-
ed25519:
|
|
219
|
-
reedSolomon:
|
|
257
|
+
bandersnatch: any;
|
|
258
|
+
ed25519: any;
|
|
259
|
+
reedSolomon: any;
|
|
220
260
|
};
|
|
221
261
|
//#endregion
|
|
222
262
|
export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };
|