@jscrypto/core 0.1.0 → 0.2.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/dist/component.d.ts +1 -0
- package/dist/component.d.ts.map +1 -1
- package/dist/index.cjs +104 -58
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +106 -58
- package/dist/index.mjs.map +2 -2
- package/dist/jscrypto-core.iife.js +104 -58
- package/dist/jscrypto-core.iife.js.map +2 -2
- package/dist/jscrypto-core.iife.min.js +2 -2
- package/dist/jscrypto-core.iife.min.js.map +3 -3
- package/dist/jscrypto-core.umd.js +104 -58
- package/dist/jscrypto-core.umd.js.map +2 -2
- package/dist/jscrypto-core.umd.min.js +2 -2
- package/dist/jscrypto-core.umd.min.js.map +3 -3
- package/dist/passphrase.js +39 -32
- package/dist/passphrase.js.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +32 -23
- package/dist/transform.js.map +1 -1
- package/package.json +10 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @jscrypto/core v0.
|
|
2
|
+
* @jscrypto/core v0.2.0
|
|
3
3
|
* Copyright 2026 Chen, Yi-Cyuan
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
*/
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __defProps = Object.defineProperties;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
6
37
|
|
|
7
38
|
// packages/core/src/errors.ts
|
|
8
39
|
var CryptoError = class extends Error {
|
|
@@ -77,8 +108,9 @@ function createPassphraseCipher(registry, options) {
|
|
|
77
108
|
};
|
|
78
109
|
}
|
|
79
110
|
function createPassphraseEncryptor(registry, options) {
|
|
111
|
+
var _a;
|
|
80
112
|
const format = resolveFormat(registry, options);
|
|
81
|
-
const salt = options.salt ? options.salt.slice() : randomBytes(options.saltSize
|
|
113
|
+
const salt = options.salt ? options.salt.slice() : randomBytes((_a = options.saltSize) != null ? _a : 8);
|
|
82
114
|
const { key, iv } = deriveKeyIv(registry, options, salt);
|
|
83
115
|
const encryptor = registry.createCipher(toTransformOptions(options, key, iv)).createEncryptor();
|
|
84
116
|
if (!format) {
|
|
@@ -90,16 +122,16 @@ function createPassphraseEncryptor(registry, options) {
|
|
|
90
122
|
let emittedHeader = false;
|
|
91
123
|
const emitHeader = () => {
|
|
92
124
|
if (emittedHeader) {
|
|
93
|
-
return new Uint8Array();
|
|
125
|
+
return new Uint8Array(0);
|
|
94
126
|
}
|
|
95
127
|
emittedHeader = true;
|
|
96
|
-
return format.stringify({ ciphertext: new Uint8Array(), salt });
|
|
128
|
+
return format.stringify({ ciphertext: new Uint8Array(0), salt });
|
|
97
129
|
};
|
|
98
130
|
return {
|
|
99
131
|
process(input) {
|
|
100
132
|
return concatBytes(emitHeader(), encryptor.process(input));
|
|
101
133
|
},
|
|
102
|
-
finalize(input = new Uint8Array()) {
|
|
134
|
+
finalize(input = new Uint8Array(0)) {
|
|
103
135
|
return concatBytes(emitHeader(), encryptor.finalize(input));
|
|
104
136
|
}
|
|
105
137
|
};
|
|
@@ -107,43 +139,44 @@ function createPassphraseEncryptor(registry, options) {
|
|
|
107
139
|
function createPassphraseDecryptor(registry, options) {
|
|
108
140
|
const format = resolveFormat(registry, options);
|
|
109
141
|
if (!format) {
|
|
110
|
-
const { key, iv } = deriveKeyIv(registry, options, new Uint8Array());
|
|
142
|
+
const { key, iv } = deriveKeyIv(registry, options, new Uint8Array(0));
|
|
111
143
|
return registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();
|
|
112
144
|
}
|
|
113
145
|
if (!isStreamingOpenSslFormat(format)) {
|
|
114
146
|
return createBufferedFormatDecryptor(registry, options, format);
|
|
115
147
|
}
|
|
116
|
-
let header = new Uint8Array();
|
|
148
|
+
let header = new Uint8Array(0);
|
|
117
149
|
let decryptor;
|
|
118
150
|
const initDecryptor = (input) => {
|
|
151
|
+
var _a;
|
|
119
152
|
if (decryptor) {
|
|
120
153
|
return input;
|
|
121
154
|
}
|
|
122
155
|
header = new Uint8Array(concatBytes(header, input));
|
|
123
156
|
if (header.length < 16) {
|
|
124
|
-
return new Uint8Array();
|
|
157
|
+
return new Uint8Array(0);
|
|
125
158
|
}
|
|
126
159
|
const parsed = format.parse(header.slice(0, 16));
|
|
127
160
|
const hasSalt = parsed.salt !== void 0;
|
|
128
|
-
const salt = parsed.salt
|
|
161
|
+
const salt = (_a = parsed.salt) != null ? _a : new Uint8Array(0);
|
|
129
162
|
const ciphertext = hasSalt ? concatBytes(parsed.ciphertext, header.slice(16)) : header;
|
|
130
163
|
const { key, iv } = deriveKeyIv(registry, options, salt);
|
|
131
164
|
decryptor = registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();
|
|
132
|
-
header = new Uint8Array();
|
|
165
|
+
header = new Uint8Array(0);
|
|
133
166
|
return ciphertext;
|
|
134
167
|
};
|
|
135
168
|
return {
|
|
136
169
|
process(input) {
|
|
137
170
|
const ciphertext = initDecryptor(input);
|
|
138
|
-
return decryptor ? decryptor.process(ciphertext) : new Uint8Array();
|
|
171
|
+
return decryptor ? decryptor.process(ciphertext) : new Uint8Array(0);
|
|
139
172
|
},
|
|
140
|
-
finalize(input = new Uint8Array()) {
|
|
173
|
+
finalize(input = new Uint8Array(0)) {
|
|
141
174
|
const ciphertext = initDecryptor(input);
|
|
142
175
|
if (!decryptor) {
|
|
143
|
-
const { key, iv } = deriveKeyIv(registry, options, new Uint8Array());
|
|
176
|
+
const { key, iv } = deriveKeyIv(registry, options, new Uint8Array(0));
|
|
144
177
|
decryptor = registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();
|
|
145
178
|
const buffered = header;
|
|
146
|
-
header = new Uint8Array();
|
|
179
|
+
header = new Uint8Array(0);
|
|
147
180
|
return decryptor.finalize(buffered);
|
|
148
181
|
}
|
|
149
182
|
return decryptor.finalize(ciphertext);
|
|
@@ -158,9 +191,9 @@ function createBufferedFormatEncryptor(format, salt, encryptor) {
|
|
|
158
191
|
if (output.length !== 0) {
|
|
159
192
|
chunks.push(output);
|
|
160
193
|
}
|
|
161
|
-
return new Uint8Array();
|
|
194
|
+
return new Uint8Array(0);
|
|
162
195
|
},
|
|
163
|
-
finalize(input = new Uint8Array()) {
|
|
196
|
+
finalize(input = new Uint8Array(0)) {
|
|
164
197
|
const output = encryptor.finalize(input);
|
|
165
198
|
if (output.length !== 0) {
|
|
166
199
|
chunks.push(output);
|
|
@@ -176,14 +209,15 @@ function createBufferedFormatDecryptor(registry, options, format) {
|
|
|
176
209
|
if (input.length !== 0) {
|
|
177
210
|
chunks.push(input);
|
|
178
211
|
}
|
|
179
|
-
return new Uint8Array();
|
|
212
|
+
return new Uint8Array(0);
|
|
180
213
|
},
|
|
181
|
-
finalize(input = new Uint8Array()) {
|
|
214
|
+
finalize(input = new Uint8Array(0)) {
|
|
215
|
+
var _a;
|
|
182
216
|
if (input.length !== 0) {
|
|
183
217
|
chunks.push(input);
|
|
184
218
|
}
|
|
185
219
|
const parsed = format.parse(concatBytes(...chunks));
|
|
186
|
-
const { key, iv } = deriveKeyIv(registry, options, parsed.salt
|
|
220
|
+
const { key, iv } = deriveKeyIv(registry, options, (_a = parsed.salt) != null ? _a : new Uint8Array(0));
|
|
187
221
|
return registry.createCipher(toTransformOptions(options, key, iv)).decrypt(parsed.ciphertext);
|
|
188
222
|
}
|
|
189
223
|
};
|
|
@@ -200,33 +234,37 @@ function deriveKeyIv(registry, options, salt) {
|
|
|
200
234
|
function deriveSync(registry, options, salt, length) {
|
|
201
235
|
const kdfOptions = normalizeNamedOptions(options.kdf);
|
|
202
236
|
const kdf = registry.get("kdf", kdfOptions.name);
|
|
203
|
-
const result = kdf.derive({
|
|
204
|
-
...withoutName(kdfOptions),
|
|
237
|
+
const result = kdf.derive(__spreadProps(__spreadValues({}, withoutName(kdfOptions)), {
|
|
205
238
|
passphrase: options.passphrase,
|
|
206
239
|
salt,
|
|
207
240
|
length
|
|
208
|
-
});
|
|
241
|
+
}));
|
|
209
242
|
if (result instanceof Promise) {
|
|
210
243
|
throw new Error(`KDF ${kdfOptions.name} is asynchronous; use an async passphrase cipher API.`);
|
|
211
244
|
}
|
|
212
245
|
return result;
|
|
213
246
|
}
|
|
214
247
|
function toTransformOptions(options, key, iv) {
|
|
215
|
-
const {
|
|
248
|
+
const _a = options, {
|
|
216
249
|
passphrase,
|
|
217
250
|
kdf,
|
|
218
251
|
format,
|
|
219
252
|
salt,
|
|
220
253
|
saltSize,
|
|
221
254
|
keySize,
|
|
222
|
-
ivSize
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
255
|
+
ivSize
|
|
256
|
+
} = _a, transformOptions = __objRest(_a, [
|
|
257
|
+
"passphrase",
|
|
258
|
+
"kdf",
|
|
259
|
+
"format",
|
|
260
|
+
"salt",
|
|
261
|
+
"saltSize",
|
|
262
|
+
"keySize",
|
|
263
|
+
"ivSize"
|
|
264
|
+
]);
|
|
265
|
+
return __spreadValues(__spreadProps(__spreadValues({}, transformOptions), {
|
|
266
|
+
key
|
|
267
|
+
}), iv ? { iv } : {});
|
|
230
268
|
}
|
|
231
269
|
function resolveKeySize(registry, options) {
|
|
232
270
|
if (options.keySize !== void 0) {
|
|
@@ -260,17 +298,18 @@ function normalizeNamedOptions(options) {
|
|
|
260
298
|
return typeof options === "string" ? { name: options } : options;
|
|
261
299
|
}
|
|
262
300
|
function withoutName(options) {
|
|
263
|
-
const { name,
|
|
301
|
+
const _a = options, { name } = _a, rest = __objRest(_a, ["name"]);
|
|
264
302
|
return rest;
|
|
265
303
|
}
|
|
266
304
|
function randomBytes(length) {
|
|
305
|
+
var _a;
|
|
267
306
|
assertNonNegativeInteger(length, "saltSize");
|
|
268
307
|
const bytes = new Uint8Array(length);
|
|
269
308
|
if (bytes.length === 0) {
|
|
270
309
|
return bytes;
|
|
271
310
|
}
|
|
272
311
|
const crypto = globalThis;
|
|
273
|
-
crypto.crypto
|
|
312
|
+
(_a = crypto.crypto) == null ? void 0 : _a.getRandomValues(bytes);
|
|
274
313
|
if (bytes.some((byte) => byte !== 0)) {
|
|
275
314
|
return bytes;
|
|
276
315
|
}
|
|
@@ -303,27 +342,29 @@ function createEncryptor(registry, options) {
|
|
|
303
342
|
const blockCipher = cipher.create(options.key);
|
|
304
343
|
const modeEncryptor = mode.createEncryptor({
|
|
305
344
|
cipher: blockCipher,
|
|
306
|
-
iv: options.iv
|
|
345
|
+
iv: options.iv,
|
|
346
|
+
options
|
|
307
347
|
});
|
|
308
348
|
if (mode.requiresPadding === false) {
|
|
309
349
|
return createStreamEncryptor(modeEncryptor);
|
|
310
350
|
}
|
|
351
|
+
const blockPadding = padding;
|
|
311
352
|
let finalized = false;
|
|
312
|
-
let pending = new Uint8Array();
|
|
353
|
+
let pending = new Uint8Array(0);
|
|
313
354
|
return {
|
|
314
355
|
process(input) {
|
|
315
356
|
assertNotFinalized(finalized);
|
|
316
357
|
const data = concatBytes(pending, input);
|
|
317
358
|
const processLength = data.length - data.length % blockCipher.blockSize;
|
|
318
359
|
pending = data.slice(processLength);
|
|
319
|
-
return processLength === 0 ? new Uint8Array() : modeEncryptor.process(data.subarray(0, processLength));
|
|
360
|
+
return processLength === 0 ? new Uint8Array(0) : modeEncryptor.process(data.subarray(0, processLength));
|
|
320
361
|
},
|
|
321
|
-
finalize(input = new Uint8Array()) {
|
|
362
|
+
finalize(input = new Uint8Array(0)) {
|
|
322
363
|
assertNotFinalized(finalized);
|
|
323
|
-
const processed = input.length === 0 ? new Uint8Array() : this.process(input);
|
|
364
|
+
const processed = input.length === 0 ? new Uint8Array(0) : this.process(input);
|
|
324
365
|
finalized = true;
|
|
325
|
-
const finalBlock =
|
|
326
|
-
pending = new Uint8Array();
|
|
366
|
+
const finalBlock = blockPadding.pad(pending, blockCipher.blockSize);
|
|
367
|
+
pending = new Uint8Array(0);
|
|
327
368
|
return concatBytes(processed, modeEncryptor.finalize(finalBlock));
|
|
328
369
|
}
|
|
329
370
|
};
|
|
@@ -340,14 +381,16 @@ function createDecryptor(registry, options) {
|
|
|
340
381
|
const blockCipher = cipher.create(options.key);
|
|
341
382
|
const modeDecryptor = mode.createDecryptor({
|
|
342
383
|
cipher: blockCipher,
|
|
343
|
-
iv: options.iv
|
|
384
|
+
iv: options.iv,
|
|
385
|
+
options
|
|
344
386
|
});
|
|
345
387
|
if (mode.requiresPadding === false) {
|
|
346
388
|
return createStreamDecryptor(modeDecryptor);
|
|
347
389
|
}
|
|
390
|
+
const blockPadding = padding;
|
|
348
391
|
let finalized = false;
|
|
349
|
-
let pending = new Uint8Array();
|
|
350
|
-
let plaintextPending = new Uint8Array();
|
|
392
|
+
let pending = new Uint8Array(0);
|
|
393
|
+
let plaintextPending = new Uint8Array(0);
|
|
351
394
|
return {
|
|
352
395
|
process(input) {
|
|
353
396
|
assertNotFinalized(finalized);
|
|
@@ -355,23 +398,23 @@ function createDecryptor(registry, options) {
|
|
|
355
398
|
const processLength = data.length - data.length % blockCipher.blockSize;
|
|
356
399
|
pending = data.slice(processLength);
|
|
357
400
|
if (processLength === 0) {
|
|
358
|
-
return new Uint8Array();
|
|
401
|
+
return new Uint8Array(0);
|
|
359
402
|
}
|
|
360
403
|
const decrypted = modeDecryptor.process(data.subarray(0, processLength));
|
|
361
404
|
const output = plaintextPending;
|
|
362
405
|
plaintextPending = decrypted;
|
|
363
406
|
return output;
|
|
364
407
|
},
|
|
365
|
-
finalize(input = new Uint8Array()) {
|
|
408
|
+
finalize(input = new Uint8Array(0)) {
|
|
366
409
|
assertNotFinalized(finalized);
|
|
367
|
-
const processed = input.length === 0 ? new Uint8Array() : this.process(input);
|
|
410
|
+
const processed = input.length === 0 ? new Uint8Array(0) : this.process(input);
|
|
368
411
|
finalized = true;
|
|
369
412
|
if (pending.length !== 0) {
|
|
370
|
-
|
|
413
|
+
blockPadding.unpad(pending, blockCipher.blockSize);
|
|
371
414
|
}
|
|
372
|
-
const finalPlaintext =
|
|
373
|
-
pending = new Uint8Array();
|
|
374
|
-
plaintextPending = new Uint8Array();
|
|
415
|
+
const finalPlaintext = blockPadding.unpad(plaintextPending, blockCipher.blockSize);
|
|
416
|
+
pending = new Uint8Array(0);
|
|
417
|
+
plaintextPending = new Uint8Array(0);
|
|
375
418
|
return concatBytes(processed, finalPlaintext, modeDecryptor.finalize());
|
|
376
419
|
}
|
|
377
420
|
};
|
|
@@ -383,11 +426,11 @@ function createStreamEncryptor(modeEncryptor) {
|
|
|
383
426
|
assertNotFinalized(finalized);
|
|
384
427
|
return modeEncryptor.process(input);
|
|
385
428
|
},
|
|
386
|
-
finalize(input = new Uint8Array()) {
|
|
429
|
+
finalize(input = new Uint8Array(0)) {
|
|
387
430
|
assertNotFinalized(finalized);
|
|
388
431
|
finalized = true;
|
|
389
432
|
return concatBytes(
|
|
390
|
-
input.length === 0 ? new Uint8Array() : modeEncryptor.process(input),
|
|
433
|
+
input.length === 0 ? new Uint8Array(0) : modeEncryptor.process(input),
|
|
391
434
|
modeEncryptor.finalize()
|
|
392
435
|
);
|
|
393
436
|
}
|
|
@@ -400,11 +443,11 @@ function createStreamDecryptor(modeDecryptor) {
|
|
|
400
443
|
assertNotFinalized(finalized);
|
|
401
444
|
return modeDecryptor.process(input);
|
|
402
445
|
},
|
|
403
|
-
finalize(input = new Uint8Array()) {
|
|
446
|
+
finalize(input = new Uint8Array(0)) {
|
|
404
447
|
assertNotFinalized(finalized);
|
|
405
448
|
finalized = true;
|
|
406
449
|
return concatBytes(
|
|
407
|
-
input.length === 0 ? new Uint8Array() : modeDecryptor.process(input),
|
|
450
|
+
input.length === 0 ? new Uint8Array(0) : modeDecryptor.process(input),
|
|
408
451
|
modeDecryptor.finalize()
|
|
409
452
|
);
|
|
410
453
|
}
|
|
@@ -414,13 +457,18 @@ function resolveBlockOptions(registry, options) {
|
|
|
414
457
|
if (!options.mode) {
|
|
415
458
|
throw new Error(`${options.cipher} block cipher requires a mode.`);
|
|
416
459
|
}
|
|
417
|
-
|
|
418
|
-
|
|
460
|
+
const mode = registry.get("mode", options.mode);
|
|
461
|
+
let padding;
|
|
462
|
+
if (mode.requiresPadding !== false) {
|
|
463
|
+
if (!options.padding) {
|
|
464
|
+
throw new Error(`${options.cipher} block cipher requires padding.`);
|
|
465
|
+
}
|
|
466
|
+
padding = registry.get("padding", options.padding);
|
|
419
467
|
}
|
|
420
468
|
return {
|
|
421
469
|
cipher: registry.get("cipher", options.cipher),
|
|
422
|
-
mode
|
|
423
|
-
padding
|
|
470
|
+
mode,
|
|
471
|
+
padding
|
|
424
472
|
};
|
|
425
473
|
}
|
|
426
474
|
function assertNotFinalized(finalized) {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/errors.ts", "../src/bytes.ts", "../src/passphrase.ts", "../src/transform.ts", "../src/registry.ts", "../src/blocks.ts"],
|
|
4
|
-
"sourcesContent": ["export class CryptoError extends Error {\n constructor(message: string) {\n super(message);\n this.name = new.target.name;\n }\n}\n\nexport class DuplicateComponentError extends CryptoError {\n constructor(kind: string, name: string) {\n super(`Component already registered: ${kind}:${name}`);\n }\n}\n\nexport class MissingComponentError extends CryptoError {\n constructor(kind: string, name: string) {\n super(`Component not found: ${kind}:${name}`);\n }\n}\n\n", "export function concatBytes(...chunks: readonly Uint8Array[]): Uint8Array {\n const length = chunks.reduce((sum, chunk) => sum + chunk.length, 0);\n const output = new Uint8Array(length);\n let offset = 0;\n\n for (const chunk of chunks) {\n output.set(chunk, offset);\n offset += chunk.length;\n }\n\n return output;\n}\n\nexport function equalBytes(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n let diff = 0;\n for (let i = 0; i < a.length; i++) {\n diff |= a[i] ^ b[i];\n }\n return diff === 0;\n}\n\nexport function xorBytes(a: Uint8Array, b: Uint8Array): Uint8Array {\n if (a.length !== b.length) {\n throw new Error('XOR inputs must have the same length.');\n }\n\n const output = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n output[i] = a[i] ^ b[i];\n }\n return output;\n}\n\nexport function assertBytes(value: unknown, name: string): asserts value is Uint8Array {\n if (!(value instanceof Uint8Array)) {\n throw new TypeError(`${name} must be a Uint8Array.`);\n }\n}\n", "import type { CipherComponent, FormatComponent, KdfComponent, Transform } from './component.js';\nimport type { Registry } from './registry.js';\nimport type { CreateTransformOptions } from './transform.js';\nimport { concatBytes } from './bytes.js';\n\nexport interface CreatePassphraseCipherOptions {\n cipher: string;\n mode?: string;\n padding?: string;\n passphrase: Uint8Array | string;\n kdf: string | KdfOptions;\n format?: string | FormatOptions;\n salt?: Uint8Array;\n saltSize?: number;\n keySize?: number;\n ivSize?: number;\n [option: string]: unknown;\n}\n\nexport interface KdfOptions {\n name: string;\n [option: string]: unknown;\n}\n\nexport interface FormatOptions {\n name: string;\n [option: string]: unknown;\n}\n\nexport interface PassphraseCipherFacade {\n encrypt(plaintext: Uint8Array): Uint8Array;\n decrypt(input: Uint8Array): Uint8Array;\n createEncryptor(): Transform;\n createDecryptor(): Transform;\n}\n\nexport function createPassphraseCipher(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): PassphraseCipherFacade {\n return {\n encrypt(plaintext) {\n return concatBytes(this.createEncryptor().finalize(plaintext));\n },\n\n decrypt(input) {\n return concatBytes(this.createDecryptor().finalize(input));\n },\n\n createEncryptor() {\n return createPassphraseEncryptor(registry, options);\n },\n\n createDecryptor() {\n return createPassphraseDecryptor(registry, options);\n },\n };\n}\n\nfunction createPassphraseEncryptor(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): Transform {\n const format = resolveFormat(registry, options);\n const salt = options.salt ? options.salt.slice() : randomBytes(options.saltSize ?? 8);\n const { key, iv } = deriveKeyIv(registry, options, salt);\n const encryptor = registry.createCipher(toTransformOptions(options, key, iv)).createEncryptor();\n\n if (!format) {\n return encryptor;\n }\n\n if (!isStreamingOpenSslFormat(format)) {\n return createBufferedFormatEncryptor(format, salt, encryptor);\n }\n\n let emittedHeader = false;\n const emitHeader = (): Uint8Array => {\n if (emittedHeader) {\n return new Uint8Array();\n }\n emittedHeader = true;\n return format.stringify({ ciphertext: new Uint8Array(), salt });\n };\n\n return {\n process(input) {\n return concatBytes(emitHeader(), encryptor.process(input));\n },\n\n finalize(input = new Uint8Array()) {\n return concatBytes(emitHeader(), encryptor.finalize(input));\n },\n };\n}\n\nfunction createPassphraseDecryptor(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): Transform {\n const format = resolveFormat(registry, options);\n\n if (!format) {\n const { key, iv } = deriveKeyIv(registry, options, new Uint8Array());\n return registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();\n }\n\n if (!isStreamingOpenSslFormat(format)) {\n return createBufferedFormatDecryptor(registry, options, format);\n }\n\n let header = new Uint8Array();\n let decryptor: Transform | undefined;\n\n const initDecryptor = (input: Uint8Array): Uint8Array => {\n if (decryptor) {\n return input;\n }\n\n header = new Uint8Array(concatBytes(header, input));\n if (header.length < 16) {\n return new Uint8Array();\n }\n\n const parsed = format.parse(header.slice(0, 16));\n const hasSalt = parsed.salt !== undefined;\n const salt = parsed.salt ?? new Uint8Array();\n const ciphertext = hasSalt ? concatBytes(parsed.ciphertext, header.slice(16)) : header;\n const { key, iv } = deriveKeyIv(registry, options, salt);\n decryptor = registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();\n header = new Uint8Array();\n return ciphertext;\n };\n\n return {\n process(input) {\n const ciphertext = initDecryptor(input);\n return decryptor ? decryptor.process(ciphertext) : new Uint8Array();\n },\n\n finalize(input = new Uint8Array()) {\n const ciphertext = initDecryptor(input);\n if (!decryptor) {\n const { key, iv } = deriveKeyIv(registry, options, new Uint8Array());\n decryptor = registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();\n const buffered = header;\n header = new Uint8Array();\n return decryptor.finalize(buffered);\n }\n return decryptor.finalize(ciphertext);\n },\n };\n}\n\nfunction createBufferedFormatEncryptor(\n format: FormatComponent,\n salt: Uint8Array,\n encryptor: Transform,\n): Transform {\n const chunks: Uint8Array[] = [];\n\n return {\n process(input) {\n const output = encryptor.process(input);\n if (output.length !== 0) {\n chunks.push(output);\n }\n return new Uint8Array();\n },\n\n finalize(input = new Uint8Array()) {\n const output = encryptor.finalize(input);\n if (output.length !== 0) {\n chunks.push(output);\n }\n return format.stringify({ ciphertext: concatBytes(...chunks), salt });\n },\n };\n}\n\nfunction createBufferedFormatDecryptor(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n format: FormatComponent,\n): Transform {\n const chunks: Uint8Array[] = [];\n\n return {\n process(input) {\n if (input.length !== 0) {\n chunks.push(input);\n }\n return new Uint8Array();\n },\n\n finalize(input = new Uint8Array()) {\n if (input.length !== 0) {\n chunks.push(input);\n }\n const parsed = format.parse(concatBytes(...chunks));\n const { key, iv } = deriveKeyIv(registry, options, parsed.salt ?? new Uint8Array());\n return registry.createCipher(toTransformOptions(options, key, iv)).decrypt(parsed.ciphertext);\n },\n };\n}\n\nfunction deriveKeyIv(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n salt: Uint8Array,\n): { key: Uint8Array; iv?: Uint8Array } {\n const keySize = resolveKeySize(registry, options);\n const ivSize = resolveIvSize(registry, options);\n const derived = deriveSync(registry, options, salt, keySize + ivSize);\n return {\n key: derived.slice(0, keySize),\n iv: ivSize === 0 ? undefined : derived.slice(keySize, keySize + ivSize),\n };\n}\n\nfunction deriveSync(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n salt: Uint8Array,\n length: number,\n): Uint8Array {\n const kdfOptions = normalizeNamedOptions(options.kdf);\n const kdf = registry.get<'kdf', KdfComponent>('kdf', kdfOptions.name);\n const result = kdf.derive({\n ...withoutName(kdfOptions),\n passphrase: options.passphrase,\n salt,\n length,\n });\n if (result instanceof Promise) {\n throw new Error(`KDF ${kdfOptions.name} is asynchronous; use an async passphrase cipher API.`);\n }\n return result;\n}\n\nfunction toTransformOptions(\n options: CreatePassphraseCipherOptions,\n key: Uint8Array,\n iv: Uint8Array | undefined,\n): CreateTransformOptions {\n const {\n passphrase,\n kdf,\n format,\n salt,\n saltSize,\n keySize,\n ivSize,\n ...transformOptions\n } = options;\n\n return {\n ...transformOptions,\n key,\n ...(iv ? { iv } : {}),\n };\n}\n\nfunction resolveKeySize(registry: Registry, options: CreatePassphraseCipherOptions): number {\n if (options.keySize !== undefined) {\n assertPositiveInteger(options.keySize, 'keySize');\n return options.keySize;\n }\n\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n if (!cipher.keySizes || cipher.keySizes.length === 0) {\n throw new Error(`${options.cipher} passphrase cipher requires keySize.`);\n }\n return Math.max(...cipher.keySizes);\n}\n\nfunction resolveIvSize(registry: Registry, options: CreatePassphraseCipherOptions): number {\n if (options.ivSize !== undefined) {\n assertNonNegativeInteger(options.ivSize, 'ivSize');\n return options.ivSize;\n }\n\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n return cipher.type === 'block' ? cipher.blockSize : 0;\n}\n\nfunction resolveFormat(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): FormatComponent | undefined {\n if (!options.format) {\n return undefined;\n }\n return registry.get<'format', FormatComponent>('format', normalizeNamedOptions(options.format).name);\n}\n\nfunction isStreamingOpenSslFormat(format: FormatComponent): boolean {\n return format.name === 'OpenSSL';\n}\n\nfunction normalizeNamedOptions(options: string | { name: string }): { name: string; [option: string]: unknown } {\n return typeof options === 'string' ? { name: options } : options;\n}\n\nfunction withoutName(options: { name: string; [option: string]: unknown }): Record<string, unknown> {\n const { name, ...rest } = options;\n return rest;\n}\n\nfunction randomBytes(length: number): Uint8Array {\n assertNonNegativeInteger(length, 'saltSize');\n const bytes = new Uint8Array(length);\n if (bytes.length === 0) {\n return bytes;\n }\n\n const crypto = globalThis as typeof globalThis & {\n crypto?: {\n getRandomValues<T extends Uint8Array>(array: T): T;\n };\n };\n crypto.crypto?.getRandomValues(bytes);\n if (bytes.some((byte) => byte !== 0)) {\n return bytes;\n }\n\n for (let i = 0; i < bytes.length; i++) {\n bytes[i] = Math.floor(Math.random() * 256);\n }\n return bytes;\n}\n\nfunction assertPositiveInteger(value: number, label: string): void {\n if (!Number.isInteger(value) || value <= 0) {\n throw new RangeError(`${label} must be a positive integer.`);\n }\n}\n\nfunction assertNonNegativeInteger(value: number, label: string): void {\n if (!Number.isInteger(value) || value < 0) {\n throw new RangeError(`${label} must be a non-negative integer.`);\n }\n}\n", "import type { BlockCipherComponent, CipherComponent, ModeComponent, PaddingComponent, Transform } from './component.js';\nimport type { Registry } from './registry.js';\nimport { concatBytes } from './bytes.js';\n\nexport interface CreateTransformOptions {\n cipher: string;\n mode?: string;\n padding?: string;\n key: Uint8Array;\n iv?: Uint8Array;\n [option: string]: unknown;\n}\n\nexport function createEncryptor(registry: Registry, options: CreateTransformOptions): Transform {\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n if (cipher.type === 'stream') {\n return createStreamEncryptor(cipher.createEncryptor({\n key: options.key,\n options,\n }));\n }\n\n const { mode, padding } = resolveBlockOptions(registry, options);\n const blockCipher = cipher.create(options.key);\n\n const modeEncryptor = mode.createEncryptor({\n cipher: blockCipher,\n iv: options.iv,\n });\n\n if (mode.requiresPadding === false) {\n return createStreamEncryptor(modeEncryptor);\n }\n\n let finalized = false;\n let pending: Uint8Array = new Uint8Array();\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n const data = concatBytes(pending, input);\n const processLength = data.length - (data.length % blockCipher.blockSize);\n pending = data.slice(processLength);\n return processLength === 0 ? new Uint8Array() : modeEncryptor.process(data.subarray(0, processLength));\n },\n\n finalize(input = new Uint8Array()) {\n assertNotFinalized(finalized);\n const processed = input.length === 0 ? new Uint8Array() : this.process(input);\n finalized = true;\n const finalBlock = padding.pad(pending, blockCipher.blockSize);\n pending = new Uint8Array();\n return concatBytes(processed, modeEncryptor.finalize(finalBlock));\n },\n };\n}\n\nexport function createDecryptor(registry: Registry, options: CreateTransformOptions): Transform {\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n if (cipher.type === 'stream') {\n return createStreamDecryptor(cipher.createDecryptor({\n key: options.key,\n options,\n }));\n }\n\n const { mode, padding } = resolveBlockOptions(registry, options);\n const blockCipher = cipher.create(options.key);\n\n const modeDecryptor = mode.createDecryptor({\n cipher: blockCipher,\n iv: options.iv,\n });\n\n if (mode.requiresPadding === false) {\n return createStreamDecryptor(modeDecryptor);\n }\n\n let finalized = false;\n let pending: Uint8Array = new Uint8Array();\n let plaintextPending: Uint8Array = new Uint8Array();\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n const data = concatBytes(pending, input);\n const processLength = data.length - (data.length % blockCipher.blockSize);\n pending = data.slice(processLength);\n\n if (processLength === 0) {\n return new Uint8Array();\n }\n\n const decrypted = modeDecryptor.process(data.subarray(0, processLength));\n const output = plaintextPending;\n plaintextPending = decrypted;\n return output;\n },\n\n finalize(input = new Uint8Array()) {\n assertNotFinalized(finalized);\n const processed = input.length === 0 ? new Uint8Array() : this.process(input);\n finalized = true;\n if (pending.length !== 0) {\n padding.unpad(pending, blockCipher.blockSize);\n }\n const finalPlaintext = padding.unpad(plaintextPending, blockCipher.blockSize);\n pending = new Uint8Array();\n plaintextPending = new Uint8Array();\n return concatBytes(processed, finalPlaintext, modeDecryptor.finalize());\n },\n };\n}\n\nfunction createStreamEncryptor(modeEncryptor: Transform): Transform {\n let finalized = false;\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n return modeEncryptor.process(input);\n },\n\n finalize(input = new Uint8Array()) {\n assertNotFinalized(finalized);\n finalized = true;\n return concatBytes(\n input.length === 0 ? new Uint8Array() : modeEncryptor.process(input),\n modeEncryptor.finalize(),\n );\n },\n };\n}\n\nfunction createStreamDecryptor(modeDecryptor: Transform): Transform {\n let finalized = false;\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n return modeDecryptor.process(input);\n },\n\n finalize(input = new Uint8Array()) {\n assertNotFinalized(finalized);\n finalized = true;\n return concatBytes(\n input.length === 0 ? new Uint8Array() : modeDecryptor.process(input),\n modeDecryptor.finalize(),\n );\n },\n };\n}\n\nfunction resolveBlockOptions(registry: Registry, options: CreateTransformOptions): {\n cipher: BlockCipherComponent;\n mode: ModeComponent;\n padding: PaddingComponent;\n} {\n if (!options.mode) {\n throw new Error(`${options.cipher} block cipher requires a mode.`);\n }\n if (!options.padding) {\n throw new Error(`${options.cipher} block cipher requires padding.`);\n }\n\n return {\n cipher: registry.get<'cipher', BlockCipherComponent>('cipher', options.cipher),\n mode: registry.get('mode', options.mode),\n padding: registry.get('padding', options.padding),\n };\n}\n\nfunction assertNotFinalized(finalized: boolean): void {\n if (finalized) {\n throw new Error('Transform is already finalized.');\n }\n}\n", "import type { AnyComponent, Component, ComponentKind, PresetComponent } from './component.js';\nimport { DuplicateComponentError, MissingComponentError } from './errors.js';\nimport type { CreatePassphraseCipherOptions, PassphraseCipherFacade } from './passphrase.js';\nimport { createPassphraseCipher } from './passphrase.js';\nimport type { CreateTransformOptions } from './transform.js';\nimport { createDecryptor, createEncryptor } from './transform.js';\nimport type { Transform } from './component.js';\n\nexport interface Registry {\n use(component: AnyComponent): Registry;\n has(kind: ComponentKind, name: string): boolean;\n get<Kind extends ComponentKind, T extends Component<Kind>>(kind: Kind, name: string): T;\n list(kind?: ComponentKind): AnyComponent[];\n createCipher(options: CreateTransformOptions): CipherFacade;\n createPassphraseCipher(options: CreatePassphraseCipherOptions): PassphraseCipherFacade;\n encrypt(options: CreateTransformOptions & { plaintext: Uint8Array }): Uint8Array;\n decrypt(options: CreateTransformOptions & { ciphertext: Uint8Array }): Uint8Array;\n createEncryptor(options: CreateTransformOptions): Transform;\n createDecryptor(options: CreateTransformOptions): Transform;\n}\n\nexport interface CipherFacade {\n encrypt(plaintext: Uint8Array): Uint8Array;\n decrypt(ciphertext: Uint8Array): Uint8Array;\n createEncryptor(): Transform;\n createDecryptor(): Transform;\n}\n\nexport function createRegistry(components: Iterable<AnyComponent> = []): Registry {\n const entries = new Map<string, AnyComponent>();\n\n const key = (kind: ComponentKind, name: string) => `${kind}:${name}`;\n\n const registry: Registry = {\n use(component) {\n if (component.kind === 'preset') {\n for (const item of (component as PresetComponent).components()) {\n registry.use(item);\n }\n return registry;\n }\n\n const entryKey = key(component.kind, component.name);\n if (entries.has(entryKey)) {\n throw new DuplicateComponentError(component.kind, component.name);\n }\n entries.set(entryKey, component);\n return registry;\n },\n\n has(kind, name) {\n return entries.has(key(kind, name));\n },\n\n get(kind, name) {\n const component = entries.get(key(kind, name));\n if (!component) {\n throw new MissingComponentError(kind, name);\n }\n return component as never;\n },\n\n list(kind) {\n const components = [...entries.values()];\n return kind ? components.filter((component) => component.kind === kind) : components;\n },\n\n createCipher(options) {\n return {\n encrypt(plaintext) {\n return createEncryptor(registry, options).finalize(plaintext);\n },\n\n decrypt(ciphertext) {\n return createDecryptor(registry, options).finalize(ciphertext);\n },\n\n createEncryptor() {\n return createEncryptor(registry, options);\n },\n\n createDecryptor() {\n return createDecryptor(registry, options);\n },\n };\n },\n\n createPassphraseCipher(options) {\n return createPassphraseCipher(registry, options);\n },\n\n encrypt(options) {\n return createEncryptor(registry, options).finalize(options.plaintext);\n },\n\n decrypt(options) {\n return createDecryptor(registry, options).finalize(options.ciphertext);\n },\n\n createEncryptor(options) {\n return createEncryptor(registry, options);\n },\n\n createDecryptor(options) {\n return createDecryptor(registry, options);\n },\n };\n\n for (const component of components) {\n registry.use(component);\n }\n\n return registry;\n}\n", "export interface BlockSizeOptions {\n readonly max?: number;\n}\n\nexport function assertBlockSize(blockSize: number, options: BlockSizeOptions = {}): void {\n const { max } = options;\n if (!Number.isInteger(blockSize) || blockSize <= 0) {\n throw new RangeError('blockSize must be a positive integer.');\n }\n if (max !== undefined && blockSize > max) {\n throw new RangeError(`blockSize must be an integer between 1 and ${max}.`);\n }\n}\n\nexport function assertBlockMultiple(input: Uint8Array, blockSize: number, label: string): void {\n assertBlockSize(blockSize);\n if (input.length % blockSize !== 0) {\n throw new Error(`${label} input length must be a multiple of the block size.`);\n }\n}\n\nexport function assertPaddedInput(input: Uint8Array, blockSize: number, label: string, options: BlockSizeOptions = {}): void {\n assertBlockSize(blockSize, options);\n if (input.length === 0 || input.length % blockSize !== 0) {\n throw new Error(`Invalid ${label} padded data.`);\n }\n}\n\nexport function assertIv(blockSize: number, iv: Uint8Array | undefined, modeName: string): asserts iv is Uint8Array {\n if (!iv) {\n throw new Error(`${modeName} mode requires an IV.`);\n }\n if (iv.length !== blockSize) {\n throw new Error(`${modeName} IV length must match the cipher block size.`);\n }\n}\n\nexport function getBlockPaddingLength(inputLength: number, blockSize: number): number {\n const remainder = inputLength % blockSize;\n return remainder === 0 ? blockSize : blockSize - remainder;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAAO,IAAM,cAAN,cAA0B,MAAM;AAAA,EACrC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO,WAAW;AAAA,EACzB;AACF;AAEO,IAAM,0BAAN,cAAsC,YAAY;AAAA,EACvD,YAAY,MAAc,MAAc;AACtC,UAAM,iCAAiC,IAAI,IAAI,IAAI,EAAE;AAAA,EACvD;AACF;AAEO,IAAM,wBAAN,cAAoC,YAAY;AAAA,EACrD,YAAY,MAAc,MAAc;AACtC,UAAM,wBAAwB,IAAI,IAAI,IAAI,EAAE;AAAA,EAC9C;AACF;;;ACjBO,SAAS,eAAe,QAA2C;AACxE,QAAM,SAAS,OAAO,OAAO,CAAC,KAAK,UAAU,MAAM,MAAM,QAAQ,CAAC;AAClE,QAAM,SAAS,IAAI,WAAW,MAAM;AACpC,MAAI,SAAS;AAEb,aAAW,SAAS,QAAQ;AAC1B,WAAO,IAAI,OAAO,MAAM;AACxB,cAAU,MAAM;AAAA,EAClB;AAEA,SAAO;AACT;AAEO,SAAS,WAAW,GAAe,GAAwB;AAChE,MAAI,EAAE,WAAW,EAAE,QAAQ;AACzB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,YAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;AAAA,EACpB;AACA,SAAO,SAAS;AAClB;AAEO,SAAS,SAAS,GAAe,GAA2B;AACjE,MAAI,EAAE,WAAW,EAAE,QAAQ;AACzB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AAEA,QAAM,SAAS,IAAI,WA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C,UAAM,IAAI,WAAW,8CAA8C,GAAG,GAAG;AAAA,EAC3E;AACF;AAEO,SAAS,oBAAoB,OAAmB,WAAmB,OAAqB;AAC7F,kBAAgB,SAAS;AACzB,MAAI,MAAM,SAAS,cAAc,GAAG;AAClC,UAAM,IAAI,MAAM,GAAG,KAAK,qDAAqD;AAAA,EAC/E;AACF;AAEO,SAAS,kBAAkB,OAAmB,WAAmB,OAAe,UAA4B,CAAC,GAAS;AAC3H,kBAAgB,WAAW,OAAO;AAClC,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,cAAc,GAAG;AACxD,UAAM,IAAI,MAAM,WAAW,KAAK,eAAe;AAAA,EACjD;AACF;AAEO,SAAS,SAAS,WAAmB,IAA4B,UAA4C;AAClH,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,GAAG,QAAQ,uBAAuB;AAAA,EACpD;AACA,MAAI,GAAG,WAAW,WAAW;AAC3B,UAAM,IAAI,MAAM,GAAG,QAAQ,8CAA8C;AAAA,EAC3E;AACF;AAEO,SAAS,sBAAsB,aAAqB,WAA2B;AACpF,QAAM,YAAY,cAAc;AAChC,SAAO,cAAc,IAAI,YAAY,YAAY;AACnD;",
|
|
4
|
+
"sourcesContent": ["export class CryptoError extends Error {\n constructor(message: string) {\n super(message);\n this.name = new.target.name;\n }\n}\n\nexport class DuplicateComponentError extends CryptoError {\n constructor(kind: string, name: string) {\n super(`Component already registered: ${kind}:${name}`);\n }\n}\n\nexport class MissingComponentError extends CryptoError {\n constructor(kind: string, name: string) {\n super(`Component not found: ${kind}:${name}`);\n }\n}\n\n", "export function concatBytes(...chunks: readonly Uint8Array[]): Uint8Array {\n const length = chunks.reduce((sum, chunk) => sum + chunk.length, 0);\n const output = new Uint8Array(length);\n let offset = 0;\n\n for (const chunk of chunks) {\n output.set(chunk, offset);\n offset += chunk.length;\n }\n\n return output;\n}\n\nexport function equalBytes(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n let diff = 0;\n for (let i = 0; i < a.length; i++) {\n diff |= a[i] ^ b[i];\n }\n return diff === 0;\n}\n\nexport function xorBytes(a: Uint8Array, b: Uint8Array): Uint8Array {\n if (a.length !== b.length) {\n throw new Error('XOR inputs must have the same length.');\n }\n\n const output = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n output[i] = a[i] ^ b[i];\n }\n return output;\n}\n\nexport function assertBytes(value: unknown, name: string): asserts value is Uint8Array {\n if (!(value instanceof Uint8Array)) {\n throw new TypeError(`${name} must be a Uint8Array.`);\n }\n}\n", "import type { CipherComponent, FormatComponent, KdfComponent, Transform } from './component.js';\nimport type { Registry } from './registry.js';\nimport type { CreateTransformOptions } from './transform.js';\nimport { concatBytes } from './bytes.js';\n\nexport interface CreatePassphraseCipherOptions {\n cipher: string;\n mode?: string;\n padding?: string;\n passphrase: Uint8Array | string;\n kdf: string | KdfOptions;\n format?: string | FormatOptions;\n salt?: Uint8Array;\n saltSize?: number;\n keySize?: number;\n ivSize?: number;\n [option: string]: unknown;\n}\n\nexport interface KdfOptions {\n name: string;\n [option: string]: unknown;\n}\n\nexport interface FormatOptions {\n name: string;\n [option: string]: unknown;\n}\n\nexport interface PassphraseCipherFacade {\n encrypt(plaintext: Uint8Array): Uint8Array;\n decrypt(input: Uint8Array): Uint8Array;\n createEncryptor(): Transform;\n createDecryptor(): Transform;\n}\n\nexport function createPassphraseCipher(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): PassphraseCipherFacade {\n return {\n encrypt(plaintext) {\n return concatBytes(this.createEncryptor().finalize(plaintext));\n },\n\n decrypt(input) {\n return concatBytes(this.createDecryptor().finalize(input));\n },\n\n createEncryptor() {\n return createPassphraseEncryptor(registry, options);\n },\n\n createDecryptor() {\n return createPassphraseDecryptor(registry, options);\n },\n };\n}\n\nfunction createPassphraseEncryptor(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): Transform {\n const format = resolveFormat(registry, options);\n const salt = options.salt ? options.salt.slice() : randomBytes(options.saltSize ?? 8);\n const { key, iv } = deriveKeyIv(registry, options, salt);\n const encryptor = registry.createCipher(toTransformOptions(options, key, iv)).createEncryptor();\n\n if (!format) {\n return encryptor;\n }\n\n if (!isStreamingOpenSslFormat(format)) {\n return createBufferedFormatEncryptor(format, salt, encryptor);\n }\n\n let emittedHeader = false;\n const emitHeader = (): Uint8Array => {\n if (emittedHeader) {\n return new Uint8Array(0);\n }\n emittedHeader = true;\n return format.stringify({ ciphertext: new Uint8Array(0), salt });\n };\n\n return {\n process(input) {\n return concatBytes(emitHeader(), encryptor.process(input));\n },\n\n finalize(input = new Uint8Array(0)) {\n return concatBytes(emitHeader(), encryptor.finalize(input));\n },\n };\n}\n\nfunction createPassphraseDecryptor(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): Transform {\n const format = resolveFormat(registry, options);\n\n if (!format) {\n const { key, iv } = deriveKeyIv(registry, options, new Uint8Array(0));\n return registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();\n }\n\n if (!isStreamingOpenSslFormat(format)) {\n return createBufferedFormatDecryptor(registry, options, format);\n }\n\n let header = new Uint8Array(0);\n let decryptor: Transform | undefined;\n\n const initDecryptor = (input: Uint8Array): Uint8Array => {\n if (decryptor) {\n return input;\n }\n\n header = new Uint8Array(concatBytes(header, input));\n if (header.length < 16) {\n return new Uint8Array(0);\n }\n\n const parsed = format.parse(header.slice(0, 16));\n const hasSalt = parsed.salt !== undefined;\n const salt = parsed.salt ?? new Uint8Array(0);\n const ciphertext = hasSalt ? concatBytes(parsed.ciphertext, header.slice(16)) : header;\n const { key, iv } = deriveKeyIv(registry, options, salt);\n decryptor = registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();\n header = new Uint8Array(0);\n return ciphertext;\n };\n\n return {\n process(input) {\n const ciphertext = initDecryptor(input);\n return decryptor ? decryptor.process(ciphertext) : new Uint8Array(0);\n },\n\n finalize(input = new Uint8Array(0)) {\n const ciphertext = initDecryptor(input);\n if (!decryptor) {\n const { key, iv } = deriveKeyIv(registry, options, new Uint8Array(0));\n decryptor = registry.createCipher(toTransformOptions(options, key, iv)).createDecryptor();\n const buffered = header;\n header = new Uint8Array(0);\n return decryptor.finalize(buffered);\n }\n return decryptor.finalize(ciphertext);\n },\n };\n}\n\nfunction createBufferedFormatEncryptor(\n format: FormatComponent,\n salt: Uint8Array,\n encryptor: Transform,\n): Transform {\n const chunks: Uint8Array[] = [];\n\n return {\n process(input) {\n const output = encryptor.process(input);\n if (output.length !== 0) {\n chunks.push(output);\n }\n return new Uint8Array(0);\n },\n\n finalize(input = new Uint8Array(0)) {\n const output = encryptor.finalize(input);\n if (output.length !== 0) {\n chunks.push(output);\n }\n return format.stringify({ ciphertext: concatBytes(...chunks), salt });\n },\n };\n}\n\nfunction createBufferedFormatDecryptor(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n format: FormatComponent,\n): Transform {\n const chunks: Uint8Array[] = [];\n\n return {\n process(input) {\n if (input.length !== 0) {\n chunks.push(input);\n }\n return new Uint8Array(0);\n },\n\n finalize(input = new Uint8Array(0)) {\n if (input.length !== 0) {\n chunks.push(input);\n }\n const parsed = format.parse(concatBytes(...chunks));\n const { key, iv } = deriveKeyIv(registry, options, parsed.salt ?? new Uint8Array(0));\n return registry.createCipher(toTransformOptions(options, key, iv)).decrypt(parsed.ciphertext);\n },\n };\n}\n\nfunction deriveKeyIv(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n salt: Uint8Array,\n): { key: Uint8Array; iv?: Uint8Array } {\n const keySize = resolveKeySize(registry, options);\n const ivSize = resolveIvSize(registry, options);\n const derived = deriveSync(registry, options, salt, keySize + ivSize);\n return {\n key: derived.slice(0, keySize),\n iv: ivSize === 0 ? undefined : derived.slice(keySize, keySize + ivSize),\n };\n}\n\nfunction deriveSync(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n salt: Uint8Array,\n length: number,\n): Uint8Array {\n const kdfOptions = normalizeNamedOptions(options.kdf);\n const kdf = registry.get<'kdf', KdfComponent>('kdf', kdfOptions.name);\n const result = kdf.derive({\n ...withoutName(kdfOptions),\n passphrase: options.passphrase,\n salt,\n length,\n });\n if (result instanceof Promise) {\n throw new Error(`KDF ${kdfOptions.name} is asynchronous; use an async passphrase cipher API.`);\n }\n return result;\n}\n\nfunction toTransformOptions(\n options: CreatePassphraseCipherOptions,\n key: Uint8Array,\n iv: Uint8Array | undefined,\n): CreateTransformOptions {\n const {\n passphrase,\n kdf,\n format,\n salt,\n saltSize,\n keySize,\n ivSize,\n ...transformOptions\n } = options;\n\n return {\n ...transformOptions,\n key,\n ...(iv ? { iv } : {}),\n };\n}\n\nfunction resolveKeySize(registry: Registry, options: CreatePassphraseCipherOptions): number {\n if (options.keySize !== undefined) {\n assertPositiveInteger(options.keySize, 'keySize');\n return options.keySize;\n }\n\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n if (!cipher.keySizes || cipher.keySizes.length === 0) {\n throw new Error(`${options.cipher} passphrase cipher requires keySize.`);\n }\n return Math.max(...cipher.keySizes);\n}\n\nfunction resolveIvSize(registry: Registry, options: CreatePassphraseCipherOptions): number {\n if (options.ivSize !== undefined) {\n assertNonNegativeInteger(options.ivSize, 'ivSize');\n return options.ivSize;\n }\n\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n return cipher.type === 'block' ? cipher.blockSize : 0;\n}\n\nfunction resolveFormat(\n registry: Registry,\n options: CreatePassphraseCipherOptions,\n): FormatComponent | undefined {\n if (!options.format) {\n return undefined;\n }\n return registry.get<'format', FormatComponent>('format', normalizeNamedOptions(options.format).name);\n}\n\nfunction isStreamingOpenSslFormat(format: FormatComponent): boolean {\n return format.name === 'OpenSSL';\n}\n\nfunction normalizeNamedOptions(options: string | { name: string }): { name: string; [option: string]: unknown } {\n return typeof options === 'string' ? { name: options } : options;\n}\n\nfunction withoutName(options: { name: string; [option: string]: unknown }): Record<string, unknown> {\n const { name, ...rest } = options;\n return rest;\n}\n\nfunction randomBytes(length: number): Uint8Array {\n assertNonNegativeInteger(length, 'saltSize');\n const bytes = new Uint8Array(length);\n if (bytes.length === 0) {\n return bytes;\n }\n\n const crypto = globalThis as typeof globalThis & {\n crypto?: {\n getRandomValues<T extends Uint8Array>(array: T): T;\n };\n };\n crypto.crypto?.getRandomValues(bytes);\n if (bytes.some((byte) => byte !== 0)) {\n return bytes;\n }\n\n for (let i = 0; i < bytes.length; i++) {\n bytes[i] = Math.floor(Math.random() * 256);\n }\n return bytes;\n}\n\nfunction assertPositiveInteger(value: number, label: string): void {\n if (!Number.isInteger(value) || value <= 0) {\n throw new RangeError(`${label} must be a positive integer.`);\n }\n}\n\nfunction assertNonNegativeInteger(value: number, label: string): void {\n if (!Number.isInteger(value) || value < 0) {\n throw new RangeError(`${label} must be a non-negative integer.`);\n }\n}\n", "import type { BlockCipherComponent, CipherComponent, ModeComponent, PaddingComponent, Transform } from './component.js';\nimport type { Registry } from './registry.js';\nimport { concatBytes } from './bytes.js';\n\nexport interface CreateTransformOptions {\n cipher: string;\n mode?: string;\n padding?: string;\n key: Uint8Array;\n iv?: Uint8Array;\n [option: string]: unknown;\n}\n\nexport function createEncryptor(registry: Registry, options: CreateTransformOptions): Transform {\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n if (cipher.type === 'stream') {\n return createStreamEncryptor(cipher.createEncryptor({\n key: options.key,\n options,\n }));\n }\n\n const { mode, padding } = resolveBlockOptions(registry, options);\n const blockCipher = cipher.create(options.key);\n\n const modeEncryptor = mode.createEncryptor({\n cipher: blockCipher,\n iv: options.iv,\n options,\n });\n\n if (mode.requiresPadding === false) {\n return createStreamEncryptor(modeEncryptor);\n }\n const blockPadding = padding as PaddingComponent;\n\n let finalized = false;\n let pending: Uint8Array = new Uint8Array(0);\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n const data = concatBytes(pending, input);\n const processLength = data.length - (data.length % blockCipher.blockSize);\n pending = data.slice(processLength);\n return processLength === 0 ? new Uint8Array(0) : modeEncryptor.process(data.subarray(0, processLength));\n },\n\n finalize(input = new Uint8Array(0)) {\n assertNotFinalized(finalized);\n const processed = input.length === 0 ? new Uint8Array(0) : this.process(input);\n finalized = true;\n const finalBlock = blockPadding.pad(pending, blockCipher.blockSize);\n pending = new Uint8Array(0);\n return concatBytes(processed, modeEncryptor.finalize(finalBlock));\n },\n };\n}\n\nexport function createDecryptor(registry: Registry, options: CreateTransformOptions): Transform {\n const cipher = registry.get<'cipher', CipherComponent>('cipher', options.cipher);\n if (cipher.type === 'stream') {\n return createStreamDecryptor(cipher.createDecryptor({\n key: options.key,\n options,\n }));\n }\n\n const { mode, padding } = resolveBlockOptions(registry, options);\n const blockCipher = cipher.create(options.key);\n\n const modeDecryptor = mode.createDecryptor({\n cipher: blockCipher,\n iv: options.iv,\n options,\n });\n\n if (mode.requiresPadding === false) {\n return createStreamDecryptor(modeDecryptor);\n }\n const blockPadding = padding as PaddingComponent;\n\n let finalized = false;\n let pending: Uint8Array = new Uint8Array(0);\n let plaintextPending: Uint8Array = new Uint8Array(0);\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n const data = concatBytes(pending, input);\n const processLength = data.length - (data.length % blockCipher.blockSize);\n pending = data.slice(processLength);\n\n if (processLength === 0) {\n return new Uint8Array(0);\n }\n\n const decrypted = modeDecryptor.process(data.subarray(0, processLength));\n const output = plaintextPending;\n plaintextPending = decrypted;\n return output;\n },\n\n finalize(input = new Uint8Array(0)) {\n assertNotFinalized(finalized);\n const processed = input.length === 0 ? new Uint8Array(0) : this.process(input);\n finalized = true;\n if (pending.length !== 0) {\n blockPadding.unpad(pending, blockCipher.blockSize);\n }\n const finalPlaintext = blockPadding.unpad(plaintextPending, blockCipher.blockSize);\n pending = new Uint8Array(0);\n plaintextPending = new Uint8Array(0);\n return concatBytes(processed, finalPlaintext, modeDecryptor.finalize());\n },\n };\n}\n\nfunction createStreamEncryptor(modeEncryptor: Transform): Transform {\n let finalized = false;\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n return modeEncryptor.process(input);\n },\n\n finalize(input = new Uint8Array(0)) {\n assertNotFinalized(finalized);\n finalized = true;\n return concatBytes(\n input.length === 0 ? new Uint8Array(0) : modeEncryptor.process(input),\n modeEncryptor.finalize(),\n );\n },\n };\n}\n\nfunction createStreamDecryptor(modeDecryptor: Transform): Transform {\n let finalized = false;\n\n return {\n process(input) {\n assertNotFinalized(finalized);\n return modeDecryptor.process(input);\n },\n\n finalize(input = new Uint8Array(0)) {\n assertNotFinalized(finalized);\n finalized = true;\n return concatBytes(\n input.length === 0 ? new Uint8Array(0) : modeDecryptor.process(input),\n modeDecryptor.finalize(),\n );\n },\n };\n}\n\nfunction resolveBlockOptions(registry: Registry, options: CreateTransformOptions): {\n cipher: BlockCipherComponent;\n mode: ModeComponent;\n padding?: PaddingComponent;\n} {\n if (!options.mode) {\n throw new Error(`${options.cipher} block cipher requires a mode.`);\n }\n\n const mode = registry.get<'mode', ModeComponent>('mode', options.mode);\n let padding: PaddingComponent | undefined;\n if (mode.requiresPadding !== false) {\n if (!options.padding) {\n throw new Error(`${options.cipher} block cipher requires padding.`);\n }\n padding = registry.get<'padding', PaddingComponent>('padding', options.padding);\n }\n\n return {\n cipher: registry.get<'cipher', BlockCipherComponent>('cipher', options.cipher),\n mode,\n padding,\n };\n}\n\nfunction assertNotFinalized(finalized: boolean): void {\n if (finalized) {\n throw new Error('Transform is already finalized.');\n }\n}\n", "import type { AnyComponent, Component, ComponentKind, PresetComponent } from './component.js';\nimport { DuplicateComponentError, MissingComponentError } from './errors.js';\nimport type { CreatePassphraseCipherOptions, PassphraseCipherFacade } from './passphrase.js';\nimport { createPassphraseCipher } from './passphrase.js';\nimport type { CreateTransformOptions } from './transform.js';\nimport { createDecryptor, createEncryptor } from './transform.js';\nimport type { Transform } from './component.js';\n\nexport interface Registry {\n use(component: AnyComponent): Registry;\n has(kind: ComponentKind, name: string): boolean;\n get<Kind extends ComponentKind, T extends Component<Kind>>(kind: Kind, name: string): T;\n list(kind?: ComponentKind): AnyComponent[];\n createCipher(options: CreateTransformOptions): CipherFacade;\n createPassphraseCipher(options: CreatePassphraseCipherOptions): PassphraseCipherFacade;\n encrypt(options: CreateTransformOptions & { plaintext: Uint8Array }): Uint8Array;\n decrypt(options: CreateTransformOptions & { ciphertext: Uint8Array }): Uint8Array;\n createEncryptor(options: CreateTransformOptions): Transform;\n createDecryptor(options: CreateTransformOptions): Transform;\n}\n\nexport interface CipherFacade {\n encrypt(plaintext: Uint8Array): Uint8Array;\n decrypt(ciphertext: Uint8Array): Uint8Array;\n createEncryptor(): Transform;\n createDecryptor(): Transform;\n}\n\nexport function createRegistry(components: Iterable<AnyComponent> = []): Registry {\n const entries = new Map<string, AnyComponent>();\n\n const key = (kind: ComponentKind, name: string) => `${kind}:${name}`;\n\n const registry: Registry = {\n use(component) {\n if (component.kind === 'preset') {\n for (const item of (component as PresetComponent).components()) {\n registry.use(item);\n }\n return registry;\n }\n\n const entryKey = key(component.kind, component.name);\n if (entries.has(entryKey)) {\n throw new DuplicateComponentError(component.kind, component.name);\n }\n entries.set(entryKey, component);\n return registry;\n },\n\n has(kind, name) {\n return entries.has(key(kind, name));\n },\n\n get(kind, name) {\n const component = entries.get(key(kind, name));\n if (!component) {\n throw new MissingComponentError(kind, name);\n }\n return component as never;\n },\n\n list(kind) {\n const components = [...entries.values()];\n return kind ? components.filter((component) => component.kind === kind) : components;\n },\n\n createCipher(options) {\n return {\n encrypt(plaintext) {\n return createEncryptor(registry, options).finalize(plaintext);\n },\n\n decrypt(ciphertext) {\n return createDecryptor(registry, options).finalize(ciphertext);\n },\n\n createEncryptor() {\n return createEncryptor(registry, options);\n },\n\n createDecryptor() {\n return createDecryptor(registry, options);\n },\n };\n },\n\n createPassphraseCipher(options) {\n return createPassphraseCipher(registry, options);\n },\n\n encrypt(options) {\n return createEncryptor(registry, options).finalize(options.plaintext);\n },\n\n decrypt(options) {\n return createDecryptor(registry, options).finalize(options.ciphertext);\n },\n\n createEncryptor(options) {\n return createEncryptor(registry, options);\n },\n\n createDecryptor(options) {\n return createDecryptor(registry, options);\n },\n };\n\n for (const component of components) {\n registry.use(component);\n }\n\n return registry;\n}\n", "export interface BlockSizeOptions {\n readonly max?: number;\n}\n\nexport function assertBlockSize(blockSize: number, options: BlockSizeOptions = {}): void {\n const { max } = options;\n if (!Number.isInteger(blockSize) || blockSize <= 0) {\n throw new RangeError('blockSize must be a positive integer.');\n }\n if (max !== undefined && blockSize > max) {\n throw new RangeError(`blockSize must be an integer between 1 and ${max}.`);\n }\n}\n\nexport function assertBlockMultiple(input: Uint8Array, blockSize: number, label: string): void {\n assertBlockSize(blockSize);\n if (input.length % blockSize !== 0) {\n throw new Error(`${label} input length must be a multiple of the block size.`);\n }\n}\n\nexport function assertPaddedInput(input: Uint8Array, blockSize: number, label: string, options: BlockSizeOptions = {}): void {\n assertBlockSize(blockSize, options);\n if (input.length === 0 || input.length % blockSize !== 0) {\n throw new Error(`Invalid ${label} padded data.`);\n }\n}\n\nexport function assertIv(blockSize: number, iv: Uint8Array | undefined, modeName: string): asserts iv is Uint8Array {\n if (!iv) {\n throw new Error(`${modeName} mode requires an IV.`);\n }\n if (iv.length !== blockSize) {\n throw new Error(`${modeName} IV length must match the cipher block size.`);\n }\n}\n\nexport function getBlockPaddingLength(inputLength: number, blockSize: number): number {\n const remainder = inputLength % blockSize;\n return remainder === 0 ? blockSize : blockSize - remainder;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,cAAN,cAA0B,MAAM;AAAA,EACrC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO,WAAW;AAAA,EACzB;AACF;AAEO,IAAM,0BAAN,cAAsC,YAAY;AAAA,EACvD,YAAY,MAAc,MAAc;AACtC,UAAM,iCAAiC,IAAI,IAAI,IAAI,EAAE;AAAA,EACvD;AACF;AAEO,IAAM,wBAAN,cAAoC,YAAY;AAAA,EACrD,YAAY,MAAc,MAAc;AACtC,UAAM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