@unknownncat/curve25519-node 1.0.1 → 2.1.0

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 (65) hide show
  1. package/NOTICE.md +89 -0
  2. package/README.en.md +422 -0
  3. package/README.md +309 -112
  4. package/SECURITY.md +23 -0
  5. package/THIRD_PARTY_NOTICE.md +3 -0
  6. package/THIRD_PARTY_NOTICES.md +5 -0
  7. package/dist/axlsign.d.ts +31 -0
  8. package/dist/axlsign.d.ts.map +1 -0
  9. package/dist/axlsign.js +118 -0
  10. package/dist/axlsign.js.map +1 -0
  11. package/dist/cjs/axlsign.js +127 -0
  12. package/dist/cjs/axlsign.js.map +1 -0
  13. package/dist/cjs/ed25519.js +46 -10
  14. package/dist/cjs/ed25519.js.map +1 -1
  15. package/dist/cjs/index.js +41 -1
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/cjs/internal/assert.js.map +1 -1
  18. package/dist/cjs/internal/axlsign-wasm/LICENSE +21 -0
  19. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm.d.ts +12 -0
  20. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm.js +171 -0
  21. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm_bg.wasm +0 -0
  22. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm_bg.wasm.d.ts +13 -0
  23. package/dist/cjs/internal/axlsign-wasm/package.json +17 -0
  24. package/dist/cjs/internal/curve25519-wasm/LICENSE +21 -0
  25. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.d.ts +12 -0
  26. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.js +165 -0
  27. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
  28. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +13 -0
  29. package/dist/cjs/internal/curve25519-wasm/package.json +17 -0
  30. package/dist/cjs/wasm.js +228 -0
  31. package/dist/cjs/wasm.js.map +1 -0
  32. package/dist/cjs/x25519.js +73 -12
  33. package/dist/cjs/x25519.js.map +1 -1
  34. package/dist/ed25519.d.ts +21 -0
  35. package/dist/ed25519.d.ts.map +1 -1
  36. package/dist/ed25519.js +44 -13
  37. package/dist/ed25519.js.map +1 -1
  38. package/dist/index.d.ts +109 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +40 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/internal/assert.js.map +1 -1
  43. package/dist/internal/axlsign-wasm/LICENSE +21 -0
  44. package/dist/internal/axlsign-wasm/axlsign_wasm.d.ts +12 -0
  45. package/dist/internal/axlsign-wasm/axlsign_wasm.js +171 -0
  46. package/dist/internal/axlsign-wasm/axlsign_wasm_bg.wasm +0 -0
  47. package/dist/internal/axlsign-wasm/axlsign_wasm_bg.wasm.d.ts +13 -0
  48. package/dist/internal/axlsign-wasm/package.json +17 -0
  49. package/dist/internal/curve25519-wasm/LICENSE +21 -0
  50. package/dist/internal/curve25519-wasm/curve25519_wasm.d.ts +12 -0
  51. package/dist/internal/curve25519-wasm/curve25519_wasm.js +165 -0
  52. package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
  53. package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +13 -0
  54. package/dist/internal/curve25519-wasm/package.json +17 -0
  55. package/dist/types.d.ts +2 -5
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/wasm.d.ts +92 -0
  58. package/dist/wasm.d.ts.map +1 -0
  59. package/dist/wasm.js +204 -0
  60. package/dist/wasm.js.map +1 -0
  61. package/dist/x25519.d.ts +29 -0
  62. package/dist/x25519.d.ts.map +1 -1
  63. package/dist/x25519.js +66 -12
  64. package/dist/x25519.js.map +1 -1
  65. package/package.json +38 -5
