@typeberry/native 0.0.4-c369217 → 0.2.0-173c341

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 +16 -82
  2. package/index.js +48 -221
  3. package/package.json +22 -1
package/index.d.ts CHANGED
@@ -1,68 +1,6 @@
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
- * 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
- /**
17
- * Seal verification as defined in:
18
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
19
- * or
20
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
21
- */
22
- declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
23
- /**
24
- * Verify multiple tickets at once as defined in:
25
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
26
- *
27
- * NOTE: the aux_data of VRF function is empty!
28
- */
29
- declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
30
- type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
31
- interface InitOutput$2 {
32
- readonly memory: WebAssembly.Memory;
33
- readonly ring_commitment: (a: number, b: number) => [number, number];
34
- readonly derive_public_key: (a: number, b: number) => [number, number];
35
- 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];
37
- readonly __wbindgen_export_0: WebAssembly.Table;
38
- readonly __wbindgen_malloc: (a: number, b: number) => number;
39
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
40
- readonly __wbindgen_start: () => void;
41
- }
42
- type SyncInitInput$2 = BufferSource | WebAssembly.Module;
43
- /**
44
- * Instantiates the given `module`, which can either be bytes or
45
- * a precompiled `WebAssembly.Module`.
46
- *
47
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
48
- *
49
- * @returns {InitOutput}
50
- */
51
- declare function initSync$2(module: {
52
- module: SyncInitInput$2;
53
- } | SyncInitInput$2): InitOutput$2;
1
+ import * as bandersnatch from "@typeberry/bandersnatch";
54
2
 
55
- /**
56
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
57
- * for everything else, calls `WebAssembly.instantiate` directly.
58
- *
59
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
60
- *
61
- * @returns {Promise<InitOutput>}
62
- */
63
- declare function __wbg_init$2(module_or_path?: {
64
- module_or_path: InitInput$2 | Promise<InitInput$2>;
65
- } | InitInput$2 | Promise<InitInput$2>): Promise<InitOutput$2>;
3
+ //#region ed25519/pkg/ed25519_wasm.d.ts
66
4
  declare namespace ed25519_wasm_d_exports {
67
5
  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 };
68
6
  }
@@ -70,18 +8,14 @@ declare namespace ed25519_wasm_d_exports {
70
8
  /* eslint-disable */
71
9
  /**
72
10
  *
73
- * * Verify Ed25519 signatures one by one using strict verification.
11
+ * * Verify Ed25519 signatures one by one.
74
12
  * *
75
- * * This function is slower but does strict verification.
76
- *
13
+ * * ed25519-consensus always does strict verification (ZIP-215 compatible).
77
14
  */
78
15
  declare function verify_ed25519(data: Uint8Array): Uint8Array;
79
16
  /**
80
17
  *
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.
18
+ * * ed25519-consensus doesn't have built-in batch verification.
85
19
  *
86
20
  */
87
21
  declare function verify_ed25519_batch(data: Uint8Array): boolean;
@@ -124,8 +58,8 @@ declare namespace reed_solomon_wasm_d_exports {
124
58
  }
125
59
  /* tslint:disable */
126
60
  /* eslint-disable */
127
- declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
128
61
  declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
62
+ declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
129
63
  /**
130
64
  * Collection of shards (either input or output).
131
65
  *
@@ -144,7 +78,6 @@ declare function decode(original_count: number, recovery_count: number, shards:
144
78
  */
145
79
  declare class ShardsCollection {
146
80
  free(): void;
147
- constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
148
81
  /**
149
82
  * Extract the `indices` from this shards container.
150
83
  *
@@ -152,6 +85,7 @@ declare class ShardsCollection {
152
85
  * NOTE that subsequent calls to that method will return `None`.
153
86
  */
154
87
  take_indices(): Uint16Array | undefined;
88
+ constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
155
89
  /**
156
90
  * Take the underlying `data` to the JS side.
157
91
  *
@@ -171,16 +105,16 @@ declare class ShardsCollection {
171
105
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
172
106
  interface InitOutput {
173
107
  readonly memory: WebAssembly.Memory;
174
- readonly __wbg_shardscollection_free: (a: number, b: number) => void;
175
108
  readonly __wbg_get_shardscollection_length: (a: number) => number;
176
- readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
177
109
  readonly __wbg_get_shardscollection_shard_len: (a: number) => number;
110
+ readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
178
111
  readonly __wbg_set_shardscollection_shard_len: (a: number, b: number) => void;
112
+ readonly __wbg_shardscollection_free: (a: number, b: number) => void;
113
+ readonly decode: (a: number, b: number, c: number) => [number, number, number];
114
+ readonly encode: (a: number, b: number) => [number, number, number];
179
115
  readonly shardscollection_new: (a: number, b: any, c: number) => number;
180
- readonly shardscollection_take_indices: (a: number) => any;
181
116
  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];
117
+ readonly shardscollection_take_indices: (a: number) => any;
184
118
  readonly __wbindgen_export_0: WebAssembly.Table;
185
119
  readonly __externref_table_alloc: () => number;
186
120
  readonly __externref_table_dealloc: (a: number) => void;
@@ -214,9 +148,9 @@ declare function __wbg_init(module_or_path?: {
214
148
  //#region native/index.d.ts
215
149
  declare function initAll(): Promise<void>;
216
150
  declare const init: {
217
- bandersnatch: any;
218
- ed25519: any;
219
- reedSolomon: any;
151
+ bandersnatch: () => Promise<any>;
152
+ ed25519: () => Promise<InitOutput$1>;
153
+ reedSolomon: () => Promise<InitOutput>;
220
154
  };
221
155
  //#endregion
222
- export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };
156
+ export { bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };