@vex-chat/crypto 1.0.11-rc.11 → 1.1.0-rc.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/dist/index.d.ts +2 -2
- package/dist/index.js +52 -100
- package/package.json +30 -26
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.changeset/migrate-to-native-crypto.md +0 -5
- package/.changeset/pre.json +0 -10
- package/CHANGELOG.md +0 -7
- package/RELEASING.md +0 -85
- package/jest.config.js +0 -16
- package/mise.toml +0 -3
- package/tsdoc.json +0 -34
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decode as decodeBase64, encode as encodeBase64 } from "@stablelib/base64";
|
|
2
2
|
import { decode as encodeUTF8, encode as decodeUTF8 } from "@stablelib/utf8";
|
|
3
|
-
import { IBaseMsg } from "@vex-chat/types";
|
|
3
|
+
import type { IBaseMsg } from "@vex-chat/types";
|
|
4
4
|
import ed2curve from "ed2curve";
|
|
5
5
|
/**
|
|
6
6
|
* Provides an interface that can map an ed25519 keypair to its equivalent
|
|
@@ -24,7 +24,7 @@ export declare class XUtils {
|
|
|
24
24
|
*
|
|
25
25
|
* @returns True if equal, else false.
|
|
26
26
|
*/
|
|
27
|
-
static bytesEqual(buf1:
|
|
27
|
+
static bytesEqual(buf1: Uint8Array | ArrayBuffer, buf2: Uint8Array | ArrayBuffer): boolean;
|
|
28
28
|
/**
|
|
29
29
|
* Returns a six bit Uint8Array representation of an integer.
|
|
30
30
|
* The integer must be positive, and it must be able to be stored
|
package/dist/index.js
CHANGED
|
@@ -1,77 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.xConstants = exports.XUtils = exports.XKeyConvert = void 0;
|
|
40
|
-
exports.xMnemonic = xMnemonic;
|
|
41
|
-
exports.xHMAC = xHMAC;
|
|
42
|
-
exports.xMakeNonce = xMakeNonce;
|
|
43
|
-
exports.xKDF = xKDF;
|
|
44
|
-
exports.xHash = xHash;
|
|
45
|
-
exports.xDH = xDH;
|
|
46
|
-
exports.xConcat = xConcat;
|
|
47
|
-
exports.xEncode = xEncode;
|
|
48
|
-
const base64_1 = require("@stablelib/base64");
|
|
49
|
-
const utf8_1 = require("@stablelib/utf8");
|
|
50
|
-
const bip39 = __importStar(require("bip39"));
|
|
51
|
-
const node_crypto_1 = require("node:crypto");
|
|
52
|
-
const ed2curve_1 = __importDefault(require("ed2curve"));
|
|
53
|
-
const fs_1 = __importDefault(require("fs"));
|
|
54
|
-
const node_crypto_2 = require("node:crypto");
|
|
55
|
-
const msgpackr_1 = require("msgpackr");
|
|
56
|
-
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
57
|
-
const packer = new msgpackr_1.Packr({
|
|
58
|
-
useRecords: false,
|
|
59
|
-
moreTypes: true,
|
|
60
|
-
});
|
|
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 { createHash, createHmac, pbkdf2Sync, randomBytes } from "node:crypto";
|
|
5
|
+
import ed2curve from "ed2curve";
|
|
6
|
+
import { writeFileSync, readFileSync } from "node:fs";
|
|
7
|
+
import { hkdfSync } from "node:crypto";
|
|
8
|
+
import { Packr } from "msgpackr";
|
|
9
|
+
import nacl from "tweetnacl";
|
|
10
|
+
// msgpackr with useRecords:false emits standard msgpack (no nonstandard record extension).
|
|
11
|
+
// moreTypes:false keeps the extension set to only what other decoders understand.
|
|
12
|
+
// pack() returns Node Buffer (tight view) so consumers like axios send the correct bytes.
|
|
13
|
+
const packer = new Packr({ useRecords: false, moreTypes: false });
|
|
14
|
+
const msgpackEncode = packer.pack.bind(packer);
|
|
15
|
+
const msgpackDecode = packer.unpack.bind(packer);
|
|
61
16
|
/**
|
|
62
17
|
* Provides an interface that can map an ed25519 keypair to its equivalent
|
|
63
18
|
* X25519 keypair.
|
|
64
19
|
*/
|
|
65
|
-
|
|
20
|
+
export const XKeyConvert = ed2curve;
|
|
66
21
|
/**
|
|
67
22
|
* Provides several methods that are useful in working with bytes and
|
|
68
23
|
* vex messages.
|
|
69
24
|
*/
|
|
70
|
-
class XUtils {
|
|
71
|
-
static encodeUTF8 =
|
|
72
|
-
static decodeUTF8 =
|
|
73
|
-
static encodeBase64 =
|
|
74
|
-
static decodeBase64 =
|
|
25
|
+
export class XUtils {
|
|
26
|
+
static encodeUTF8 = encodeUTF8;
|
|
27
|
+
static decodeUTF8 = decodeUTF8;
|
|
28
|
+
static encodeBase64 = encodeBase64;
|
|
29
|
+
static decodeBase64 = decodeBase64;
|
|
75
30
|
/**
|
|
76
31
|
* Checks if two buffer-like objects are equal.
|
|
77
32
|
*
|
|
@@ -81,13 +36,13 @@ class XUtils {
|
|
|
81
36
|
* @returns True if equal, else false.
|
|
82
37
|
*/
|
|
83
38
|
static bytesEqual(buf1, buf2) {
|
|
84
|
-
|
|
39
|
+
const a = buf1 instanceof Uint8Array ? buf1 : new Uint8Array(buf1);
|
|
40
|
+
const b = buf2 instanceof Uint8Array ? buf2 : new Uint8Array(buf2);
|
|
41
|
+
if (a.byteLength !== b.byteLength) {
|
|
85
42
|
return false;
|
|
86
43
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
for (let i = 0; i !== buf1.byteLength; i++) {
|
|
90
|
-
if (dv1[i] !== dv2[i]) {
|
|
44
|
+
for (let i = 0; i !== a.byteLength; i++) {
|
|
45
|
+
if (a[i] !== b[i]) {
|
|
91
46
|
return false;
|
|
92
47
|
}
|
|
93
48
|
}
|
|
@@ -129,9 +84,8 @@ class XUtils {
|
|
|
129
84
|
*/
|
|
130
85
|
static unpackMessage(msg) {
|
|
131
86
|
const msgp = Uint8Array.from(msg);
|
|
132
|
-
const msgh = msgp.slice(0,
|
|
133
|
-
|
|
134
|
-
const msgb = packer.unpack(msgp.slice(exports.xConstants.HEADER_SIZE));
|
|
87
|
+
const msgh = msgp.slice(0, xConstants.HEADER_SIZE);
|
|
88
|
+
const msgb = msgpackDecode(msgp.slice(xConstants.HEADER_SIZE));
|
|
135
89
|
return [msgh, msgb];
|
|
136
90
|
}
|
|
137
91
|
/**
|
|
@@ -141,8 +95,7 @@ class XUtils {
|
|
|
141
95
|
* @returns the packed message.
|
|
142
96
|
*/
|
|
143
97
|
static packMessage(msg, header) {
|
|
144
|
-
|
|
145
|
-
const msgb = packer.pack(msg);
|
|
98
|
+
const msgb = msgpackEncode(msg);
|
|
146
99
|
const msgh = header || XUtils.emptyHeader();
|
|
147
100
|
return xConcat(msgh, msgb);
|
|
148
101
|
}
|
|
@@ -152,7 +105,7 @@ class XUtils {
|
|
|
152
105
|
* @returns The empty header.
|
|
153
106
|
*/
|
|
154
107
|
static emptyHeader() {
|
|
155
|
-
return new Uint8Array(
|
|
108
|
+
return new Uint8Array(xConstants.HEADER_SIZE);
|
|
156
109
|
}
|
|
157
110
|
/**
|
|
158
111
|
* Encrypts a secret key with a password and saves it as a file.
|
|
@@ -167,15 +120,15 @@ class XUtils {
|
|
|
167
120
|
const UNENCRYPTED_SIGNKEY = XUtils.decodeHex(keyToSave);
|
|
168
121
|
const OFFSET = 1000;
|
|
169
122
|
// generate random amount of iterations using Native Crypto
|
|
170
|
-
const rand =
|
|
123
|
+
const rand = randomBytes(2);
|
|
171
124
|
const N1 = rand[0];
|
|
172
125
|
const N2 = rand[1];
|
|
173
126
|
const iterations = iterationOverride ? iterationOverride : N1 * N2 + OFFSET;
|
|
174
127
|
const ITERATIONS = XUtils.numberToUint8Arr(iterations);
|
|
175
128
|
const PKBDF_SALT = xMakeNonce();
|
|
176
|
-
const ENCRYPTION_KEY =
|
|
129
|
+
const ENCRYPTION_KEY = pbkdf2Sync(password, PKBDF_SALT, iterations, 32, "sha512");
|
|
177
130
|
const NONCE = xMakeNonce();
|
|
178
|
-
const ENCRYPTED_SIGNKEY =
|
|
131
|
+
const ENCRYPTED_SIGNKEY = nacl.secretbox(UNENCRYPTED_SIGNKEY, NONCE, new Uint8Array(ENCRYPTION_KEY));
|
|
179
132
|
const result = new Uint8Array(ITERATIONS.length +
|
|
180
133
|
PKBDF_SALT.length +
|
|
181
134
|
NONCE.length +
|
|
@@ -188,7 +141,7 @@ class XUtils {
|
|
|
188
141
|
result.set(NONCE, offset);
|
|
189
142
|
offset += NONCE.length;
|
|
190
143
|
result.set(ENCRYPTED_SIGNKEY, offset);
|
|
191
|
-
|
|
144
|
+
writeFileSync(path, result);
|
|
192
145
|
};
|
|
193
146
|
/**
|
|
194
147
|
* Decrypts and returns a secret key stored in a file with saveKeyFile().
|
|
@@ -197,13 +150,13 @@ class XUtils {
|
|
|
197
150
|
* @param password The password the file was encrypted with.
|
|
198
151
|
*/
|
|
199
152
|
static loadKeyFile = (path, password) => {
|
|
200
|
-
const keyFile = Uint8Array.from(
|
|
153
|
+
const keyFile = Uint8Array.from(readFileSync(path));
|
|
201
154
|
const ITERATIONS = XUtils.uint8ArrToNumber(keyFile.slice(0, 6));
|
|
202
155
|
const PKBDF_SALT = keyFile.slice(6, 30);
|
|
203
156
|
const ENCRYPTION_NONCE = keyFile.slice(30, 54);
|
|
204
157
|
const ENCRYPTED_KEY = keyFile.slice(54);
|
|
205
|
-
const DERIVED_KEY =
|
|
206
|
-
const DECRYPTED_SIGNKEY =
|
|
158
|
+
const DERIVED_KEY = pbkdf2Sync(password, PKBDF_SALT, ITERATIONS, 32, "sha512");
|
|
159
|
+
const DECRYPTED_SIGNKEY = nacl.secretbox.open(ENCRYPTED_KEY, ENCRYPTION_NONCE, new Uint8Array(DERIVED_KEY));
|
|
207
160
|
if (!DECRYPTED_SIGNKEY) {
|
|
208
161
|
throw new Error("Decryption failed. Wrong password?");
|
|
209
162
|
}
|
|
@@ -231,14 +184,13 @@ class XUtils {
|
|
|
231
184
|
return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
|
|
232
185
|
}
|
|
233
186
|
}
|
|
234
|
-
exports.XUtils = XUtils;
|
|
235
187
|
/**
|
|
236
188
|
* Gets a word list representation of a byte sequence.
|
|
237
189
|
*
|
|
238
190
|
* @param entropy The bytes to derive the wordlist from.
|
|
239
191
|
* @param wordList Optional, override the wordlist. See bip39 docs for details.
|
|
240
192
|
*/
|
|
241
|
-
function xMnemonic(entropy, wordList) {
|
|
193
|
+
export function xMnemonic(entropy, wordList) {
|
|
242
194
|
return bip39.entropyToMnemonic(Buffer.from(entropy), wordList);
|
|
243
195
|
}
|
|
244
196
|
/**
|
|
@@ -247,9 +199,9 @@ function xMnemonic(entropy, wordList) {
|
|
|
247
199
|
* @param msg the message to create the HMAC of
|
|
248
200
|
* @param SK the secret key to create the HMAC with
|
|
249
201
|
*/
|
|
250
|
-
function xHMAC(msg, SK) {
|
|
251
|
-
const packedMsg =
|
|
252
|
-
const hmacGen =
|
|
202
|
+
export function xHMAC(msg, SK) {
|
|
203
|
+
const packedMsg = msgpackEncode(msg);
|
|
204
|
+
const hmacGen = createHmac("sha256", Buffer.from(SK));
|
|
253
205
|
hmacGen.update(packedMsg);
|
|
254
206
|
const hmac = Uint8Array.from(hmacGen.digest());
|
|
255
207
|
return hmac;
|
|
@@ -257,7 +209,7 @@ function xHMAC(msg, SK) {
|
|
|
257
209
|
/**
|
|
258
210
|
* Constants for vex.
|
|
259
211
|
*/
|
|
260
|
-
|
|
212
|
+
export const xConstants = {
|
|
261
213
|
CURVE: "X25519",
|
|
262
214
|
HASH: "SHA-512",
|
|
263
215
|
KEY_LENGTH: 32,
|
|
@@ -268,8 +220,8 @@ exports.xConstants = {
|
|
|
268
220
|
/**
|
|
269
221
|
* Returns a 24 byte random nonce of cryptographic quality.
|
|
270
222
|
*/
|
|
271
|
-
function xMakeNonce() {
|
|
272
|
-
return
|
|
223
|
+
export function xMakeNonce() {
|
|
224
|
+
return nacl.randomBytes(24);
|
|
273
225
|
}
|
|
274
226
|
/**
|
|
275
227
|
* Derives a 32 byte secret key from some initial key material.
|
|
@@ -286,8 +238,8 @@ function xMakeNonce() {
|
|
|
286
238
|
// })
|
|
287
239
|
// );
|
|
288
240
|
// }
|
|
289
|
-
function xKDF(IKM) {
|
|
290
|
-
return new Uint8Array(
|
|
241
|
+
export function xKDF(IKM) {
|
|
242
|
+
return new Uint8Array(hkdfSync("sha512", IKM, xMakeSalt(xConstants.CURVE), xConstants.INFO, xConstants.KEY_LENGTH));
|
|
291
243
|
}
|
|
292
244
|
/**
|
|
293
245
|
* Hashes some data.
|
|
@@ -295,8 +247,8 @@ function xKDF(IKM) {
|
|
|
295
247
|
* @param data the data to hash.
|
|
296
248
|
* @returns The hash of the data.
|
|
297
249
|
*/
|
|
298
|
-
function xHash(data) {
|
|
299
|
-
const hash =
|
|
250
|
+
export function xHash(data) {
|
|
251
|
+
const hash = createHash("sha512");
|
|
300
252
|
return hash.update(data).digest("hex");
|
|
301
253
|
}
|
|
302
254
|
/**
|
|
@@ -307,15 +259,15 @@ function xHash(data) {
|
|
|
307
259
|
* @param theirPublicKey Their public key
|
|
308
260
|
* @returns The derived shared secret, SK.
|
|
309
261
|
*/
|
|
310
|
-
function xDH(myPrivateKey, theirPublicKey) {
|
|
311
|
-
return
|
|
262
|
+
export function xDH(myPrivateKey, theirPublicKey) {
|
|
263
|
+
return nacl.box.before(theirPublicKey, myPrivateKey);
|
|
312
264
|
}
|
|
313
265
|
/**
|
|
314
266
|
* Concatanates multiple Uint8Arrays.
|
|
315
267
|
*
|
|
316
268
|
* @param arrays As many Uint8Arrays as you would like to concatanate.
|
|
317
269
|
*/
|
|
318
|
-
function xConcat(...arrays) {
|
|
270
|
+
export function xConcat(...arrays) {
|
|
319
271
|
const totalLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
|
320
272
|
if (!arrays.length) {
|
|
321
273
|
return new Uint8Array();
|
|
@@ -336,7 +288,7 @@ function xConcat(...arrays) {
|
|
|
336
288
|
* ittle-endian encoding of the u-coordinate. See [rfc 7748](https://www.ietf.org/rfc/rfc7748.txt) for more
|
|
337
289
|
* details.
|
|
338
290
|
*/
|
|
339
|
-
function xEncode(curveType, publicKey) {
|
|
291
|
+
export function xEncode(curveType, publicKey) {
|
|
340
292
|
if (publicKey.length !== 32) {
|
|
341
293
|
throw new Error("Invalid key length, received key of length " +
|
|
342
294
|
publicKey.length +
|
package/package.json
CHANGED
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vex-chat/crypto",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0-rc.1",
|
|
4
4
|
"description": "Crypto primitives for Vex",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
5
7
|
"main": "./dist/index.js",
|
|
6
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
7
18
|
"author": "Extra <extrahash@protonmail.com>",
|
|
8
19
|
"license": "AGPL-3.0-or-later",
|
|
9
20
|
"scripts": {
|
|
10
21
|
"build": "rimraf dist && tsc",
|
|
11
|
-
"prepack": "
|
|
22
|
+
"prepack": "npm run build",
|
|
12
23
|
"prettier": "prettier '**/*.{ts,tsx,json,md}' --ignore-path .gitignore --write",
|
|
13
24
|
"lint": "eslint src/**/*.ts",
|
|
14
25
|
"lint-fix": "eslint src/**/*.ts --fix",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"test": "npx jest --runInBand --forceExit"
|
|
26
|
+
"prepublish": "npm run build",
|
|
27
|
+
"test": "vitest run"
|
|
18
28
|
},
|
|
19
29
|
"peerDependencies": {
|
|
20
|
-
"
|
|
30
|
+
"@vex-chat/types": "^1.0.0-rc.1",
|
|
31
|
+
"typescript": ">=5.9.0 || >=6.0.0"
|
|
21
32
|
},
|
|
22
33
|
"peerDependenciesMeta": {
|
|
23
34
|
"typescript": {
|
|
@@ -25,34 +36,29 @@
|
|
|
25
36
|
}
|
|
26
37
|
},
|
|
27
38
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"@stablelib/
|
|
30
|
-
"@
|
|
39
|
+
"msgpackr": "1.11.8",
|
|
40
|
+
"@stablelib/base64": "^2.0.1",
|
|
41
|
+
"@stablelib/utf8": "^2.1.0",
|
|
31
42
|
"bip39": "^3.1.0",
|
|
32
43
|
"ed2curve": "^0.3.0",
|
|
33
|
-
"
|
|
34
|
-
"tweetnacl": "^1.0.3",
|
|
35
|
-
"uuid": "^9.0.0"
|
|
44
|
+
"tweetnacl": "^1.0.3"
|
|
36
45
|
},
|
|
37
46
|
"devDependencies": {
|
|
38
47
|
"@changesets/cli": "^2.29.8",
|
|
39
48
|
"@types/create-hmac": "^1.1.3",
|
|
40
49
|
"@types/ed2curve": "^0.2.4",
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/lodash": "^4.17.21",
|
|
43
|
-
"@types/node": "^22.15.3",
|
|
50
|
+
"@types/node": "^24.12.2",
|
|
44
51
|
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
45
52
|
"@typescript-eslint/parser": "^8.57.1",
|
|
53
|
+
"@vex-chat/types": "^1.0.0-rc.1",
|
|
46
54
|
"eslint": "^10.1.0",
|
|
47
55
|
"eslint-config-prettier": "^9.0.0",
|
|
48
56
|
"husky": "^9.0.0",
|
|
49
|
-
"jest": "^30.3.0",
|
|
50
57
|
"lint-staged": "^15.2.0",
|
|
51
|
-
"lodash": "^4.17.23",
|
|
52
58
|
"prettier": "^3.2.0",
|
|
53
59
|
"rimraf": "^6.1.3",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
60
|
+
"typescript": "^6.0.2",
|
|
61
|
+
"vitest": "^3.0.0"
|
|
56
62
|
},
|
|
57
63
|
"lint-staged": {
|
|
58
64
|
"src/**/*.{ts}": [
|
|
@@ -63,14 +69,12 @@
|
|
|
63
69
|
"type": "git",
|
|
64
70
|
"url": "git+https://github.com/vex-chat/libvex-js.git"
|
|
65
71
|
},
|
|
66
|
-
"resolutions": {
|
|
67
|
-
"minimatch": "^9.0.7",
|
|
68
|
-
"flatted": "^3.4.2",
|
|
69
|
-
"ajv": "^6.14.0",
|
|
70
|
-
"lodash": "^4.17.21"
|
|
71
|
-
},
|
|
72
72
|
"bugs": {
|
|
73
73
|
"url": "https://github.com/vex-chat/libvex-js/issues"
|
|
74
74
|
},
|
|
75
|
-
"homepage": "https://github.com/vex-chat/libvex-js#readme"
|
|
75
|
+
"homepage": "https://github.com/vex-chat/libvex-js#readme",
|
|
76
|
+
"publishConfig": {
|
|
77
|
+
"access": "public",
|
|
78
|
+
"registry": "https://registry.npmjs.org/"
|
|
79
|
+
}
|
|
76
80
|
}
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in the changesets repo](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "public",
|
|
8
|
-
"baseBranch": "master",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
package/.changeset/pre.json
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# @vex-chat/crypto
|
|
2
|
-
|
|
3
|
-
## 1.0.0-rc.0
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- 19b36ca: Migrate to msgpackr and native node:crypto, replacing msgpack-lite, create-hmac, sha.js, pbkdf2, and futoin-hkdf with built-in Node.js crypto primitives. Add release tooling with changesets, mise, and updated CI workflows.
|
package/RELEASING.md
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# Releasing @vex-chat/crypto
|
|
2
|
-
|
|
3
|
-
This repo uses [Changesets](https://github.com/changesets/changesets) for versioning and publishing.
|
|
4
|
-
|
|
5
|
-
## Dependency Chain
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
@vex-chat/types
|
|
9
|
-
└─ @vex-chat/crypto ← you are here
|
|
10
|
-
└─ @vex-chat/libvex
|
|
11
|
-
└─ vex-desktop
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
**Publish types first** if it has changes, then publish crypto.
|
|
15
|
-
|
|
16
|
-
## Day-to-Day Workflow
|
|
17
|
-
|
|
18
|
-
### 1. Work on a feature branch
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
git checkout -b my-feature
|
|
22
|
-
# ... make changes ...
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### 2. Add a changeset before pushing
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx changeset
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
This prompts you to:
|
|
32
|
-
- Select the package (`@vex-chat/crypto`)
|
|
33
|
-
- Choose bump type (patch / minor / major)
|
|
34
|
-
- Write a short summary of the change
|
|
35
|
-
|
|
36
|
-
It creates a file in `.changeset/` — commit it with your code.
|
|
37
|
-
|
|
38
|
-
### 3. Push and open a PR
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
git add .
|
|
42
|
-
git commit -m "my feature"
|
|
43
|
-
git push -u origin my-feature
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 4. Merge to master
|
|
47
|
-
|
|
48
|
-
After merge, the **Release** GitHub Action will:
|
|
49
|
-
1. Detect pending changesets
|
|
50
|
-
2. Open a **"chore: version packages"** PR with bumped version + updated CHANGELOG.md
|
|
51
|
-
3. When you merge that PR, it publishes to npm automatically
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Release Candidates
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npx changeset pre enter rc # enter RC mode
|
|
59
|
-
npx changeset version # produces e.g. 0.9.0-rc.0
|
|
60
|
-
npx changeset publish # publishes with --tag rc
|
|
61
|
-
|
|
62
|
-
# ... more changes + changesets ...
|
|
63
|
-
npx changeset version # produces 0.9.0-rc.1
|
|
64
|
-
npx changeset publish
|
|
65
|
-
|
|
66
|
-
# ready for stable:
|
|
67
|
-
npx changeset pre exit
|
|
68
|
-
npx changeset version # produces 0.9.0
|
|
69
|
-
npx changeset publish # publishes as @latest
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## GitHub Secrets Required
|
|
73
|
-
|
|
74
|
-
- `NPM_TOKEN` — npm access token with publish permission for `@vex-chat` scope
|
|
75
|
-
- `GITHUB_TOKEN` — provided automatically by GitHub Actions
|
|
76
|
-
|
|
77
|
-
## Local Development
|
|
78
|
-
|
|
79
|
-
You can still use `yalc` for local cross-repo development:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
yarn push # builds and pushes to yalc for local consumers
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
When publishing for real, changesets handles versioning — yalc is just for local dev loops.
|
package/jest.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
roots: ["<rootDir>/src"],
|
|
3
|
-
testMatch: [
|
|
4
|
-
"**/__tests__/**/*.+(ts|tsx|js)",
|
|
5
|
-
"**/?(*.)+(spec|test).+(ts|tsx|js)",
|
|
6
|
-
],
|
|
7
|
-
transform: {
|
|
8
|
-
"^.+\\.(ts|tsx)$": [
|
|
9
|
-
"ts-jest",
|
|
10
|
-
{
|
|
11
|
-
diagnostics: false,
|
|
12
|
-
isolatedModules: true,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
};
|
package/mise.toml
DELETED
package/tsdoc.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tags": {
|
|
3
|
-
"allowUnknownTags": true
|
|
4
|
-
},
|
|
5
|
-
"plugins": [
|
|
6
|
-
"plugins/markdown",
|
|
7
|
-
"/home/ender/.npm/_npx/229717/lib/node_modules/tsdoc/template/plugins/TSDoc.js"
|
|
8
|
-
],
|
|
9
|
-
"opts": {
|
|
10
|
-
"template": "/home/ender/.npm/_npx/229717/lib/node_modules/tsdoc/template",
|
|
11
|
-
"recurse": "true"
|
|
12
|
-
},
|
|
13
|
-
"templates": {
|
|
14
|
-
"cleverLinks": false,
|
|
15
|
-
"monospaceLinks": false
|
|
16
|
-
},
|
|
17
|
-
"source": {
|
|
18
|
-
"includePattern": "(\\.d)?\\.ts$"
|
|
19
|
-
},
|
|
20
|
-
"markdown": {
|
|
21
|
-
"parser": "gfm",
|
|
22
|
-
"hardwrap": true
|
|
23
|
-
},
|
|
24
|
-
"tsdoc": {
|
|
25
|
-
"source": "/home/ender/code/crypto-js/src/",
|
|
26
|
-
"destination": "/home/ender/code/crypto-js/docs",
|
|
27
|
-
"tutorials": "",
|
|
28
|
-
"systemName": "crypto-js",
|
|
29
|
-
"footer": "",
|
|
30
|
-
"copyright": "crypto-js Copyright © 2020 ender.",
|
|
31
|
-
"outputSourceFiles": true,
|
|
32
|
-
"commentsOnly": true
|
|
33
|
-
}
|
|
34
|
-
}
|