@typeberry/native 0.0.1-64ee5ed → 0.0.1-b29cbf6

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,133 @@
1
+ declare namespace bandersnatch_d_exports {
2
+ export { batch_verify_tickets, derive_public_key, 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
+ declare namespace ed25519_wasm_d_exports {
44
+ export { verify_ed25519, verify_ed25519_batch };
45
+ }
46
+ /* tslint:disable */
47
+ /* eslint-disable */
48
+ /**
49
+ *
50
+ * * Verify Ed25519 signatures one by one using strict verification.
51
+ * *
52
+ * * This function is slower but does strict verification.
53
+ *
54
+ */
55
+ declare function verify_ed25519(data: Uint8Array): Uint8Array;
56
+ /**
57
+ *
58
+ * * Verify Ed25519 signatures using build-in batch verification.
59
+ * *
60
+ * * This function is faster but does not do strict verification.
61
+ * * See https://crates.io/crates/ed25519-dalek#batch-verification for more information.
62
+ *
63
+ */
64
+ declare function verify_ed25519_batch(data: Uint8Array): boolean;
65
+ declare namespace reed_solomon_wasm_d_exports {
66
+ export { ShardsCollection, decode, encode };
67
+ }
68
+ /* tslint:disable */
69
+ /* eslint-disable */
70
+ /**
71
+ * @param {number} recovery_count
72
+ * @param {ShardsCollection} shards
73
+ * @returns {ShardsCollection}
74
+ */
75
+ declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
76
+ /**
77
+ * @param {number} original_count
78
+ * @param {number} recovery_count
79
+ * @param {ShardsCollection} shards
80
+ * @returns {ShardsCollection}
81
+ */
82
+ declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
83
+ /**
84
+ * Collection of shards (either input or output).
85
+ *
86
+ * To efficiently pass data between JS and WASM all of the shards
87
+ * are passed as one big vector of bytes.
88
+ * It's assumed that every shard has the same length (`shard_len`).
89
+ * If the shards are NOT passed in the exact order they were created
90
+ * it's possible to pass `indices` array.
91
+ * A value of `indices` array at position `idx` is the shard index
92
+ * that resides at `[ idx * shard_len .. idx * shard_len + shard_len )`
93
+ * in `data` array.
94
+ *
95
+ * This collection is only used to get the data from JS or pass the data back.
96
+ * Internally we convert it to [`RsShardsCollection`], which copies
97
+ * the memory to/from WASM.
98
+ */
99
+ declare class ShardsCollection {
100
+ free(): void;
101
+ /**
102
+ * @param {number} shard_len
103
+ * @param {Uint8Array} data
104
+ * @param {Uint16Array | undefined} [indices]
105
+ */
106
+ constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array);
107
+ /**
108
+ * Extract the `indices` from this shards container.
109
+ *
110
+ * Should be called on the JS side to avoid copying.
111
+ * NOTE that subsequent calls to that method will return `None`.
112
+ * @returns {Uint16Array | undefined}
113
+ */
114
+ take_indices(): Uint16Array | undefined;
115
+ /**
116
+ * Take the underlying `data` to the JS side.
117
+ *
118
+ * NOTE this object is destroyed after the data is consumed,
119
+ * so make sure to [`take_indices`] first.
120
+ * @returns {Uint8Array}
121
+ */
122
+ take_data(): Uint8Array;
123
+ /**
124
+ * Number of shards within the collection.
125
+ */
126
+ length: number;
127
+ /**
128
+ * The length of each shard.
129
+ */
130
+ shard_len: number;
131
+ }
132
+ //#endregion
133
+ export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, reed_solomon_wasm_d_exports as reedSolomon };
package/index.js CHANGED
@@ -1,17 +1,5 @@
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
- });
1
+ import { __export, __require } from "./chunk-CPmnHcRE.js";
13
2
 
14
- //#endregion
15
3
  //#region \0wasmHelpers.js
16
4
  function _loadWasmModule(sync, filepath, src, imports) {
17
5
  function _instantiateOrCompile(source, imports$1, stream) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/native",
3
- "version": "0.0.1-64ee5ed",
3
+ "version": "0.0.1-b29cbf6",
4
4
  "main": "./index.js",
5
5
  "type": "module",
6
6
  "author": "Fluffy Labs",