@@ -0,0 +1,171 @@
1
+ /* @ts-self-types="./axlsign_wasm.d.ts" */
2
+
3
+ /**
4
+ * @param {Uint8Array} secret_key
5
+ * @returns {Uint8Array}
6
+ */
7
+ function axlsignPublicKey(secret_key) {
8
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
9
+ const len0 = WASM_VECTOR_LEN;
10
+ const ret = wasm.axlsignPublicKey(ptr0, len0);
11
+ if (ret[3]) {
12
+ throw takeFromExternrefTable0(ret[2]);
13
+ }
14
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
15
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
16
+ return v2;
17
+ }
18
+ exports.axlsignPublicKey = axlsignPublicKey;
19
+
20
+ /**
21
+ * @param {Uint8Array} secret_key
22
+ * @param {Uint8Array} public_key
23
+ * @returns {Uint8Array}
24
+ */
25
+ function axlsignSharedKey(secret_key, public_key) {
26
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
27
+ const len0 = WASM_VECTOR_LEN;
28
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
29
+ const len1 = WASM_VECTOR_LEN;
30
+ const ret = wasm.axlsignSharedKey(ptr0, len0, ptr1, len1);
31
+ if (ret[3]) {
32
+ throw takeFromExternrefTable0(ret[2]);
33
+ }
34
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
35
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
36
+ return v3;
37
+ }
38
+ exports.axlsignSharedKey = axlsignSharedKey;
39
+
40
+ /**
41
+ * @param {Uint8Array} secret_key
42
+ * @param {Uint8Array} msg
43
+ * @returns {Uint8Array}
44
+ */
45
+ function axlsignSign(secret_key, msg) {
46
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
47
+ const len0 = WASM_VECTOR_LEN;
48
+ const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
49
+ const len1 = WASM_VECTOR_LEN;
50
+ const ret = wasm.axlsignSign(ptr0, len0, ptr1, len1);
51
+ if (ret[3]) {
52
+ throw takeFromExternrefTable0(ret[2]);
53
+ }
54
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
55
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
56
+ return v3;
57
+ }
58
+ exports.axlsignSign = axlsignSign;
59
+
60
+ /**
61
+ * @param {Uint8Array} secret_key
62
+ * @param {Uint8Array} msg
63
+ * @param {Uint8Array} rnd
64
+ * @returns {Uint8Array}
65
+ */
66
+ function axlsignSignRnd(secret_key, msg, rnd) {
67
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
68
+ const len0 = WASM_VECTOR_LEN;
69
+ const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
70
+ const len1 = WASM_VECTOR_LEN;
71
+ const ptr2 = passArray8ToWasm0(rnd, wasm.__wbindgen_malloc);
72
+ const len2 = WASM_VECTOR_LEN;
73
+ const ret = wasm.axlsignSignRnd(ptr0, len0, ptr1, len1, ptr2, len2);
74
+ if (ret[3]) {
75
+ throw takeFromExternrefTable0(ret[2]);
76
+ }
77
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
78
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
79
+ return v4;
80
+ }
81
+ exports.axlsignSignRnd = axlsignSignRnd;
82
+
83
+ /**
84
+ * @param {Uint8Array} public_key
85
+ * @param {Uint8Array} msg
86
+ * @param {Uint8Array} signature
87
+ * @returns {boolean}
88
+ */
89
+ function axlsignVerify(public_key, msg, signature) {
90
+ const ptr0 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
91
+ const len0 = WASM_VECTOR_LEN;
92
+ const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
93
+ const len1 = WASM_VECTOR_LEN;
94
+ const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
95
+ const len2 = WASM_VECTOR_LEN;
96
+ const ret = wasm.axlsignVerify(ptr0, len0, ptr1, len1, ptr2, len2);
97
+ if (ret[2]) {
98
+ throw takeFromExternrefTable0(ret[1]);
99
+ }
100
+ return ret[0] !== 0;
101
+ }
102
+ exports.axlsignVerify = axlsignVerify;
103
+
104
+ function __wbg_get_imports() {
105
+ const import0 = {
106
+ __proto__: null,
107
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
108
+ // Cast intrinsic for `Ref(String) -> Externref`.
109
+ const ret = getStringFromWasm0(arg0, arg1);
110
+ return ret;
111
+ },
112
+ __wbindgen_init_externref_table: function() {
113
+ const table = wasm.__wbindgen_externrefs;
114
+ const offset = table.grow(4);
115
+ table.set(0, undefined);
116
+ table.set(offset + 0, undefined);
117
+ table.set(offset + 1, null);
118
+ table.set(offset + 2, true);
119
+ table.set(offset + 3, false);
120
+ },
121
+ };
122
+ return {
123
+ __proto__: null,
124
+ "./axlsign_wasm_bg.js": import0,
125
+ };
126
+ }
127
+
128
+ function getArrayU8FromWasm0(ptr, len) {
129
+ ptr = ptr >>> 0;
130
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
131
+ }
132
+
133
+ function getStringFromWasm0(ptr, len) {
134
+ ptr = ptr >>> 0;
135
+ return decodeText(ptr, len);
136
+ }
137
+
138
+ let cachedUint8ArrayMemory0 = null;
139
+ function getUint8ArrayMemory0() {
140
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
141
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
142
+ }
143
+ return cachedUint8ArrayMemory0;
144
+ }
145
+
146
+ function passArray8ToWasm0(arg, malloc) {
147
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
148
+ getUint8ArrayMemory0().set(arg, ptr / 1);
149
+ WASM_VECTOR_LEN = arg.length;
150
+ return ptr;
151
+ }
152
+
153
+ function takeFromExternrefTable0(idx) {
154
+ const value = wasm.__wbindgen_externrefs.get(idx);
155
+ wasm.__externref_table_dealloc(idx);
156
+ return value;
157
+ }
158
+
159
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
160
+ cachedTextDecoder.decode();
161
+ function decodeText(ptr, len) {
162
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
163
+ }
164
+
165
+ let WASM_VECTOR_LEN = 0;
166
+
167
+ const wasmPath = `${__dirname}/axlsign_wasm_bg.wasm`;
168
+ const wasmBytes = require('fs').readFileSync(wasmPath);
169
+ const wasmModule = new WebAssembly.Module(wasmBytes);
170
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
171
+ wasm.__wbindgen_start();
@@ -0,0 +1,13 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const axlsignPublicKey: (a: number, b: number) => [number, number, number, number];
5
+ export const axlsignSharedKey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
6
+ export const axlsignSign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
7
+ export const axlsignSignRnd: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
8
+ export const axlsignVerify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
9
+ export const __wbindgen_externrefs: WebAssembly.Table;
10
+ export const __wbindgen_malloc: (a: number, b: number) => number;
11
+ export const __externref_table_dealloc: (a: number) => void;
12
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
13
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "curve25519-node-axlsign",
3
+ "description": "axlsign-compatible primitives for curve25519-node via wasm-bindgen",
4
+ "version": "0.1.0",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/unknownncat/curve25519-node"
9
+ },
10
+ "files": [
11
+ "axlsign_wasm_bg.wasm",
12
+ "axlsign_wasm.js",
13
+ "axlsign_wasm.d.ts"
14
+ ],
15
+ "main": "axlsign_wasm.js",
16
+ "types": "axlsign_wasm.d.ts"
17
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sem nome bah
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function ed25519PublicKey(secret_seed: Uint8Array): Uint8Array;
5
+
6
+ export function ed25519Sign(secret_seed: Uint8Array, msg: Uint8Array): Uint8Array;
7
+
8
+ export function ed25519Verify(public_key: Uint8Array, msg: Uint8Array, signature: Uint8Array): boolean;
9
+
10
+ export function x25519PublicKey(secret_key: Uint8Array): Uint8Array;
11
+
12
+ export function x25519SharedKey(secret_key: Uint8Array, public_key: Uint8Array): Uint8Array;
@@ -0,0 +1,165 @@
1
+ /* @ts-self-types="./curve25519_wasm.d.ts" */
2
+
3
+ /**
4
+ * @param {Uint8Array} secret_seed
5
+ * @returns {Uint8Array}
6
+ */
7
+ function ed25519PublicKey(secret_seed) {
8
+ const ptr0 = passArray8ToWasm0(secret_seed, wasm.__wbindgen_malloc);
9
+ const len0 = WASM_VECTOR_LEN;
10
+ const ret = wasm.ed25519PublicKey(ptr0, len0);
11
+ if (ret[3]) {
12
+ throw takeFromExternrefTable0(ret[2]);
13
+ }
14
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
15
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
16
+ return v2;
17
+ }
18
+ exports.ed25519PublicKey = ed25519PublicKey;
19
+
20
+ /**
21
+ * @param {Uint8Array} secret_seed
22
+ * @param {Uint8Array} msg
23
+ * @returns {Uint8Array}
24
+ */
25
+ function ed25519Sign(secret_seed, msg) {
26
+ const ptr0 = passArray8ToWasm0(secret_seed, wasm.__wbindgen_malloc);
27
+ const len0 = WASM_VECTOR_LEN;
28
+ const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
29
+ const len1 = WASM_VECTOR_LEN;
30
+ const ret = wasm.ed25519Sign(ptr0, len0, ptr1, len1);
31
+ if (ret[3]) {
32
+ throw takeFromExternrefTable0(ret[2]);
33
+ }
34
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
35
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
36
+ return v3;
37
+ }
38
+ exports.ed25519Sign = ed25519Sign;
39
+
40
+ /**
41
+ * @param {Uint8Array} public_key
42
+ * @param {Uint8Array} msg
43
+ * @param {Uint8Array} signature
44
+ * @returns {boolean}
45
+ */
46
+ function ed25519Verify(public_key, msg, signature) {
47
+ const ptr0 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
48
+ const len0 = WASM_VECTOR_LEN;
49
+ const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
50
+ const len1 = WASM_VECTOR_LEN;
51
+ const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
52
+ const len2 = WASM_VECTOR_LEN;
53
+ const ret = wasm.ed25519Verify(ptr0, len0, ptr1, len1, ptr2, len2);
54
+ if (ret[2]) {
55
+ throw takeFromExternrefTable0(ret[1]);
56
+ }
57
+ return ret[0] !== 0;
58
+ }
59
+ exports.ed25519Verify = ed25519Verify;
60
+
61
+ /**
62
+ * @param {Uint8Array} secret_key
63
+ * @returns {Uint8Array}
64
+ */
65
+ function x25519PublicKey(secret_key) {
66
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
67
+ const len0 = WASM_VECTOR_LEN;
68
+ const ret = wasm.x25519PublicKey(ptr0, len0);
69
+ if (ret[3]) {
70
+ throw takeFromExternrefTable0(ret[2]);
71
+ }
72
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
73
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
74
+ return v2;
75
+ }
76
+ exports.x25519PublicKey = x25519PublicKey;
77
+
78
+ /**
79
+ * @param {Uint8Array} secret_key
80
+ * @param {Uint8Array} public_key
81
+ * @returns {Uint8Array}
82
+ */
83
+ function x25519SharedKey(secret_key, public_key) {
84
+ const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_malloc);
85
+ const len0 = WASM_VECTOR_LEN;
86
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
87
+ const len1 = WASM_VECTOR_LEN;
88
+ const ret = wasm.x25519SharedKey(ptr0, len0, ptr1, len1);
89
+ if (ret[3]) {
90
+ throw takeFromExternrefTable0(ret[2]);
91
+ }
92
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
93
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
94
+ return v3;
95
+ }
96
+ exports.x25519SharedKey = x25519SharedKey;
97
+
98
+ function __wbg_get_imports() {
99
+ const import0 = {
100
+ __proto__: null,
101
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
102
+ // Cast intrinsic for `Ref(String) -> Externref`.
103
+ const ret = getStringFromWasm0(arg0, arg1);
104
+ return ret;
105
+ },
106
+ __wbindgen_init_externref_table: function() {
107
+ const table = wasm.__wbindgen_externrefs;
108
+ const offset = table.grow(4);
109
+ table.set(0, undefined);
110
+ table.set(offset + 0, undefined);
111
+ table.set(offset + 1, null);
112
+ table.set(offset + 2, true);
113
+ table.set(offset + 3, false);
114
+ },
115
+ };
116
+ return {
117
+ __proto__: null,
118
+ "./curve25519_wasm_bg.js": import0,
119
+ };
120
+ }
121
+
122
+ function getArrayU8FromWasm0(ptr, len) {
123
+ ptr = ptr >>> 0;
124
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
125
+ }
126
+
127
+ function getStringFromWasm0(ptr, len) {
128
+ ptr = ptr >>> 0;
129
+ return decodeText(ptr, len);
130
+ }
131
+
132
+ let cachedUint8ArrayMemory0 = null;
133
+ function getUint8ArrayMemory0() {
134
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
135
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
136
+ }
137
+ return cachedUint8ArrayMemory0;
138
+ }
139
+
140
+ function passArray8ToWasm0(arg, malloc) {
141
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
142
+ getUint8ArrayMemory0().set(arg, ptr / 1);
143
+ WASM_VECTOR_LEN = arg.length;
144
+ return ptr;
145
+ }
146
+
147
+ function takeFromExternrefTable0(idx) {
148
+ const value = wasm.__wbindgen_externrefs.get(idx);
149
+ wasm.__externref_table_dealloc(idx);
150
+ return value;
151
+ }
152
+
153
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
154
+ cachedTextDecoder.decode();
155
+ function decodeText(ptr, len) {
156
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
157
+ }
158
+
159
+ let WASM_VECTOR_LEN = 0;
160
+
161
+ const wasmPath = `${__dirname}/curve25519_wasm_bg.wasm`;
162
+ const wasmBytes = require('fs').readFileSync(wasmPath);
163
+ const wasmModule = new WebAssembly.Module(wasmBytes);
164
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
165
+ wasm.__wbindgen_start();
@@ -0,0 +1,13 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const ed25519PublicKey: (a: number, b: number) => [number, number, number, number];
5
+ export const ed25519Sign: (a: number, b: number, c: number, d: number) => [number, number, number, number];
6
+ export const ed25519Verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
7
+ export const x25519PublicKey: (a: number, b: number) => [number, number, number, number];
8
+ export const x25519SharedKey: (a: number, b: number, c: number, d: number) => [number, number, number, number];
9
+ export const __wbindgen_externrefs: WebAssembly.Table;
10
+ export const __wbindgen_malloc: (a: number, b: number) => number;
11
+ export const __externref_table_dealloc: (a: number) => void;
12
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
13
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "curve25519-node-wasm",
3
+ "description": "WASM primitives for curve25519-node modern API",
4
+ "version": "0.1.0",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/unknownncat/curve25519-node"
9
+ },
10
+ "files": [
11
+ "curve25519_wasm_bg.wasm",
12
+ "curve25519_wasm.js",
13
+ "curve25519_wasm.d.ts"
14
+ ],
15
+ "main": "curve25519_wasm.js",
16
+ "types": "curve25519_wasm.d.ts"
17
+ }
package/dist/types.d.ts CHANGED
@@ -1,14 +1,11 @@
1
- declare const bytes32Brand: unique symbol;
2
- declare const bytes64Brand: unique symbol;
3
1
  export type Bytes32 = Uint8Array & {
4
- readonly __brand: typeof bytes32Brand;
2
+ readonly __brand: "Bytes32";
5
3
  };
