@unknownncat/curve25519-node 2.1.1 → 2.1.2

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 (44) hide show
  1. package/NOTICE.md +6 -6
  2. package/README.en.md +34 -407
  3. package/README.md +35 -408
  4. package/dist/axlsign.d.ts +1 -1
  5. package/dist/axlsign.d.ts.map +1 -1
  6. package/dist/axlsign.js +8 -50
  7. package/dist/axlsign.js.map +1 -1
  8. package/dist/cjs/axlsign.js +8 -50
  9. package/dist/cjs/axlsign.js.map +1 -1
  10. package/dist/cjs/index.js +2 -11
  11. package/dist/cjs/index.js.map +1 -1
  12. package/dist/cjs/internal/assert.js +1 -1
  13. package/dist/cjs/internal/assert.js.map +1 -1
  14. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm.js +129 -65
  15. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm_bg.wasm +0 -0
  16. package/dist/cjs/internal/axlsign-wasm/axlsign_wasm_bg.wasm.d.ts +8 -10
  17. package/dist/index.d.ts +1 -59
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -10
  20. package/dist/index.js.map +1 -1
  21. package/dist/internal/assert.js +1 -1
  22. package/dist/internal/assert.js.map +1 -1
  23. package/dist/internal/axlsign-wasm/axlsign_wasm.js +129 -65
  24. package/dist/internal/axlsign-wasm/axlsign_wasm_bg.wasm +0 -0
  25. package/dist/internal/axlsign-wasm/axlsign_wasm_bg.wasm.d.ts +8 -10
  26. package/package.json +8 -24
  27. package/dist/cjs/internal/curve25519-wasm/LICENSE +0 -21
  28. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.d.ts +0 -12
  29. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.js +0 -165
  30. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
  31. package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +0 -13
  32. package/dist/cjs/internal/curve25519-wasm/package.json +0 -17
  33. package/dist/cjs/wasm.js +0 -249
  34. package/dist/cjs/wasm.js.map +0 -1
  35. package/dist/internal/curve25519-wasm/LICENSE +0 -21
  36. package/dist/internal/curve25519-wasm/curve25519_wasm.d.ts +0 -12
  37. package/dist/internal/curve25519-wasm/curve25519_wasm.js +0 -165
  38. package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
  39. package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +0 -13
  40. package/dist/internal/curve25519-wasm/package.json +0 -17
  41. package/dist/wasm.d.ts +0 -92
  42. package/dist/wasm.d.ts.map +0 -1
  43. package/dist/wasm.js +0 -225
  44. package/dist/wasm.js.map +0 -1
