@typeberry/native 0.0.4-68ac75d → 0.0.4-86135cc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +69 -29
  2. package/index.js +180 -76
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,18 +1,40 @@
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
6
  /**
7
- * Generate ring commitment given concatenation of ring keys.
7
+ * Compute VRF output hash from a secret seed and input data.
8
+ *
9
+ * This function derives a deterministic VRF output hash without generating a proof.
10
+ * Unlike `generate_seal`, this produces only the output hash, not a verifiable signature.
11
+ *
12
+ * # Arguments
13
+ * * `secret_seed` - Seed used to derive the secret key
14
+ * * `input` - VRF input data to be hashed
15
+ *
16
+ * # Returns
17
+ * A byte vector with the following format:
18
+ * - On success (33 bytes):
19
+ * - Byte 0: Status code `0` (RESULT_OK)
20
+ * - Bytes 1-32: VRF output hash (32 bytes)
21
+ * - On error (1 byte):
22
+ * - Byte 0: Status code `1` (RESULT_ERR)
23
+ *
24
+ * Returns an error if the input cannot be converted to a valid VRF input point.
8
25
  */
9
- declare function ring_commitment(keys: Uint8Array): Uint8Array;
26
+ declare function vrf_output_hash(secret_seed: Uint8Array, input: Uint8Array): Uint8Array;
10
27
  /**
11
- * Derive Private and Public Key from Seed
28
+ * Verify multiple tickets at once as defined in:
29
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
12
30
  *
13
- * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
31
+ * NOTE: the aux_data of VRF function is empty!
14
32
  */
15
- declare function derive_public_key(seed: Uint8Array): Uint8Array;
33
+ declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
34
+ /**
35
+ * Generate ring commitment given concatenation of ring keys.
36
+ */
37
+ declare function ring_commitment(keys: Uint8Array): Uint8Array;
16
38
  /**
17
39
  * Seal verification as defined in:
18
40
  * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
@@ -21,19 +43,41 @@ declare function derive_public_key(seed: Uint8Array): Uint8Array;
21
43
  */
22
44
  declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
23
45
  /**
24
- * Verify multiple tickets at once as defined in:
25
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
46
+ * Generate seal that is verifiable using `verify_seal` function.
26
47
  *
27
- * NOTE: the aux_data of VRF function is empty!
48
+ * # Arguments
49
+ * * `secret_seed` - Seed used to derive the secret key
50
+ * * `input` - VRF input data
51
+ * * `aux_data` - Auxiliary data for the VRF proof
52
+ *
53
+ * # Returns
54
+ * A byte vector with the following format:
55
+ * - On success (97 bytes):
56
+ * - Byte 0: Status code `0` (RESULT_OK)
57
+ * - Bytes 1-32: Serialized VRF output (32 bytes, compressed) NOTE: not output hash!
58
+ * - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
59
+ * - On error (1 byte):
60
+ * - Byte 0: Status code `1` (RESULT_ERR)
61
+ *
62
+ * Returns an error if the input cannot be converted to a valid VRF input point
63
+ * or if serialization of the output or proof fails.
28
64
  */
29
- declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
65
+ declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
66
+ /**
67
+ * Derive Private and Public Key from Seed
68
+ *
69
+ * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
70
+ */
71
+ declare function derive_public_key(seed: 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 ring_commitment: (a: number, b: number) => [number, number];
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 batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
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 using strict verification.
117
+ * * Verify Ed25519 signatures one by one.
74
118
  * *
75
- * * This function is slower but does strict verification.
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
- * * Verify Ed25519 signatures using build-in batch verification.
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;
@@ -124,8 +164,8 @@ declare namespace reed_solomon_wasm_d_exports {
124
164
  }
125
165
  /* tslint:disable */
126
166
  /* eslint-disable */
127
- declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
128
167
  declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
168
+ declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
129
169
  /**
130
170
  * Collection of shards (either input or output).
131
171
  *
@@ -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 encode: (a: number, b: number) => [number, number, number];
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: () => Promise<InitOutput$2>;
218
- ed25519: () => Promise<InitOutput$1>;
219
- reedSolomon: () => Promise<InitOutput>;
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 };