@unknownncat/curve25519-node 2.0.0 → 2.1.1
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/LICENSE +1 -1
- package/NOTICE.md +89 -0
- package/README.en.md +149 -43
- package/README.md +141 -35
- package/SECURITY.md +34 -0
- package/THIRD_PARTY_NOTICE.md +3 -0
- package/THIRD_PARTY_NOTICES.md +5 -0
- package/dist/axlsign.d.ts.map +1 -1
- package/dist/axlsign.js +50 -7
- package/dist/axlsign.js.map +1 -1
- package/dist/cjs/axlsign.js +49 -6
- package/dist/cjs/axlsign.js.map +1 -1
- package/dist/cjs/ed25519.js +46 -10
- package/dist/cjs/ed25519.js.map +1 -1
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/assert.js.map +1 -1
- package/dist/cjs/internal/axlsign-wasm/LICENSE +1 -1
- package/dist/cjs/internal/curve25519-wasm/LICENSE +21 -0
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.d.ts +12 -0
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm.js +165 -0
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
- package/dist/cjs/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +13 -0
- package/dist/cjs/internal/curve25519-wasm/package.json +17 -0
- package/dist/cjs/wasm.js +249 -0
- package/dist/cjs/wasm.js.map +1 -0
- package/dist/cjs/x25519.js +73 -12
- package/dist/cjs/x25519.js.map +1 -1
- package/dist/ed25519.d.ts +21 -0
- package/dist/ed25519.d.ts.map +1 -1
- package/dist/ed25519.js +44 -13
- package/dist/ed25519.js.map +1 -1
- package/dist/index.d.ts +87 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/assert.js.map +1 -1
- package/dist/internal/axlsign-wasm/LICENSE +1 -1
- package/dist/internal/curve25519-wasm/LICENSE +21 -0
- package/dist/internal/curve25519-wasm/curve25519_wasm.d.ts +12 -0
- package/dist/internal/curve25519-wasm/curve25519_wasm.js +165 -0
- package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm +0 -0
- package/dist/internal/curve25519-wasm/curve25519_wasm_bg.wasm.d.ts +13 -0
- package/dist/internal/curve25519-wasm/package.json +17 -0
- package/dist/types.d.ts +2 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/wasm.d.ts +92 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +225 -0
- package/dist/wasm.js.map +1 -0
- package/dist/x25519.d.ts +29 -0
- package/dist/x25519.d.ts.map +1 -1
- package/dist/x25519.js +66 -12
- package/dist/x25519.js.map +1 -1
- package/package.json +30 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as axlsignApi from "./axlsign.js";
|
|
2
|
+
import * as wasmApi from "./wasm.js";
|
|
2
3
|
import * as ed25519Api from "./ed25519.js";
|
|
3
4
|
import * as x25519Api from "./x25519.js";
|
|
4
5
|
import type { Bytes32, Bytes64 } from "./types.js";
|
|
@@ -8,18 +9,30 @@ export type { Bytes32, Bytes64, KeyPair32 } from "./types.js";
|
|
|
8
9
|
* Standard X25519 namespace.
|
|
9
10
|
*/
|
|
10
11
|
export declare const x25519: {
|
|
12
|
+
readonly createPrivateKeyObject: typeof x25519Api.createPrivateKeyObject;
|
|
13
|
+
readonly createPublicKeyObject: typeof x25519Api.createPublicKeyObject;
|
|
14
|
+
readonly publicKeyFromPrivateKeyObject: typeof x25519Api.publicKeyFromPrivateKeyObject;
|
|
11
15
|
readonly publicKey: typeof x25519Api.publicKey;
|
|
12
16
|
readonly sharedKey: typeof x25519Api.sharedKey;
|
|
17
|
+
readonly sharedKeyFromKeyObjects: typeof x25519Api.sharedKeyFromKeyObjects;
|
|
18
|
+
readonly sharedKeyStrict: typeof x25519Api.sharedKeyStrict;
|
|
19
|
+
readonly sharedKeyStrictFromKeyObjects: typeof x25519Api.sharedKeyStrictFromKeyObjects;
|
|
20
|
+
readonly isAllZero32: typeof x25519Api.isAllZero32;
|
|
13
21
|
readonly generateKeyPair: typeof x25519Api.generateKeyPair;
|
|
14
22
|
};
|
|
15
23
|
/**
|
|
16
24
|
* Standard Ed25519 namespace.
|
|
17
25
|
*/
|
|
18
26
|
export declare const ed25519: {
|
|
27
|
+
readonly createPrivateKeyObject: typeof ed25519Api.createPrivateKeyObject;
|
|
28
|
+
readonly createPublicKeyObject: typeof ed25519Api.createPublicKeyObject;
|
|
29
|
+
readonly publicKeyFromPrivateKeyObject: typeof ed25519Api.publicKeyFromPrivateKeyObject;
|
|
19
30
|
readonly publicKey: typeof ed25519Api.publicKey;
|
|
20
31
|
readonly generateKeyPair: typeof ed25519Api.generateKeyPair;
|
|
21
32
|
readonly sign: typeof ed25519Api.sign;
|
|
33
|
+
readonly signWithPrivateKey: typeof ed25519Api.signWithPrivateKey;
|
|
22
34
|
readonly verify: typeof ed25519Api.verify;
|
|
35
|
+
readonly verifyWithPublicKey: typeof ed25519Api.verifyWithPublicKey;
|
|
23
36
|
readonly signMessage: typeof ed25519Api.signMessage;
|
|
24
37
|
readonly openMessage: typeof ed25519Api.openMessage;
|
|
25
38
|
};
|
|
@@ -35,10 +48,44 @@ export declare const axlsign: {
|
|
|
35
48
|
readonly signMessage: typeof axlsignApi.signMessage;
|
|
36
49
|
readonly openMessage: typeof axlsignApi.openMessage;
|
|
37
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Optional modern WASM namespace with X25519 + Ed25519 parity methods.
|
|
53
|
+
*/
|
|
54
|
+
export declare const wasm: {
|
|
55
|
+
readonly x25519: {
|
|
56
|
+
readonly createPrivateKeyObject: typeof wasmApi.x25519CreatePrivateKeyObject;
|
|
57
|
+
readonly createPublicKeyObject: typeof wasmApi.x25519CreatePublicKeyObject;
|
|
58
|
+
readonly publicKeyFromPrivateKeyObject: typeof wasmApi.x25519PublicKeyFromPrivateKeyObject;
|
|
59
|
+
readonly publicKey: typeof wasmApi.x25519PublicKey;
|
|
60
|
+
readonly sharedKey: typeof wasmApi.x25519SharedKey;
|
|
61
|
+
readonly sharedKeyFromKeyObjects: typeof wasmApi.x25519SharedKeyFromKeyObjects;
|
|
62
|
+
readonly sharedKeyStrict: typeof wasmApi.x25519SharedKeyStrict;
|
|
63
|
+
readonly sharedKeyStrictFromKeyObjects: typeof wasmApi.x25519SharedKeyStrictFromKeyObjects;
|
|
64
|
+
readonly isAllZero32: typeof wasmApi.isAllZero32;
|
|
65
|
+
readonly generateKeyPair: typeof wasmApi.x25519GenerateKeyPair;
|
|
66
|
+
};
|
|
67
|
+
readonly ed25519: {
|
|
68
|
+
readonly createPrivateKeyObject: typeof wasmApi.ed25519CreatePrivateKeyObject;
|
|
69
|
+
readonly createPublicKeyObject: typeof wasmApi.ed25519CreatePublicKeyObject;
|
|
70
|
+
readonly publicKeyFromPrivateKeyObject: typeof wasmApi.ed25519PublicKeyFromPrivateKeyObject;
|
|
71
|
+
readonly publicKey: typeof wasmApi.ed25519PublicKey;
|
|
72
|
+
readonly generateKeyPair: typeof wasmApi.ed25519GenerateKeyPair;
|
|
73
|
+
readonly sign: typeof wasmApi.ed25519Sign;
|
|
74
|
+
readonly signWithPrivateKey: typeof wasmApi.ed25519SignWithPrivateKey;
|
|
75
|
+
readonly verify: typeof wasmApi.ed25519Verify;
|
|
76
|
+
readonly verifyWithPublicKey: typeof wasmApi.ed25519VerifyWithPublicKey;
|
|
77
|
+
readonly signMessage: typeof wasmApi.ed25519SignMessage;
|
|
78
|
+
readonly openMessage: typeof wasmApi.ed25519OpenMessage;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
38
81
|
/**
|
|
39
82
|
* Top-level compatibility alias for X25519 shared secret.
|
|
40
83
|
*/
|
|
41
84
|
export declare const sharedKey: typeof x25519Api.sharedKey;
|
|
85
|
+
/**
|
|
86
|
+
* Top-level strict X25519 shared secret helper that rejects all-zero results.
|
|
87
|
+
*/
|
|
88
|
+
export declare const sharedKeyStrict: typeof x25519Api.sharedKeyStrict;
|
|
42
89
|
/**
|
|
43
90
|
* Top-level compatibility alias for X25519 deterministic key generation.
|
|
44
91
|
*/
|
|
@@ -71,15 +118,27 @@ export declare const openMessage: typeof ed25519Api.openMessage;
|
|
|
71
118
|
export declare const verify: typeof ed25519Api.verify;
|
|
72
119
|
declare const api: {
|
|
73
120
|
readonly x25519: {
|
|
121
|
+
readonly createPrivateKeyObject: typeof x25519Api.createPrivateKeyObject;
|
|
122
|
+
readonly createPublicKeyObject: typeof x25519Api.createPublicKeyObject;
|
|
123
|
+
readonly publicKeyFromPrivateKeyObject: typeof x25519Api.publicKeyFromPrivateKeyObject;
|
|
74
124
|
readonly publicKey: typeof x25519Api.publicKey;
|
|
75
125
|
readonly sharedKey: typeof x25519Api.sharedKey;
|
|
126
|
+
readonly sharedKeyFromKeyObjects: typeof x25519Api.sharedKeyFromKeyObjects;
|
|
127
|
+
readonly sharedKeyStrict: typeof x25519Api.sharedKeyStrict;
|
|
128
|
+
readonly sharedKeyStrictFromKeyObjects: typeof x25519Api.sharedKeyStrictFromKeyObjects;
|
|
129
|
+
readonly isAllZero32: typeof x25519Api.isAllZero32;
|
|
76
130
|
readonly generateKeyPair: typeof x25519Api.generateKeyPair;
|
|
77
131
|
};
|
|
78
132
|
readonly ed25519: {
|
|
133
|
+
readonly createPrivateKeyObject: typeof ed25519Api.createPrivateKeyObject;
|
|
134
|
+
readonly createPublicKeyObject: typeof ed25519Api.createPublicKeyObject;
|
|
135
|
+
readonly publicKeyFromPrivateKeyObject: typeof ed25519Api.publicKeyFromPrivateKeyObject;
|
|
79
136
|
readonly publicKey: typeof ed25519Api.publicKey;
|
|
80
137
|
readonly generateKeyPair: typeof ed25519Api.generateKeyPair;
|
|
81
138
|
readonly sign: typeof ed25519Api.sign;
|
|
139
|
+
readonly signWithPrivateKey: typeof ed25519Api.signWithPrivateKey;
|
|
82
140
|
readonly verify: typeof ed25519Api.verify;
|
|
141
|
+
readonly verifyWithPublicKey: typeof ed25519Api.verifyWithPublicKey;
|
|
83
142
|
readonly signMessage: typeof ed25519Api.signMessage;
|
|
84
143
|
readonly openMessage: typeof ed25519Api.openMessage;
|
|
85
144
|
};
|
|
@@ -92,7 +151,35 @@ declare const api: {
|
|
|
92
151
|
readonly signMessage: typeof axlsignApi.signMessage;
|
|
93
152
|
readonly openMessage: typeof axlsignApi.openMessage;
|
|
94
153
|
};
|
|
154
|
+
readonly wasm: {
|
|
155
|
+
readonly x25519: {
|
|
156
|
+
readonly createPrivateKeyObject: typeof wasmApi.x25519CreatePrivateKeyObject;
|
|
157
|
+
readonly createPublicKeyObject: typeof wasmApi.x25519CreatePublicKeyObject;
|
|
158
|
+
readonly publicKeyFromPrivateKeyObject: typeof wasmApi.x25519PublicKeyFromPrivateKeyObject;
|
|
159
|
+
readonly publicKey: typeof wasmApi.x25519PublicKey;
|
|
160
|
+
readonly sharedKey: typeof wasmApi.x25519SharedKey;
|
|
161
|
+
readonly sharedKeyFromKeyObjects: typeof wasmApi.x25519SharedKeyFromKeyObjects;
|
|
162
|
+
readonly sharedKeyStrict: typeof wasmApi.x25519SharedKeyStrict;
|
|
163
|
+
readonly sharedKeyStrictFromKeyObjects: typeof wasmApi.x25519SharedKeyStrictFromKeyObjects;
|
|
164
|
+
readonly isAllZero32: typeof wasmApi.isAllZero32;
|
|
165
|
+
readonly generateKeyPair: typeof wasmApi.x25519GenerateKeyPair;
|
|
166
|
+
};
|
|
167
|
+
readonly ed25519: {
|
|
168
|
+
readonly createPrivateKeyObject: typeof wasmApi.ed25519CreatePrivateKeyObject;
|
|
169
|
+
readonly createPublicKeyObject: typeof wasmApi.ed25519CreatePublicKeyObject;
|
|
170
|
+
readonly publicKeyFromPrivateKeyObject: typeof wasmApi.ed25519PublicKeyFromPrivateKeyObject;
|
|
171
|
+
readonly publicKey: typeof wasmApi.ed25519PublicKey;
|
|
172
|
+
readonly generateKeyPair: typeof wasmApi.ed25519GenerateKeyPair;
|
|
173
|
+
readonly sign: typeof wasmApi.ed25519Sign;
|
|
174
|
+
readonly signWithPrivateKey: typeof wasmApi.ed25519SignWithPrivateKey;
|
|
175
|
+
readonly verify: typeof wasmApi.ed25519Verify;
|
|
176
|
+
readonly verifyWithPublicKey: typeof wasmApi.ed25519VerifyWithPublicKey;
|
|
177
|
+
readonly signMessage: typeof wasmApi.ed25519SignMessage;
|
|
178
|
+
readonly openMessage: typeof wasmApi.ed25519OpenMessage;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
95
181
|
readonly sharedKey: typeof x25519Api.sharedKey;
|
|
182
|
+
readonly sharedKeyStrict: typeof x25519Api.sharedKeyStrict;
|
|
96
183
|
readonly generateKeyPair: typeof x25519Api.generateKeyPair;
|
|
97
184
|
readonly generateKeyPairX25519: typeof x25519Api.generateKeyPair;
|
|
98
185
|
readonly generateKeyPairEd25519: typeof ed25519Api.generateKeyPair;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBA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"./axlsign.js";
|
|
3
|
+
import * as wasmApi from "./wasm.js";
|
|
3
4
|
import * as ed25519Api from "./ed25519.js";
|
|
4
5
|
import * as x25519Api from "./x25519.js";
|
|
5
6
|
export { asBytes32, asBytes64, assertBytes32, assertBytes64 } from "./internal/assert.js";
|
|
@@ -7,18 +8,30 @@ export { asBytes32, asBytes64, assertBytes32, assertBytes64 } from "./internal/a
|
|
|
7
8
|
* Standard X25519 namespace.
|
|
8
9
|
*/
|
|
9
10
|
export const x25519 = {
|
|
11
|
+
createPrivateKeyObject: x25519Api.createPrivateKeyObject,
|
|
12
|
+
createPublicKeyObject: x25519Api.createPublicKeyObject,
|
|
13
|
+
publicKeyFromPrivateKeyObject: x25519Api.publicKeyFromPrivateKeyObject,
|
|
10
14
|
publicKey: x25519Api.publicKey,
|
|
11
15
|
sharedKey: x25519Api.sharedKey,
|
|
16
|
+
sharedKeyFromKeyObjects: x25519Api.sharedKeyFromKeyObjects,
|
|
17
|
+
sharedKeyStrict: x25519Api.sharedKeyStrict,
|
|
18
|
+
sharedKeyStrictFromKeyObjects: x25519Api.sharedKeyStrictFromKeyObjects,
|
|
19
|
+
isAllZero32: x25519Api.isAllZero32,
|
|
12
20
|
generateKeyPair: x25519Api.generateKeyPair,
|
|
13
21
|
};
|
|
14
22
|
/**
|
|
15
23
|
* Standard Ed25519 namespace.
|
|
16
24
|
*/
|
|
17
25
|
export const ed25519 = {
|
|
26
|
+
createPrivateKeyObject: ed25519Api.createPrivateKeyObject,
|
|
27
|
+
createPublicKeyObject: ed25519Api.createPublicKeyObject,
|
|
28
|
+
publicKeyFromPrivateKeyObject: ed25519Api.publicKeyFromPrivateKeyObject,
|
|
18
29
|
publicKey: ed25519Api.publicKey,
|
|
19
30
|
generateKeyPair: ed25519Api.generateKeyPair,
|
|
20
31
|
sign: ed25519Api.sign,
|
|
32
|
+
signWithPrivateKey: ed25519Api.signWithPrivateKey,
|
|
21
33
|
verify: ed25519Api.verify,
|
|
34
|
+
verifyWithPublicKey: ed25519Api.verifyWithPublicKey,
|
|
22
35
|
signMessage: ed25519Api.signMessage,
|
|
23
36
|
openMessage: ed25519Api.openMessage,
|
|
24
37
|
};
|
|
@@ -34,10 +47,21 @@ export const axlsign = {
|
|
|
34
47
|
signMessage: axlsignApi.signMessage,
|
|
35
48
|
openMessage: axlsignApi.openMessage,
|
|
36
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Optional modern WASM namespace with X25519 + Ed25519 parity methods.
|
|
52
|
+
*/
|
|
53
|
+
export const wasm = {
|
|
54
|
+
x25519: wasmApi.x25519,
|
|
55
|
+
ed25519: wasmApi.ed25519,
|
|
56
|
+
};
|
|
37
57
|
/**
|
|
38
58
|
* Top-level compatibility alias for X25519 shared secret.
|
|
39
59
|
*/
|
|
40
60
|
export const sharedKey = x25519.sharedKey;
|
|
61
|
+
/**
|
|
62
|
+
* Top-level strict X25519 shared secret helper that rejects all-zero results.
|
|
63
|
+
*/
|
|
64
|
+
export const sharedKeyStrict = x25519.sharedKeyStrict;
|
|
41
65
|
/**
|
|
42
66
|
* Top-level compatibility alias for X25519 deterministic key generation.
|
|
43
67
|
*/
|
|
@@ -80,7 +104,9 @@ const api = {
|
|
|
80
104
|
x25519,
|
|
81
105
|
ed25519,
|
|
82
106
|
axlsign,
|
|
107
|
+
wasm,
|
|
83
108
|
sharedKey,
|
|
109
|
+
sharedKeyStrict,
|
|
84
110
|
generateKeyPair,
|
|
85
111
|
generateKeyPairX25519,
|
|
86
112
|
generateKeyPairEd25519,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,a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, 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();
|
|
Binary file
|
|
@@ -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:
|
|
2
|
+
readonly __brand: "Bytes32";
|
|
5
3
|
};
|
|
6
4
|
export type Bytes64 = Uint8Array & {
|
|
7
|
-
readonly __brand:
|
|
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
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
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":"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,OA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