6
4
  export type Bytes64 = Uint8Array & {
7
- readonly __brand: typeof bytes64Brand;
5
+ readonly __brand: "Bytes64";
8
6
  };
9
7
  export interface KeyPair32 {
10
8
  public: Bytes32;
11
9
  private: Bytes32;
12
10
  }
13
- export {};
14
11
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,YAAY,EAAE,OAAO,MAAM,CAAC;AAC1C,OAAO,CAAC,MAAM,YAAY,EAAE,OAAO,MAAM,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,YAAY,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,YAAY,CAAA;CAAE,CAAC;AAE7E,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AACnE,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAEnE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB"}
package/dist/wasm.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ import type { Bytes32, Bytes64, KeyPair32 } from "./types.js";
2
+ export interface WasmX25519PrivateKeyObject {
3
+ readonly type: "x25519-private";
4
+ readonly bytes: Bytes32;
5
+ }
6
+ export interface WasmX25519PublicKeyObject {
7
+ readonly type: "x25519-public";
8
+ readonly bytes: Bytes32;
9
+ }
10
+ export interface WasmEd25519PrivateKeyObject {
11
+ readonly type: "ed25519-private";
12
+ readonly bytes: Bytes32;
13
+ }
14
+ export interface WasmEd25519PublicKeyObject {
15
+ readonly type: "ed25519-public";
16
+ readonly bytes: Bytes32;
17
+ }
18
+ export declare function isAllZero32(bytes32: Bytes32): boolean;
19
+ export declare function x25519CreatePrivateKeyObject(secretKey32: Bytes32): WasmX25519PrivateKeyObject;
20
+ export declare function x25519CreatePublicKeyObject(publicKey32: Bytes32): WasmX25519PublicKeyObject;
21
+ export declare function x25519PublicKeyFromPrivateKeyObject(privateKey: WasmX25519PrivateKeyObject): Bytes32;
22
+ export declare function x25519PublicKey(secretKey32: Bytes32): Bytes32;
23
+ export declare function x25519SharedKeyFromKeyObjects(privateKey: WasmX25519PrivateKeyObject, publicKey: WasmX25519PublicKeyObject): Bytes32;
24
+ export declare function x25519SharedKey(secretKey32: Bytes32, publicKey32: Bytes32): Bytes32;
25
+ export declare function x25519SharedKeyStrictFromKeyObjects(privateKey: WasmX25519PrivateKeyObject, publicKey: WasmX25519PublicKeyObject): Bytes32;
26
+ export declare function x25519SharedKeyStrict(secretKey32: Bytes32, publicKey32: Bytes32): Bytes32;
27
+ export declare function x25519GenerateKeyPair(seed32: Bytes32): KeyPair32;
28
+ export declare function ed25519CreatePrivateKeyObject(secretSeed32: Bytes32): WasmEd25519PrivateKeyObject;
29
+ export declare function ed25519CreatePublicKeyObject(publicKey32: Bytes32): WasmEd25519PublicKeyObject;
30
+ export declare function ed25519PublicKeyFromPrivateKeyObject(privateKey: WasmEd25519PrivateKeyObject): Bytes32;
31
+ export declare function ed25519PublicKey(secretSeed32: Bytes32): Bytes32;
32
+ export declare function ed25519GenerateKeyPair(seed32: Bytes32): KeyPair32;
33
+ export declare function ed25519SignWithPrivateKey(privateKey: WasmEd25519PrivateKeyObject, msg: Uint8Array): Bytes64;
34
+ export declare function ed25519Sign(secretSeed32: Bytes32, msg: Uint8Array): Bytes64;
35
+ export declare function ed25519VerifyWithPublicKey(publicKey: WasmEd25519PublicKeyObject, msg: Uint8Array, signature64: Bytes64): boolean;
36
+ export declare function ed25519Verify(publicKey32: Bytes32, msg: Uint8Array, signature64: Bytes64): boolean;
37
+ export declare function ed25519SignMessage(secretSeed32: Bytes32, msg: Uint8Array): Uint8Array;
38
+ export declare function ed25519OpenMessage(publicKey32: Bytes32, signedMsg: Uint8Array): Uint8Array | null;
39
+ export declare const x25519: {
40
+ readonly createPrivateKeyObject: typeof x25519CreatePrivateKeyObject;
41
+ readonly createPublicKeyObject: typeof x25519CreatePublicKeyObject;
42
+ readonly publicKeyFromPrivateKeyObject: typeof x25519PublicKeyFromPrivateKeyObject;
43
+ readonly publicKey: typeof x25519PublicKey;
44
+ readonly sharedKey: typeof x25519SharedKey;
45
+ readonly sharedKeyFromKeyObjects: typeof x25519SharedKeyFromKeyObjects;
46
+ readonly sharedKeyStrict: typeof x25519SharedKeyStrict;
47
+ readonly sharedKeyStrictFromKeyObjects: typeof x25519SharedKeyStrictFromKeyObjects;
48
+ readonly isAllZero32: typeof isAllZero32;
49
+ readonly generateKeyPair: typeof x25519GenerateKeyPair;
50
+ };
51
+ export declare const ed25519: {
52
+ readonly createPrivateKeyObject: typeof ed25519CreatePrivateKeyObject;
53
+ readonly createPublicKeyObject: typeof ed25519CreatePublicKeyObject;
54
+ readonly publicKeyFromPrivateKeyObject: typeof ed25519PublicKeyFromPrivateKeyObject;
55
+ readonly publicKey: typeof ed25519PublicKey;
56
+ readonly generateKeyPair: typeof ed25519GenerateKeyPair;
57
+ readonly sign: typeof ed25519Sign;
58
+ readonly signWithPrivateKey: typeof ed25519SignWithPrivateKey;
59
+ readonly verify: typeof ed25519Verify;
60
+ readonly verifyWithPublicKey: typeof ed25519VerifyWithPublicKey;
61
+ readonly signMessage: typeof ed25519SignMessage;
62
+ readonly openMessage: typeof ed25519OpenMessage;
63
+ };
64
+ declare const api: {
65
+ readonly x25519: {
66
+ readonly createPrivateKeyObject: typeof x25519CreatePrivateKeyObject;
67
+ readonly createPublicKeyObject: typeof x25519CreatePublicKeyObject;
68
+ readonly publicKeyFromPrivateKeyObject: typeof x25519PublicKeyFromPrivateKeyObject;
69
+ readonly publicKey: typeof x25519PublicKey;
70
+ readonly sharedKey: typeof x25519SharedKey;
71
+ readonly sharedKeyFromKeyObjects: typeof x25519SharedKeyFromKeyObjects;
72
+ readonly sharedKeyStrict: typeof x25519SharedKeyStrict;
73
+ readonly sharedKeyStrictFromKeyObjects: typeof x25519SharedKeyStrictFromKeyObjects;
74
+ readonly isAllZero32: typeof isAllZero32;
75
+ readonly generateKeyPair: typeof x25519GenerateKeyPair;
76
+ };
77
+ readonly ed25519: {
78
+ readonly createPrivateKeyObject: typeof ed25519CreatePrivateKeyObject;
79
+ readonly createPublicKeyObject: typeof ed25519CreatePublicKeyObject;
80
+ readonly publicKeyFromPrivateKeyObject: typeof ed25519PublicKeyFromPrivateKeyObject;
81
+ readonly publicKey: typeof ed25519PublicKey;
82
+ readonly generateKeyPair: typeof ed25519GenerateKeyPair;
83
+ readonly sign: typeof ed25519Sign;
84
+ readonly signWithPrivateKey: typeof ed25519SignWithPrivateKey;
85
+ readonly verify: typeof ed25519Verify;
86
+ readonly verifyWithPublicKey: typeof ed25519VerifyWithPublicKey;
87
+ readonly signMessage: typeof ed25519SignMessage;
88
+ readonly openMessage: typeof ed25519OpenMessage;
89
+ };
90
+ };
91
+ export default api;
92
+ //# sourceMappingURL=wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"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"}