package/dist/cjs/wasm.js DELETED
@@ -1,249 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ed25519 = exports.x25519 = void 0;
4
- exports.isAllZero32 = isAllZero32;
5
- exports.x25519CreatePrivateKeyObject = x25519CreatePrivateKeyObject;
6
- exports.x25519CreatePublicKeyObject = x25519CreatePublicKeyObject;
7
- exports.x25519PublicKeyFromPrivateKeyObject = x25519PublicKeyFromPrivateKeyObject;
8
- exports.x25519PublicKey = x25519PublicKey;
9
- exports.x25519SharedKeyFromKeyObjects = x25519SharedKeyFromKeyObjects;
10
- exports.x25519SharedKey = x25519SharedKey;
11
- exports.x25519SharedKeyStrictFromKeyObjects = x25519SharedKeyStrictFromKeyObjects;
12
- exports.x25519SharedKeyStrict = x25519SharedKeyStrict;
13
- exports.x25519GenerateKeyPair = x25519GenerateKeyPair;
14
- exports.ed25519CreatePrivateKeyObject = ed25519CreatePrivateKeyObject;
15
- exports.ed25519CreatePublicKeyObject = ed25519CreatePublicKeyObject;
16
- exports.ed25519PublicKeyFromPrivateKeyObject = ed25519PublicKeyFromPrivateKeyObject;
17
- exports.ed25519PublicKey = ed25519PublicKey;
18
- exports.ed25519GenerateKeyPair = ed25519GenerateKeyPair;
19
- exports.ed25519SignWithPrivateKey = ed25519SignWithPrivateKey;
20
- exports.ed25519Sign = ed25519Sign;
21
- exports.ed25519VerifyWithPublicKey = ed25519VerifyWithPublicKey;
22
- exports.ed25519Verify = ed25519Verify;
23
- exports.ed25519SignMessage = ed25519SignMessage;
24
- exports.ed25519OpenMessage = ed25519OpenMessage;
25
- const node_fs_1 = require("node:fs");
26
- const node_path_1 = require("node:path");
27
- const node_module_1 = require("node:module");
28
- const assert_js_1 = require("./internal/assert.js");
29
- const SELF_PACKAGE_NAME = "@unknownncat/curve25519-node";
30
- const requireBase = typeof __filename === "string"
31
- ? __filename
32
- : typeof process.argv[1] === "string" && (0, node_path_1.isAbsolute)(process.argv[1])
33
- ? process.argv[1]
34
- : (0, node_path_1.join)(process.cwd(), "package.json");
35
- const nodeRequire = (0, node_module_1.createRequire)(requireBase);
36
- let wasmModulePath;
37
- let wasmBindings;
38
- function resolveWasmModulePath() {
39
- const candidates = [];
40
- try {
41
- const packageJsonPath = nodeRequire.resolve(`${SELF_PACKAGE_NAME}/package.json`);
42
- candidates.push((0, node_path_1.join)((0, node_path_1.dirname)(packageJsonPath), "dist", "internal", "curve25519-wasm", "curve25519_wasm.js"));
43
- }
44
- catch {
45
- // Fall back to local development paths below.
46
- }
47
- if (typeof __dirname === "string") {
48
- candidates.push((0, node_path_1.join)(__dirname, "internal", "curve25519-wasm", "curve25519_wasm.js"));
49
- }
50
- candidates.push((0, node_path_1.join)(process.cwd(), "dist", "internal", "curve25519-wasm", "curve25519_wasm.js"));
51
- candidates.push((0, node_path_1.join)(process.cwd(), "src", "internal", "curve25519-wasm", "curve25519_wasm.js"));
52
- for (const candidate of candidates) {
53
- if ((0, node_fs_1.existsSync)(candidate)) {
54
- return candidate;
55
- }
56
- }
57
- throw new Error("Unable to locate modern curve25519 WASM module. Run `npm run build` before using wasm API in local dev.");
58
- }
59
- function getWasmBindings() {
60
- if (wasmBindings !== undefined) {
61
- return wasmBindings;
62
- }
63
- if (wasmModulePath === undefined) {
64
- wasmModulePath = resolveWasmModulePath();
65
- }
66
- // Lazy-load WASM bindings so node:crypto users avoid startup overhead.
67
- wasmBindings = nodeRequire(wasmModulePath);
68
- return wasmBindings;
69
- }
70
- function copyBytes32(bytes32, label) {
71
- const out = new Uint8Array(32);
72
- out.set(bytes32);
73
- return (0, assert_js_1.asBytes32)(out, label);
74
- }
75
- function clampScalar(seed32) {
76
- const out = new Uint8Array(32);
77
- out.set(seed32);
78
- out[0] = (out[0] ?? 0) & 248;
79
- const last = out[31] ?? 0;
80
- out[31] = (last & 127) | 64;
81
- return (0, assert_js_1.asBytes32)(out, "clamped scalar");
82
- }
83
- function isRecord(value) {
84
- return typeof value === "object" && value !== null;
85
- }
86
- function assertWasmKeyObject(value, expectedType, label) {
87
- if (!isRecord(value) || value.type !== expectedType || !(value.bytes instanceof Uint8Array)) {
88
- throw new TypeError(`${label} must be a ${expectedType} key object`);
89
- }
90
- (0, assert_js_1.assertBytes32)(value.bytes, `${label}.bytes`);
91
- }
92
- function isAllZero32(bytes32) {
93
- (0, assert_js_1.assertBytes32)(bytes32, "bytes32");
94
- let acc = 0;
95
- for (let i = 0; i < 32; i += 1) {
96
- acc |= bytes32[i] ?? 0;
97
- }
98
- return acc === 0;
99
- }
100
- function x25519CreatePrivateKeyObject(secretKey32) {
101
- (0, assert_js_1.assertBytes32)(secretKey32, "secretKey32");
102
- return Object.freeze({
103
- type: "x25519-private",
104
- bytes: copyBytes32(secretKey32, "x25519 private key object bytes"),
105
- });
106
- }
107
- function x25519CreatePublicKeyObject(publicKey32) {
108
- (0, assert_js_1.assertBytes32)(publicKey32, "publicKey32");
109
- return Object.freeze({
110
- type: "x25519-public",
111
- bytes: copyBytes32(publicKey32, "x25519 public key object bytes"),
112
- });
113
- }
114
- function x25519PublicKeyFromPrivateKeyObject(privateKey) {
115
- assertWasmKeyObject(privateKey, "x25519-private", "privateKey");
116
- return (0, assert_js_1.asBytes32)(getWasmBindings().x25519PublicKey(privateKey.bytes), "x25519 public key");
117
- }
118
- function x25519PublicKey(secretKey32) {
119
- return x25519PublicKeyFromPrivateKeyObject(x25519CreatePrivateKeyObject(secretKey32));
120
- }
121
- function x25519SharedKeyFromKeyObjects(privateKey, publicKey) {
122
- assertWasmKeyObject(privateKey, "x25519-private", "privateKey");
123
- assertWasmKeyObject(publicKey, "x25519-public", "publicKey");
124
- return (0, assert_js_1.asBytes32)(getWasmBindings().x25519SharedKey(privateKey.bytes, publicKey.bytes), "x25519 shared key");
125
- }
126
- function x25519SharedKey(secretKey32, publicKey32) {
127
- const privateKey = x25519CreatePrivateKeyObject(secretKey32);
128
- const publicKey = x25519CreatePublicKeyObject(publicKey32);
129
- return x25519SharedKeyFromKeyObjects(privateKey, publicKey);
130
- }
131
- function x25519SharedKeyStrictFromKeyObjects(privateKey, publicKey) {
132
- const shared = x25519SharedKeyFromKeyObjects(privateKey, publicKey);
133
- if (isAllZero32(shared)) {
134
- throw new Error("X25519 shared secret is all-zero; reject low-order/invalid peer public key in protocol flow.");
135
- }
136
- return shared;
137
- }
138
- function x25519SharedKeyStrict(secretKey32, publicKey32) {
139
- const privateKey = x25519CreatePrivateKeyObject(secretKey32);
140
- const publicKey = x25519CreatePublicKeyObject(publicKey32);
141
- return x25519SharedKeyStrictFromKeyObjects(privateKey, publicKey);
142
- }
143
- function x25519GenerateKeyPair(seed32) {
144
- (0, assert_js_1.assertBytes32)(seed32, "seed32");
145
- const privateKey = clampScalar(seed32);
146
- const publicKey32 = x25519PublicKey(privateKey);
147
- return {
148
- public: publicKey32,
149
- private: privateKey,
150
- };
151
- }
152
- function ed25519CreatePrivateKeyObject(secretSeed32) {
153
- (0, assert_js_1.assertBytes32)(secretSeed32, "secretSeed32");
154
- return Object.freeze({
155
- type: "ed25519-private",
156
- bytes: copyBytes32(secretSeed32, "ed25519 private key object bytes"),
157
- });
158
- }
159
- function ed25519CreatePublicKeyObject(publicKey32) {
160
- (0, assert_js_1.assertBytes32)(publicKey32, "publicKey32");
161
- return Object.freeze({
162
- type: "ed25519-public",
163
- bytes: copyBytes32(publicKey32, "ed25519 public key object bytes"),
164
- });
165
- }
166
- function ed25519PublicKeyFromPrivateKeyObject(privateKey) {
167
- assertWasmKeyObject(privateKey, "ed25519-private", "privateKey");
168
- return (0, assert_js_1.asBytes32)(getWasmBindings().ed25519PublicKey(privateKey.bytes), "ed25519 public key");
169
- }
170
- function ed25519PublicKey(secretSeed32) {
171
- return ed25519PublicKeyFromPrivateKeyObject(ed25519CreatePrivateKeyObject(secretSeed32));
172
- }
173
- function ed25519GenerateKeyPair(seed32) {
174
- (0, assert_js_1.assertBytes32)(seed32, "seed32");
175
- return {
176
- public: ed25519PublicKey(seed32),
177
- private: seed32,
178
- };
179
- }
180
- function ed25519SignWithPrivateKey(privateKey, msg) {
181
- assertWasmKeyObject(privateKey, "ed25519-private", "privateKey");
182
- (0, assert_js_1.assertUint8Array)(msg, "msg");
183
- return (0, assert_js_1.asBytes64)(getWasmBindings().ed25519Sign(privateKey.bytes, msg), "ed25519 signature");
184
- }
185
- function ed25519Sign(secretSeed32, msg) {
186
- return ed25519SignWithPrivateKey(ed25519CreatePrivateKeyObject(secretSeed32), msg);
187
- }
188
- function ed25519VerifyWithPublicKey(publicKey, msg, signature64) {
189
- assertWasmKeyObject(publicKey, "ed25519-public", "publicKey");
190
- (0, assert_js_1.assertUint8Array)(msg, "msg");
191
- (0, assert_js_1.assertBytes64)(signature64, "signature64");
192
- return getWasmBindings().ed25519Verify(publicKey.bytes, msg, signature64);
193
- }
194
- function ed25519Verify(publicKey32, msg, signature64) {
195
- return ed25519VerifyWithPublicKey(ed25519CreatePublicKeyObject(publicKey32), msg, signature64);
196
- }
197
- function ed25519SignMessage(secretSeed32, msg) {
198
- (0, assert_js_1.assertBytes32)(secretSeed32, "secretSeed32");
199
- (0, assert_js_1.assertUint8Array)(msg, "msg");
200
- const signature64 = ed25519Sign(secretSeed32, msg);
201
- const signed = new Uint8Array(64 + msg.byteLength);
202
- signed.set(signature64, 0);
203
- signed.set(msg, 64);
204
- return signed;
205
- }
206
- function ed25519OpenMessage(publicKey32, signedMsg) {
207
- (0, assert_js_1.assertBytes32)(publicKey32, "publicKey32");
208
- (0, assert_js_1.assertUint8Array)(signedMsg, "signedMsg");
209
- if (signedMsg.byteLength < 64) {
210
- return null;
211
- }
212
- const signature64 = (0, assert_js_1.asBytes64)(signedMsg.subarray(0, 64), "signedMsg signature");
213
- const msg = signedMsg.subarray(64);
214
- if (!ed25519Verify(publicKey32, msg, signature64)) {
215
- return null;
216
- }
217
- return new Uint8Array(msg);
218
- }
219
- exports.x25519 = {
220
- createPrivateKeyObject: x25519CreatePrivateKeyObject,
221
- createPublicKeyObject: x25519CreatePublicKeyObject,
222
- publicKeyFromPrivateKeyObject: x25519PublicKeyFromPrivateKeyObject,
223
- publicKey: x25519PublicKey,
224
- sharedKey: x25519SharedKey,
225
- sharedKeyFromKeyObjects: x25519SharedKeyFromKeyObjects,
226
- sharedKeyStrict: x25519SharedKeyStrict,
227
- sharedKeyStrictFromKeyObjects: x25519SharedKeyStrictFromKeyObjects,
228
- isAllZero32,
229
- generateKeyPair: x25519GenerateKeyPair,
230
- };
231
- exports.ed25519 = {
232
- createPrivateKeyObject: ed25519CreatePrivateKeyObject,
233
- createPublicKeyObject: ed25519CreatePublicKeyObject,
234
- publicKeyFromPrivateKeyObject: ed25519PublicKeyFromPrivateKeyObject,
235
- publicKey: ed25519PublicKey,
236
- generateKeyPair: ed25519GenerateKeyPair,
237
- sign: ed25519Sign,
238
- signWithPrivateKey: ed25519SignWithPrivateKey,
239
- verify: ed25519Verify,
240
- verifyWithPublicKey: ed25519VerifyWithPublicKey,
241
- signMessage: ed25519SignMessage,
242
- openMessage: ed25519OpenMessage,
243
- };
244
- const api = {
245
- x25519: exports.x25519,
246
- ed25519: exports.ed25519,
247
- };
248
- exports.default = api;
249
- //# sourceMappingURL=wasm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wasm.js","sourceRoot":"","sources":["../../src/wasm.ts"],"names":[],"mappings":";;;A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AM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,WAAW,CAAC,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,sBAAsB,EAAE,4BAA4B;IACpD,qBAAqB,EAAE,2BAA2B;IAClD,6BAA6B,EAAE,mCAAmC;IAClE,SAAS,EAAE,eAAe;IAC1B,SAAS,EAAE,eAAe;IAC1B,uBAAuB,EAAE,6BAA6B;IACtD,eAAe,EAAE,qBAAqB;IACtC,6BAA6B,EAAE,mCAAmC;IAClE,WAAW;IACX,eAAe,EAAE,qBAAqB;CAC9B,CAAC;AAEE,QAAA,OAAO,GAAG;IACrB,sBAAsB,EAAE,6BAA6B;IACrD,qBAAqB,EAAE,4BAA4B;IACnD,6BAA6B,EAAE,oCAAoC;IACnE,SAAS,EAAE,gBAAgB;IAC3B,eAAe,EAAE,sBAAsB;IACvC,IAAI,EAAE,WAAW;IACjB,kBAAkB,EAAE,yBAAyB;IAC7C,MAAM,EAAE,aAAa;IACrB,mBAAmB,EAAE,0BAA0B;IAC/C,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,kBAAkB;CACvB,CAAC;AAEX,MAAM,GAAG,GAAG;IACV,MAAM,EAAN,cAAM;IACN,OAAO,EAAP,eAAO;CACC,CAAC;AAEX,kBAAe,GAAG,CAAC"}
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 unknownncat
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.
@@ -1,12 +0,0 @@
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;
@@ -1,165 +0,0 @@
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();
@@ -1,13 +0,0 @@
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;
@@ -1,17 +0,0 @@
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/wasm.d.ts DELETED
@@ -1,92 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAqB9D,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AA+ED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAOrD;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,OAAO,GAAG,0BAA0B,CAM7F;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,GAAG,yBAAyB,CAM3F;AAED,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,0BAA0B,GACrC,OAAO,CAGT;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAE7D;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,0BAA0B,EACtC,SAAS,EAAE,yBAAyB,GACnC,OAAO,CAOT;AAED,wBAA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