@vex-chat/crypto 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -12
- package/dist/index.d.ts +98 -75
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +189 -155
- package/dist/index.js.map +1 -1
- package/package.json +61 -34
- package/src/__tests__/XKeyConvert.ts +68 -0
- package/src/__tests__/XUtils/bytesEqual.ts +16 -0
- package/src/__tests__/XUtils/emptyHeader.ts +12 -0
- package/src/__tests__/XUtils/numberToUint8Arr.ts +22 -0
- package/src/__tests__/XUtils/packMessage.ts +23 -0
- package/src/__tests__/XUtils/stringEncoding.ts +68 -0
- package/src/__tests__/XUtils/uint8ArrToNumber.ts +19 -0
- package/src/__tests__/XUtils/unpackMessage.ts +25 -0
- package/src/__tests__/xConcat.ts +18 -0
- package/src/__tests__/xDH.ts +16 -0
- package/src/__tests__/xEncode.ts +11 -0
- package/src/__tests__/xHMAC.ts +26 -0
- package/src/__tests__/xMnemonic.ts +12 -0
- package/src/index.ts +540 -0
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { decode as decodeBase64, encode as encodeBase64, } from "@stablelib/base64";
|
|
2
|
-
import { decode as encodeUTF8, encode as decodeUTF8 } from "@stablelib/utf8";
|
|
3
|
-
import * as bip39 from "bip39";
|
|
4
|
-
import { hmac } from "@noble/hashes/hmac.js";
|
|
5
|
-
import { sha256, sha512 } from "@noble/hashes/sha2.js";
|
|
6
1
|
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
2
|
+
import { hmac } from "@noble/hashes/hmac.js";
|
|
7
3
|
import { pbkdf2 as noblePbkdf2 } from "@noble/hashes/pbkdf2.js";
|
|
4
|
+
import { sha256, sha512 } from "@noble/hashes/sha2.js";
|
|
5
|
+
import { decode as decodeBase64, encode as encodeBase64, } from "@stablelib/base64";
|
|
6
|
+
import { encode as decodeUTF8, decode as encodeUTF8 } from "@stablelib/utf8";
|
|
7
|
+
import * as bip39 from "bip39";
|
|
8
8
|
import ed2curve from "ed2curve";
|
|
9
9
|
import { Packr } from "msgpackr";
|
|
10
10
|
import nacl from "tweetnacl";
|
|
11
|
+
import { z } from "zod/v4";
|
|
11
12
|
// msgpackr with useRecords:false emits standard msgpack (no nonstandard record extension).
|
|
12
13
|
// moreTypes:false keeps the extension set to only what other decoders understand.
|
|
13
14
|
// pack() returns Node Buffer (tight view) so consumers like axios send the correct bytes.
|
|
14
|
-
const packer = new Packr({
|
|
15
|
+
const packer = new Packr({ moreTypes: false, useRecords: false });
|
|
15
16
|
const msgpackEncode = packer.pack.bind(packer);
|
|
16
17
|
const msgpackDecode = packer.unpack.bind(packer);
|
|
17
18
|
/**
|
|
@@ -23,11 +24,12 @@ export const XKeyConvert = ed2curve;
|
|
|
23
24
|
* Provides several methods that are useful in working with bytes and
|
|
24
25
|
* vex messages.
|
|
25
26
|
*/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- intentional static utility namespace (public API surface)
|
|
26
28
|
export class XUtils {
|
|
27
|
-
static
|
|
29
|
+
static decodeBase64 = decodeBase64;
|
|
28
30
|
static decodeUTF8 = decodeUTF8;
|
|
29
31
|
static encodeBase64 = encodeBase64;
|
|
30
|
-
static
|
|
32
|
+
static encodeUTF8 = encodeUTF8;
|
|
31
33
|
/**
|
|
32
34
|
* Checks if two buffer-like objects are equal.
|
|
33
35
|
*
|
|
@@ -50,60 +52,40 @@ export class XUtils {
|
|
|
50
52
|
return true;
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
|
-
*
|
|
54
|
-
* The integer must be positive, and it must be able to be stored
|
|
55
|
-
* in six bytes.
|
|
55
|
+
* Decodes a hex string into a Uint8Array.
|
|
56
56
|
*
|
|
57
|
-
* @
|
|
58
|
-
* @returns The Uint8Array representation of n.
|
|
57
|
+
* @returns The Uint8Array.
|
|
59
58
|
*/
|
|
60
|
-
static
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
let str = n.toString(16);
|
|
65
|
-
while (str.length < 12) {
|
|
66
|
-
str = "0" + str;
|
|
59
|
+
static decodeHex(hexString) {
|
|
60
|
+
if (hexString.length === 0) {
|
|
61
|
+
return new Uint8Array();
|
|
67
62
|
}
|
|
68
|
-
|
|
63
|
+
const matches = hexString.match(/.{1,2}/g) ?? [];
|
|
64
|
+
return new Uint8Array(matches.map((byte) => parseInt(byte, 16)));
|
|
69
65
|
}
|
|
70
66
|
/**
|
|
71
|
-
*
|
|
67
|
+
* Decrypts a secret key from the binary format produced by encryptKeyData().
|
|
68
|
+
* No I/O — the caller handles reading the data.
|
|
72
69
|
*
|
|
73
|
-
* @param
|
|
74
|
-
* @
|
|
70
|
+
* @param keyData The encrypted key data as a Uint8Array.
|
|
71
|
+
* @param password The password used to encrypt.
|
|
72
|
+
* @returns The hex-encoded secret key.
|
|
75
73
|
*/
|
|
76
|
-
static
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
static decryptKeyData = (keyData, password) => {
|
|
75
|
+
const ITERATIONS = XUtils.uint8ArrToNumber(keyData.slice(0, 6));
|
|
76
|
+
const PKBDF_SALT = keyData.slice(6, 30);
|
|
77
|
+
const ENCRYPTION_NONCE = keyData.slice(30, 54);
|
|
78
|
+
const ENCRYPTED_KEY = keyData.slice(54);
|
|
79
|
+
const DERIVED_KEY = noblePbkdf2(sha512, password, PKBDF_SALT, {
|
|
80
|
+
c: ITERATIONS,
|
|
81
|
+
dkLen: 32,
|
|
82
|
+
});
|
|
83
|
+
const DECRYPTED_SIGNKEY = nacl.secretbox.open(ENCRYPTED_KEY, ENCRYPTION_NONCE, DERIVED_KEY);
|
|
84
|
+
if (DECRYPTED_SIGNKEY === null) {
|
|
85
|
+
throw new Error("Decryption failed. Wrong password?");
|
|
80
86
|
}
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Takes a vex message and unpacks it into its header and a javascript object
|
|
85
|
-
* respresentation of its body.
|
|
86
|
-
*
|
|
87
|
-
* @param arr The array to convert.
|
|
88
|
-
* @returns [32 byte header, message body]
|
|
89
|
-
*/
|
|
90
|
-
static unpackMessage(msg) {
|
|
91
|
-
const msgp = Uint8Array.from(msg);
|
|
92
|
-
const msgh = msgp.slice(0, xConstants.HEADER_SIZE);
|
|
93
|
-
const msgb = msgpackDecode(msgp.slice(xConstants.HEADER_SIZE));
|
|
94
|
-
return [msgh, msgb];
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Packs a javascript object and a 32 byte header into a vex message.
|
|
98
|
-
*
|
|
99
|
-
* @param arr The array to convert.
|
|
100
|
-
* @returns the packed message.
|
|
101
|
-
*/
|
|
102
|
-
static packMessage(msg, header) {
|
|
103
|
-
const msgb = msgpackEncode(msg);
|
|
104
|
-
const msgh = header || XUtils.emptyHeader();
|
|
105
|
-
return xConcat(msgh, msgb);
|
|
106
|
-
}
|
|
87
|
+
return XUtils.encodeHex(DECRYPTED_SIGNKEY);
|
|
88
|
+
};
|
|
107
89
|
/**
|
|
108
90
|
* Returns the empty header (32 0's)
|
|
109
91
|
*
|
|
@@ -112,6 +94,14 @@ export class XUtils {
|
|
|
112
94
|
static emptyHeader() {
|
|
113
95
|
return new Uint8Array(xConstants.HEADER_SIZE);
|
|
114
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Encodes a Uint8Array to a hex string.
|
|
99
|
+
*
|
|
100
|
+
* @returns The hex string.
|
|
101
|
+
*/
|
|
102
|
+
static encodeHex(bytes) {
|
|
103
|
+
return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
|
|
104
|
+
}
|
|
115
105
|
/**
|
|
116
106
|
* Encrypts a secret key with a password and saves it as a file.
|
|
117
107
|
*
|
|
@@ -132,9 +122,8 @@ export class XUtils {
|
|
|
132
122
|
const UNENCRYPTED_SIGNKEY = XUtils.decodeHex(keyToSave);
|
|
133
123
|
const OFFSET = 1000;
|
|
134
124
|
const rand = nacl.randomBytes(2);
|
|
135
|
-
const N1 =
|
|
136
|
-
const
|
|
137
|
-
const iterations = iterationOverride
|
|
125
|
+
const [N1 = 0, N2 = 0] = rand;
|
|
126
|
+
const iterations = iterationOverride !== undefined && iterationOverride !== 0
|
|
138
127
|
? iterationOverride
|
|
139
128
|
: N1 * N2 + OFFSET;
|
|
140
129
|
const ITERATIONS = XUtils.numberToUint8Arr(iterations);
|
|
@@ -160,57 +149,70 @@ export class XUtils {
|
|
|
160
149
|
return result;
|
|
161
150
|
};
|
|
162
151
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
152
|
+
* Returns a six bit Uint8Array representation of an integer.
|
|
153
|
+
* The integer must be positive, and it must be able to be stored
|
|
154
|
+
* in six bytes.
|
|
165
155
|
*
|
|
166
|
-
* @param
|
|
167
|
-
* @
|
|
168
|
-
* @returns The hex-encoded secret key.
|
|
156
|
+
* @param n The number to convert.
|
|
157
|
+
* @returns The Uint8Array representation of n.
|
|
169
158
|
*/
|
|
170
|
-
static
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const ENCRYPTED_KEY = keyData.slice(54);
|
|
175
|
-
const DERIVED_KEY = noblePbkdf2(sha512, password, PKBDF_SALT, {
|
|
176
|
-
c: ITERATIONS,
|
|
177
|
-
dkLen: 32,
|
|
178
|
-
});
|
|
179
|
-
const DECRYPTED_SIGNKEY = nacl.secretbox.open(ENCRYPTED_KEY, ENCRYPTION_NONCE, DERIVED_KEY);
|
|
180
|
-
if (!DECRYPTED_SIGNKEY) {
|
|
181
|
-
throw new Error("Decryption failed. Wrong password?");
|
|
159
|
+
static numberToUint8Arr(n) {
|
|
160
|
+
if (n < 0 || n > 281474976710655) {
|
|
161
|
+
throw new Error("Expected integer 0 < n < 281474976710655, received " +
|
|
162
|
+
String(n));
|
|
182
163
|
}
|
|
183
|
-
|
|
184
|
-
|
|
164
|
+
let str = n.toString(16);
|
|
165
|
+
while (str.length < 12) {
|
|
166
|
+
str = "0" + str;
|
|
167
|
+
}
|
|
168
|
+
return XUtils.decodeHex(str);
|
|
169
|
+
}
|
|
185
170
|
/**
|
|
186
|
-
*
|
|
171
|
+
* Packs a javascript object and a 32 byte header into a vex message.
|
|
187
172
|
*
|
|
188
|
-
* @
|
|
173
|
+
* @param arr The array to convert.
|
|
174
|
+
* @returns the packed message.
|
|
189
175
|
*/
|
|
190
|
-
static
|
|
191
|
-
|
|
192
|
-
|
|
176
|
+
static packMessage(msg, header) {
|
|
177
|
+
const msgb = msgpackEncode(msg);
|
|
178
|
+
const msgh = header ?? XUtils.emptyHeader();
|
|
179
|
+
return xConcat(msgh, msgb);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Converts a Uint8Array representation of an integer back into a number.
|
|
183
|
+
*
|
|
184
|
+
* @param arr The array to convert.
|
|
185
|
+
* @returns the number representation of arr.
|
|
186
|
+
*/
|
|
187
|
+
static uint8ArrToNumber(arr) {
|
|
188
|
+
let n = 0;
|
|
189
|
+
for (const byte of arr) {
|
|
190
|
+
n = n * 256 + byte;
|
|
193
191
|
}
|
|
194
|
-
return
|
|
192
|
+
return n;
|
|
195
193
|
}
|
|
196
194
|
/**
|
|
197
|
-
*
|
|
195
|
+
* Takes a vex message and unpacks it into its header and a javascript object
|
|
196
|
+
* respresentation of its body.
|
|
198
197
|
*
|
|
199
|
-
* @
|
|
198
|
+
* @param arr The array to convert.
|
|
199
|
+
* @returns [32 byte header, message body]
|
|
200
200
|
*/
|
|
201
|
-
static
|
|
202
|
-
|
|
201
|
+
static unpackMessage(msg) {
|
|
202
|
+
const msgp = Uint8Array.from(msg);
|
|
203
|
+
const msgh = msgp.slice(0, xConstants.HEADER_SIZE);
|
|
204
|
+
// Validate base fields exist, keep all extra fields for the caller to narrow
|
|
205
|
+
const raw = msgpackDecode(msgp.slice(xConstants.HEADER_SIZE));
|
|
206
|
+
const msgb = z
|
|
207
|
+
.object({
|
|
208
|
+
transmissionID: z.string(),
|
|
209
|
+
type: z.string(),
|
|
210
|
+
})
|
|
211
|
+
.loose()
|
|
212
|
+
.parse(raw);
|
|
213
|
+
return [msgh, msgb];
|
|
203
214
|
}
|
|
204
215
|
}
|
|
205
|
-
/**
|
|
206
|
-
* Gets a word list representation of a byte sequence.
|
|
207
|
-
*
|
|
208
|
-
* @param entropy The bytes to derive the wordlist from.
|
|
209
|
-
* @param wordList Optional, override the wordlist. See bip39 docs for details.
|
|
210
|
-
*/
|
|
211
|
-
export function xMnemonic(entropy, wordList) {
|
|
212
|
-
return bip39.entropyToMnemonic(XUtils.encodeHex(entropy), wordList);
|
|
213
|
-
}
|
|
214
216
|
/**
|
|
215
217
|
* Returns a 32 byte HMAC of a javscript object.
|
|
216
218
|
*
|
|
@@ -221,60 +223,33 @@ export function xHMAC(msg, SK) {
|
|
|
221
223
|
const packedMsg = msgpackEncode(msg);
|
|
222
224
|
return hmac(sha256, SK, packedMsg);
|
|
223
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Gets a word list representation of a byte sequence.
|
|
228
|
+
*
|
|
229
|
+
* @param entropy The bytes to derive the wordlist from.
|
|
230
|
+
* @param wordList Optional, override the wordlist. See bip39 docs for details.
|
|
231
|
+
*/
|
|
232
|
+
export function xMnemonic(entropy, wordList) {
|
|
233
|
+
return bip39.entropyToMnemonic(XUtils.encodeHex(entropy), wordList);
|
|
234
|
+
}
|
|
224
235
|
/**
|
|
225
236
|
* Constants for vex.
|
|
226
237
|
*/
|
|
227
238
|
export const xConstants = {
|
|
228
239
|
CURVE: "X25519",
|
|
229
240
|
HASH: "SHA-512",
|
|
230
|
-
|
|
241
|
+
HEADER_SIZE: 32,
|
|
231
242
|
INFO: "xchat",
|
|
243
|
+
KEY_LENGTH: 32,
|
|
232
244
|
MIN_OTK_SUPPLY: 100,
|
|
233
|
-
HEADER_SIZE: 32,
|
|
234
245
|
};
|
|
235
|
-
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
export function xMakeNonce() {
|
|
239
|
-
return nacl.randomBytes(24);
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Derives a 32 byte secret key from some initial key material.
|
|
243
|
-
*
|
|
244
|
-
* @param IKM the initial key material.
|
|
245
|
-
* @returns The generated key.
|
|
246
|
-
*/
|
|
247
|
-
// export function xKDF(IKM: Uint8Array): Uint8Array {
|
|
248
|
-
// return Uint8Array.from(
|
|
249
|
-
// hkdf(Buffer.from(IKM), xConstants.KEY_LENGTH, {
|
|
250
|
-
// salt: Buffer.from(xMakeSalt(xConstants.CURVE)),
|
|
251
|
-
// info: xConstants.INFO,
|
|
252
|
-
// hash: xConstants.HASH,
|
|
253
|
-
// })
|
|
254
|
-
// );
|
|
255
|
-
// }
|
|
256
|
-
export function xKDF(IKM) {
|
|
257
|
-
return hkdf(sha512, IKM, xMakeSalt(xConstants.CURVE), new TextEncoder().encode(xConstants.INFO), xConstants.KEY_LENGTH);
|
|
246
|
+
/** Generate a fresh X25519 box key pair. */
|
|
247
|
+
export function xBoxKeyPair() {
|
|
248
|
+
return nacl.box.keyPair();
|
|
258
249
|
}
|
|
259
|
-
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
* @param data the data to hash.
|
|
263
|
-
* @returns The hash of the data.
|
|
264
|
-
*/
|
|
265
|
-
export function xHash(data) {
|
|
266
|
-
return XUtils.encodeHex(sha512(data));
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Derives a shared Secret Key from a known private key and
|
|
270
|
-
* a peer's known public key.
|
|
271
|
-
*
|
|
272
|
-
* @param myPrivateKey Your own private key
|
|
273
|
-
* @param theirPublicKey Their public key
|
|
274
|
-
* @returns The derived shared secret, SK.
|
|
275
|
-
*/
|
|
276
|
-
export function xDH(myPrivateKey, theirPublicKey) {
|
|
277
|
-
return nacl.box.before(theirPublicKey, myPrivateKey);
|
|
250
|
+
/** Restore an X25519 box key pair from a 32-byte secret key. */
|
|
251
|
+
export function xBoxKeyPairFromSecret(secretKey) {
|
|
252
|
+
return nacl.box.keyPair.fromSecretKey(secretKey);
|
|
278
253
|
}
|
|
279
254
|
/**
|
|
280
255
|
* Concatanates multiple Uint8Arrays.
|
|
@@ -283,7 +258,7 @@ export function xDH(myPrivateKey, theirPublicKey) {
|
|
|
283
258
|
*/
|
|
284
259
|
export function xConcat(...arrays) {
|
|
285
260
|
const totalLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
|
286
|
-
if (
|
|
261
|
+
if (arrays.length === 0) {
|
|
287
262
|
return new Uint8Array();
|
|
288
263
|
}
|
|
289
264
|
const result = new Uint8Array(totalLength);
|
|
@@ -296,6 +271,18 @@ export function xConcat(...arrays) {
|
|
|
296
271
|
}
|
|
297
272
|
return result;
|
|
298
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Derives a shared Secret Key from a known private key and
|
|
276
|
+
* a peer's known public key.
|
|
277
|
+
*
|
|
278
|
+
* @param myPrivateKey Your own private key
|
|
279
|
+
* @param theirPublicKey Their public key
|
|
280
|
+
* @returns The derived shared secret, SK.
|
|
281
|
+
*/
|
|
282
|
+
export function xDH(myPrivateKey, theirPublicKey) {
|
|
283
|
+
return nacl.box.before(theirPublicKey, myPrivateKey);
|
|
284
|
+
}
|
|
285
|
+
// ── Key pair type ───────────────────────────────────────────────────────────
|
|
299
286
|
/**
|
|
300
287
|
* Encode an X25519 or X448 public key PK into a byte sequence.
|
|
301
288
|
* The encoding consists of 0 or 1 to represent the type of curve, followed by l
|
|
@@ -305,17 +292,17 @@ export function xConcat(...arrays) {
|
|
|
305
292
|
export function xEncode(curveType, publicKey) {
|
|
306
293
|
if (publicKey.length !== 32) {
|
|
307
294
|
throw new Error("Invalid key length, received key of length " +
|
|
308
|
-
publicKey.length +
|
|
295
|
+
String(publicKey.length) +
|
|
309
296
|
" and expected length 32.");
|
|
310
297
|
}
|
|
311
298
|
const bytes = [];
|
|
312
299
|
switch (curveType) {
|
|
313
|
-
case "X25519":
|
|
314
|
-
bytes.push(0);
|
|
315
|
-
break;
|
|
316
300
|
case "X448":
|
|
317
301
|
bytes.push(1);
|
|
318
302
|
break;
|
|
303
|
+
case "X25519":
|
|
304
|
+
bytes.push(0);
|
|
305
|
+
break;
|
|
319
306
|
}
|
|
320
307
|
const key = BigInt("0x" + XUtils.encodeHex(publicKey));
|
|
321
308
|
if (isEven(key)) {
|
|
@@ -329,22 +316,55 @@ export function xEncode(curveType, publicKey) {
|
|
|
329
316
|
}
|
|
330
317
|
return Uint8Array.from(bytes);
|
|
331
318
|
}
|
|
319
|
+
// ── Key generation ─────────────────────────────────────────────────────────
|
|
332
320
|
/**
|
|
333
|
-
*
|
|
321
|
+
* Hashes some data.
|
|
322
|
+
*
|
|
323
|
+
* @param data the data to hash.
|
|
324
|
+
* @returns The hash of the data.
|
|
334
325
|
*/
|
|
335
|
-
function
|
|
336
|
-
return
|
|
326
|
+
export function xHash(data) {
|
|
327
|
+
return XUtils.encodeHex(sha512(data));
|
|
328
|
+
}
|
|
329
|
+
export function xKDF(IKM) {
|
|
330
|
+
return hkdf(sha512, IKM, xMakeSalt(xConstants.CURVE), new TextEncoder().encode(xConstants.INFO), xConstants.KEY_LENGTH);
|
|
337
331
|
}
|
|
338
332
|
/**
|
|
339
|
-
*
|
|
333
|
+
* Returns a 24 byte random nonce of cryptographic quality.
|
|
340
334
|
*/
|
|
341
|
-
function
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
335
|
+
export function xMakeNonce() {
|
|
336
|
+
return nacl.randomBytes(24);
|
|
337
|
+
}
|
|
338
|
+
/** Cryptographically secure random bytes. */
|
|
339
|
+
export function xRandomBytes(length) {
|
|
340
|
+
return nacl.randomBytes(length);
|
|
341
|
+
}
|
|
342
|
+
// ── Signing ────────────────────────────────────────────────────────────────
|
|
343
|
+
/** Encrypt with a shared secret key. */
|
|
344
|
+
export function xSecretbox(plaintext, nonce, key) {
|
|
345
|
+
return nacl.secretbox(plaintext, nonce, key);
|
|
346
|
+
}
|
|
347
|
+
/** Decrypt with a shared secret key. Returns null if authentication fails. */
|
|
348
|
+
export function xSecretboxOpen(ciphertext, nonce, key) {
|
|
349
|
+
return nacl.secretbox.open(ciphertext, nonce, key);
|
|
350
|
+
}
|
|
351
|
+
// ── Symmetric encryption (XSalsa20-Poly1305) ──────────────────────────────
|
|
352
|
+
/** Sign a message with an Ed25519 secret key. Returns signed message (64-byte signature prefix + message). */
|
|
353
|
+
export function xSign(message, secretKey) {
|
|
354
|
+
return nacl.sign(message, secretKey);
|
|
355
|
+
}
|
|
356
|
+
/** Generate a fresh Ed25519 signing key pair. */
|
|
357
|
+
export function xSignKeyPair() {
|
|
358
|
+
return nacl.sign.keyPair();
|
|
359
|
+
}
|
|
360
|
+
// ── Random ─────────────────────────────────────────────────────────────────
|
|
361
|
+
/** Restore an Ed25519 signing key pair from a 64-byte secret key. */
|
|
362
|
+
export function xSignKeyPairFromSecret(secretKey) {
|
|
363
|
+
return nacl.sign.keyPair.fromSecretKey(secretKey);
|
|
364
|
+
}
|
|
365
|
+
/** Verify and open a signed message. Returns the original message, or null if verification fails. */
|
|
366
|
+
export function xSignOpen(signedMessage, publicKey) {
|
|
367
|
+
return nacl.sign.open(signedMessage, publicKey);
|
|
348
368
|
}
|
|
349
369
|
/**
|
|
350
370
|
* @ignore
|
|
@@ -357,4 +377,18 @@ function isEven(value) {
|
|
|
357
377
|
return false;
|
|
358
378
|
}
|
|
359
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* @ignore
|
|
382
|
+
*/
|
|
383
|
+
function keyLength(curve) {
|
|
384
|
+
return curve === "X25519" ? 32 : 57;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @ignore
|
|
388
|
+
*/
|
|
389
|
+
function xMakeSalt(curve) {
|
|
390
|
+
const salt = new Uint8Array(keyLength(curve));
|
|
391
|
+
salt.fill(0xff);
|
|
392
|
+
return salt;
|
|
393
|
+
}
|
|
360
394
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,MAAM,IAAI,YAAY,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,2FAA2F;AAC3F,kFAAkF;AAClF,0FAA0F;AAC1F,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAClE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC;;;GAGG;AACH,+HAA+H;AAC/H,MAAM,OAAO,MAAM;IACR,MAAM,CAAC,YAAY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