@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.
- package/NOTICE.md +6 -6
- package/README.en.md +34 -407
- package/README.md +35 -408
- package/dist/axlsign.d.ts +1 -1
- package/dist/axlsign.d.ts.map +1 -1
- package/dist/axlsign.js +8 -50
- package/dist/axlsign.js.map +1 -1
- package/dist/cjs/axlsign.js +8 -50
- package/dist/cjs/axlsign.js.map +1 -1
- package/dist/cjs/index.js +2 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/assert.js +1 -1
- package/dist/cjs/internal/assert.js.map +1 -1
- package/dist/cjs/internal/axlsign-wasm/axlsign_wasm.js +129 -65
- package/dist/cjs/internal/axlsign-wasm/axlsign_wasm_bg.wasm +0 -0
- package/dist/cjs/internal/axlsign-wasm/axlsign_wasm_bg.wasm.d.ts +8 -10
- package/dist/index.d.ts +1 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -10
- package/dist/index.js.map +1 -1
- package/dist/internal/assert.js +1 -1
- package/dist/internal/assert.js.map +1 -1
- package/dist/internal/axlsign-wasm/axlsign_wasm.js +129 -65
- package/dist/internal/axlsign-wasm/axlsign_wasm_bg.wasm +0 -0
- package/dist/internal/axlsign-wasm/axlsign_wasm_bg.wasm.d.ts +8 -10
- package/package.json +8 -24
- package/dist/cjs/internal/curve25519-wasm/LICENSE +0 -21
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.d.ts +0 -12
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.js +0 -165
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +0 -13
- package/dist/cjs/internal/curve25519-wasm/package.json +0 -17
- package/dist/cjs/wasm.js +0 -249
- package/dist/cjs/wasm.js.map +0 -1
- package/dist/internal/curve25519-wasm/LICENSE +0 -21
- package/dist/internal/curve25519-wasm/curve25519_wasm.d.ts +0 -12
- package/dist/internal/curve25519-wasm/curve25519_wasm.js +0 -165
- package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
- package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +0 -13
- package/dist/internal/curve25519-wasm/package.json +0 -17
- package/dist/wasm.d.ts +0 -92
- package/dist/wasm.d.ts.map +0 -1
- package/dist/wasm.js +0 -225
- package/dist/wasm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/internal/assert.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,IAAY;IAC3D,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QACtD,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,mCAAmC,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAiB,EAAE,QAAgB,EAAE,IAAY;IACrE,IAAI,KAAK,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,YAAY,QAAQ,oBAAoB,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IAC7D,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9B,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IAC7D,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9B,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IACzD,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IACzD,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAkB,EAAE,MAAc;IAClE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/internal/assert.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,IAAY;IAC3D,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;QACtD,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,mCAAmC,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAiB,EAAE,QAAgB,EAAE,IAAY;IACrE,IAAI,KAAK,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,YAAY,QAAQ,oBAAoB,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IAC7D,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9B,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IAC7D,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9B,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IACzD,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,IAAI,GAAG,OAAO;IACzD,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAkB,EAAE,MAAc;IAClE,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,6CAA6C;YACpD,kEAAkE,CACrE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -5,15 +5,24 @@
|
|
|
5
5
|
* @returns {Uint8Array}
|
|
6
6
|
*/
|
|
7
7
|
function axlsignPublicKey(secret_key) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
try {
|
|
9
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
10
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_export);
|
|
11
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12
|
+
wasm.axlsignPublicKey(retptr, ptr0, len0);
|
|
13
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
14
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
15
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
16
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
17
|
+
if (r3) {
|
|
18
|
+
throw takeObject(r2);
|
|
19
|
+
}
|
|
20
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
21
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
22
|
+
return v2;
|
|
23
|
+
} finally {
|
|
24
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13
25
|
}
|
|
14
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
15
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
16
|
-
return v2;
|
|
17
26
|
}
|
|
18
27
|
exports.axlsignPublicKey = axlsignPublicKey;
|
|
19
28
|
|
|
@@ -23,17 +32,26 @@ exports.axlsignPublicKey = axlsignPublicKey;
|
|
|
23
32
|
* @returns {Uint8Array}
|
|
24
33
|
*/
|
|
25
34
|
function axlsignSharedKey(secret_key, public_key) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
try {
|
|
36
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
37
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_export);
|
|
38
|
+
const len0 = WASM_VECTOR_LEN;
|
|
39
|
+
const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_export);
|
|
40
|
+
const len1 = WASM_VECTOR_LEN;
|
|
41
|
+
wasm.axlsignSharedKey(retptr, ptr0, len0, ptr1, len1);
|
|
42
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
43
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
44
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
45
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
46
|
+
if (r3) {
|
|
47
|
+
throw takeObject(r2);
|
|
48
|
+
}
|
|
49
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
50
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
51
|
+
return v3;
|
|
52
|
+
} finally {
|
|
53
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
33
54
|
}
|
|
34
|
-
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
35
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
36
|
-
return v3;
|
|
37
55
|
}
|
|
38
56
|
exports.axlsignSharedKey = axlsignSharedKey;
|
|
39
57
|
|
|
@@ -43,17 +61,26 @@ exports.axlsignSharedKey = axlsignSharedKey;
|
|
|
43
61
|
* @returns {Uint8Array}
|
|
44
62
|
*/
|
|
45
63
|
function axlsignSign(secret_key, msg) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
try {
|
|
65
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
66
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_export);
|
|
67
|
+
const len0 = WASM_VECTOR_LEN;
|
|
68
|
+
const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_export);
|
|
69
|
+
const len1 = WASM_VECTOR_LEN;
|
|
70
|
+
wasm.axlsignSign(retptr, ptr0, len0, ptr1, len1);
|
|
71
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
72
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
73
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
74
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
75
|
+
if (r3) {
|
|
76
|
+
throw takeObject(r2);
|
|
77
|
+
}
|
|
78
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
79
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
80
|
+
return v3;
|
|
81
|
+
} finally {
|
|
82
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
53
83
|
}
|
|
54
|
-
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
55
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
56
|
-
return v3;
|
|
57
84
|
}
|
|
58
85
|
exports.axlsignSign = axlsignSign;
|
|
59
86
|
|
|
@@ -64,19 +91,28 @@ exports.axlsignSign = axlsignSign;
|
|
|
64
91
|
* @returns {Uint8Array}
|
|
65
92
|
*/
|
|
66
93
|
function axlsignSignRnd(secret_key, msg, rnd) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
try {
|
|
95
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
96
|
+
const ptr0 = passArray8ToWasm0(secret_key, wasm.__wbindgen_export);
|
|
97
|
+
const len0 = WASM_VECTOR_LEN;
|
|
98
|
+
const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_export);
|
|
99
|
+
const len1 = WASM_VECTOR_LEN;
|
|
100
|
+
const ptr2 = passArray8ToWasm0(rnd, wasm.__wbindgen_export);
|
|
101
|
+
const len2 = WASM_VECTOR_LEN;
|
|
102
|
+
wasm.axlsignSignRnd(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
103
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
104
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
105
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
106
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
107
|
+
if (r3) {
|
|
108
|
+
throw takeObject(r2);
|
|
109
|
+
}
|
|
110
|
+
var v4 = getArrayU8FromWasm0(r0, r1).slice();
|
|
111
|
+
wasm.__wbindgen_export2(r0, r1 * 1, 1);
|
|
112
|
+
return v4;
|
|
113
|
+
} finally {
|
|
114
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
76
115
|
}
|
|
77
|
-
var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
78
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
79
|
-
return v4;
|
|
80
116
|
}
|
|
81
117
|
exports.axlsignSignRnd = axlsignSignRnd;
|
|
82
118
|
|
|
@@ -87,17 +123,25 @@ exports.axlsignSignRnd = axlsignSignRnd;
|
|
|
87
123
|
* @returns {boolean}
|
|
88
124
|
*/
|
|
89
125
|
function axlsignVerify(public_key, msg, signature) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
126
|
+
try {
|
|
127
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
128
|
+
const ptr0 = passArray8ToWasm0(public_key, wasm.__wbindgen_export);
|
|
129
|
+
const len0 = WASM_VECTOR_LEN;
|
|
130
|
+
const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_export);
|
|
131
|
+
const len1 = WASM_VECTOR_LEN;
|
|
132
|
+
const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_export);
|
|
133
|
+
const len2 = WASM_VECTOR_LEN;
|
|
134
|
+
wasm.axlsignVerify(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
135
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
136
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
137
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
138
|
+
if (r2) {
|
|
139
|
+
throw takeObject(r1);
|
|
140
|
+
}
|
|
141
|
+
return r0 !== 0;
|
|
142
|
+
} finally {
|
|
143
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
99
144
|
}
|
|
100
|
-
return ret[0] !== 0;
|
|
101
145
|
}
|
|
102
146
|
exports.axlsignVerify = axlsignVerify;
|
|
103
147
|
|
|
@@ -107,16 +151,7 @@ function __wbg_get_imports() {
|
|
|
107
151
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
108
152
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
109
153
|
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);
|
|
154
|
+
return addHeapObject(ret);
|
|
120
155
|
},
|
|
121
156
|
};
|
|
122
157
|
return {
|
|
@@ -125,11 +160,34 @@ function __wbg_get_imports() {
|
|
|
125
160
|
};
|
|
126
161
|
}
|
|
127
162
|
|
|
163
|
+
function addHeapObject(obj) {
|
|
164
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
165
|
+
const idx = heap_next;
|
|
166
|
+
heap_next = heap[idx];
|
|
167
|
+
|
|
168
|
+
heap[idx] = obj;
|
|
169
|
+
return idx;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function dropObject(idx) {
|
|
173
|
+
if (idx < 1028) return;
|
|
174
|
+
heap[idx] = heap_next;
|
|
175
|
+
heap_next = idx;
|
|
176
|
+
}
|
|
177
|
+
|
|
128
178
|
function getArrayU8FromWasm0(ptr, len) {
|
|
129
179
|
ptr = ptr >>> 0;
|
|
130
180
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
131
181
|
}
|
|
132
182
|
|
|
183
|
+
let cachedDataViewMemory0 = null;
|
|
184
|
+
function getDataViewMemory0() {
|
|
185
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
186
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
187
|
+
}
|
|
188
|
+
return cachedDataViewMemory0;
|
|
189
|
+
}
|
|
190
|
+
|
|
133
191
|
function getStringFromWasm0(ptr, len) {
|
|
134
192
|
ptr = ptr >>> 0;
|
|
135
193
|
return decodeText(ptr, len);
|
|
@@ -143,6 +201,13 @@ function getUint8ArrayMemory0() {
|
|
|
143
201
|
return cachedUint8ArrayMemory0;
|
|
144
202
|
}
|
|
145
203
|
|
|
204
|
+
function getObject(idx) { return heap[idx]; }
|
|
205
|
+
|
|
206
|
+
let heap = new Array(1024).fill(undefined);
|
|
207
|
+
heap.push(undefined, null, true, false);
|
|
208
|
+
|
|
209
|
+
let heap_next = heap.length;
|
|
210
|
+
|
|
146
211
|
function passArray8ToWasm0(arg, malloc) {
|
|
147
212
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
148
213
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -150,10 +215,10 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
150
215
|
return ptr;
|
|
151
216
|
}
|
|
152
217
|
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
return
|
|
218
|
+
function takeObject(idx) {
|
|
219
|
+
const ret = getObject(idx);
|
|
220
|
+
dropObject(idx);
|
|
221
|
+
return ret;
|
|
157
222
|
}
|
|
158
223
|
|
|
159
224
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -168,4 +233,3 @@ const wasmPath = `${__dirname}/axlsign_wasm_bg.wasm`;
|
|
|
168
233
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
169
234
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
170
235
|
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
171
|
-
wasm.__wbindgen_start();
|
|
Binary file
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const axlsignPublicKey: (a: number, b: number
|
|
5
|
-
export const axlsignSharedKey: (a: number, b: number, c: number, d: number
|
|
6
|
-
export const axlsignSign: (a: number, b: number, c: number, d: number
|
|
7
|
-
export const axlsignSignRnd: (a: number, b: number, c: number, d: number, e: number, f: number
|
|
8
|
-
export const axlsignVerify: (a: number, b: number, c: number, d: number, e: number, f: number
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
13
|
-
export const __wbindgen_start: () => void;
|
|
4
|
+
export const axlsignPublicKey: (a: number, b: number, c: number) => void;
|
|
5
|
+
export const axlsignSharedKey: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
|
+
export const axlsignSign: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
7
|
+
export const axlsignSignRnd: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
8
|
+
export const axlsignVerify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
9
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
10
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
11
|
+
export const __wbindgen_export2: (a: number, b: number, c: number) => void;
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unknownncat/curve25519-node",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.2",
|
|
4
|
+
"description": "Node.js X25519 + Ed25519 via node:crypto with Rust-accelerated axlsign compatibility",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"curve25519",
|
|
7
7
|
"x25519",
|
|
8
8
|
"ed25519",
|
|
9
9
|
"axlsign",
|
|
10
|
-
"wasm",
|
|
11
10
|
"crypto",
|
|
12
11
|
"cryptography",
|
|
13
12
|
"openssl",
|
|
@@ -53,12 +52,6 @@
|
|
|
53
52
|
"require": "./dist/cjs/axlsign.js",
|
|
54
53
|
"default": "./dist/axlsign.js"
|
|
55
54
|
},
|
|
56
|
-
"./wasm": {
|
|
57
|
-
"types": "./dist/wasm.d.ts",
|
|
58
|
-
"import": "./dist/wasm.js",
|
|
59
|
-
"require": "./dist/cjs/wasm.js",
|
|
60
|
-
"default": "./dist/wasm.js"
|
|
61
|
-
},
|
|
62
55
|
"./types": {
|
|
63
56
|
"types": "./dist/types.d.ts",
|
|
64
57
|
"import": "./dist/types.js",
|
|
@@ -82,34 +75,25 @@
|
|
|
82
75
|
},
|
|
83
76
|
"scripts": {
|
|
84
77
|
"clean": "node scripts/clean.mjs",
|
|
85
|
-
"build:
|
|
78
|
+
"build:axlsign-rust": "node scripts/build-axlsign-rust.mjs",
|
|
86
79
|
"build:esm": "tsc -p tsconfig.json",
|
|
87
80
|
"build:cjs": "tsc -p tsconfig.cjs.json && node scripts/write-cjs-package-json.mjs",
|
|
88
81
|
"build:copy-wasm": "node scripts/copy-axlsign-wasm.mjs",
|
|
89
|
-
"build": "npm run clean && npm run build:
|
|
90
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
82
|
+
"build": "npm run clean && npm run build:axlsign-rust && npm run build:esm && npm run build:cjs && npm run build:copy-wasm",
|
|
83
|
+
"typecheck": "npm run build:axlsign-rust && tsc -p tsconfig.json --noEmit",
|
|
91
84
|
"lint": "eslint .",
|
|
92
85
|
"lint:fix": "eslint . --fix",
|
|
93
86
|
"format": "prettier . --write",
|
|
94
87
|
"format:check": "prettier . --check",
|
|
95
88
|
"test": "npm run build && node --test \"test/*.test.mjs\"",
|
|
89
|
+
"test:cross": "npm run build && npm --prefix ../browser run build && node --test \"test/cross-runtime.cross.mjs\"",
|
|
96
90
|
"audit": "npm audit",
|
|
97
91
|
"audit:prod": "npm audit --omit=dev",
|
|
98
92
|
"ci": "npm run format:check && npm run lint && npm run typecheck && npm run test",
|
|
99
93
|
"release:check": "npm run ci && npm pack --dry-run --ignore-scripts",
|
|
100
|
-
"bench": "npm run build && npm --prefix bench run bench",
|
|
101
|
-
"bench:quick": "npm run build && npm --prefix bench run bench:quick",
|
|
94
|
+
"bench": "npm run build && npm --prefix ../../bench run bench",
|
|
95
|
+
"bench:quick": "npm run build && npm --prefix ../../bench run bench:quick",
|
|
102
96
|
"prepack": "npm run ci",
|
|
103
97
|
"prepublishOnly": "npm run ci"
|
|
104
|
-
},
|
|
105
|
-
"devDependencies": {
|
|
106
|
-
"@eslint/js": "^9.37.0",
|
|
107
|
-
"@types/node": "^22.18.6",
|
|
108
|
-
"eslint": "^9.37.0",
|
|
109
|
-
"eslint-config-prettier": "^10.1.8",
|
|
110
|
-
"globals": "^16.4.0",
|
|
111
|
-
"prettier": "^3.6.2",
|
|
112
|
-
"typescript-eslint": "^8.46.1",
|
|
113
|
-
"typescript": "^5.9.2"
|
|
114
98
|
}
|
|
115
99
|
}
|
|
@@ -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();
|
|
Binary file
|
|
@@ -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
|
-
}
|