internxt-crypto 0.0.11 → 0.0.14
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/{symmetric-crypto-CrdS1Che.mjs → aes-DCb9dJqb.mjs} +10 -46
- package/dist/aes-DCb9dJqb.mjs.map +1 -0
- package/dist/{symmetric-crypto-D65zB396.js → aes-DQo1MyCz.js} +13 -54
- package/dist/aes-DQo1MyCz.js.map +1 -0
- package/dist/asymmetric-crypto.d.mts +1 -4
- package/dist/asymmetric-crypto.d.mts.map +1 -0
- package/dist/asymmetric-crypto.d.ts +1 -4
- package/dist/asymmetric-crypto.d.ts.map +1 -0
- package/dist/asymmetric-crypto.js +8 -7
- package/dist/asymmetric-crypto.mjs +1 -1
- package/dist/{chunk-DWirmd9C.mjs → chunk-DQk6qfdC.mjs} +3 -3
- package/dist/{chunk-Dt-PWiN7.js → chunk-EbLFQX5m.js} +3 -3
- package/dist/constants.d.mts +5 -5
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.d.ts +5 -5
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +63 -30
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +33 -2
- package/dist/constants.mjs.map +1 -0
- package/dist/derive-key.d.mts +1 -4
- package/dist/derive-key.d.mts.map +1 -0
- package/dist/derive-key.d.ts +1 -4
- package/dist/derive-key.d.ts.map +1 -0
- package/dist/derive-key.js +12 -14
- package/dist/derive-key.mjs +1 -4
- package/dist/{derive-key-CBf2WxJd.js → deriveKeysFromPassword-BYaiSGKL.js} +26 -52
- package/dist/deriveKeysFromPassword-BYaiSGKL.js.map +1 -0
- package/dist/{derive-key-Be7hS-cN.mjs → deriveKeysFromPassword-XIwzErlL.mjs} +7 -28
- package/dist/deriveKeysFromPassword-XIwzErlL.mjs.map +1 -0
- package/dist/email-crypto.d.mts +2 -5
- package/dist/email-crypto.d.mts.map +1 -0
- package/dist/email-crypto.d.ts +2 -5
- package/dist/email-crypto.d.ts.map +1 -0
- package/dist/email-crypto.js +12 -16
- package/dist/email-crypto.mjs +1 -6
- package/dist/email-search.d.mts +20 -23
- package/dist/email-search.d.mts.map +1 -0
- package/dist/email-search.d.ts +20 -23
- package/dist/email-search.d.ts.map +1 -0
- package/dist/email-search.js +25 -63
- package/dist/email-search.js.map +1 -1
- package/dist/email-search.mjs +17 -51
- package/dist/email-search.mjs.map +1 -1
- package/dist/{keystore-crypto-Bjgriq9h.mjs → emailEncryptionKey-B9xHw1h_.mjs} +12 -21
- package/dist/emailEncryptionKey-B9xHw1h_.mjs.map +1 -0
- package/dist/{keystore-crypto-B4yCVo9l.js → emailEncryptionKey-CQNe5W_T.js} +25 -40
- package/dist/emailEncryptionKey-CQNe5W_T.js.map +1 -0
- package/dist/{email-crypto-BrT98taw.js → emailKeys-C0KhtfNP.js} +67 -112
- package/dist/emailKeys-C0KhtfNP.js.map +1 -0
- package/dist/{email-crypto-DJUEjTxA.mjs → emailKeys-D4lp9NRv.mjs} +29 -75
- package/dist/emailKeys-D4lp9NRv.mjs.map +1 -0
- package/dist/{utils-DS04iUcX.mjs → genID-3Er5IowC.mjs} +4 -24
- package/dist/genID-3Er5IowC.mjs.map +1 -0
- package/dist/{utils-CNs3cyDj.js → genID-YJSl3YhL.js} +6 -31
- package/dist/genID-YJSl3YhL.js.map +1 -0
- package/dist/hash.d.mts +1 -4
- package/dist/hash.d.mts.map +1 -0
- package/dist/hash.d.ts +1 -4
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +11 -10
- package/dist/hash.mjs +1 -1
- package/dist/index.d.mts +19 -39
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +19 -39
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +97 -88
- package/dist/index.mjs +12 -14
- package/dist/{asymmetric-crypto-CyXsV4XT.mjs → keys-BfcaiAOv.mjs} +3 -15
- package/dist/keys-BfcaiAOv.mjs.map +1 -0
- package/dist/{asymmetric-crypto-BORmLhnx.js → keys-CinT7kEY.js} +2 -20
- package/dist/keys-CinT7kEY.js.map +1 -0
- package/dist/keystore-crypto.d.mts +2 -5
- package/dist/keystore-crypto.d.mts.map +1 -0
- package/dist/keystore-crypto.d.ts +2 -5
- package/dist/keystore-crypto.d.ts.map +1 -0
- package/dist/keystore-crypto.js +5 -10
- package/dist/keystore-crypto.mjs +1 -7
- package/dist/kyber768-SXnIo-Nw.mjs +47 -0
- package/dist/kyber768-SXnIo-Nw.mjs.map +1 -0
- package/dist/kyber768-WUVc2fIR.js +65 -0
- package/dist/kyber768-WUVc2fIR.js.map +1 -0
- package/dist/{hash-BoqwNkcd.js → mac-BMb1F0dN.js} +3 -23
- package/dist/mac-BMb1F0dN.js.map +1 -0
- package/dist/{hash-CXeGAwai.mjs → mac-ZpRlx8Fs.mjs} +3 -18
- package/dist/mac-ZpRlx8Fs.mjs.map +1 -0
- package/dist/post-quantum-crypto.d.mts +32 -2
- package/dist/post-quantum-crypto.d.mts.map +1 -0
- package/dist/post-quantum-crypto.d.ts +32 -2
- package/dist/post-quantum-crypto.d.ts.map +1 -0
- package/dist/post-quantum-crypto.js +5 -16
- package/dist/post-quantum-crypto.mjs +2 -2
- package/dist/storage-service.d.mts +47 -2
- package/dist/storage-service.d.mts.map +1 -0
- package/dist/storage-service.d.ts +47 -2
- package/dist/storage-service.d.ts.map +1 -0
- package/dist/storage-service.js +58 -4
- package/dist/storage-service.js.map +1 -0
- package/dist/storage-service.mjs +55 -2
- package/dist/storage-service.mjs.map +1 -0
- package/dist/symmetric-crypto.d.mts +5 -8
- package/dist/symmetric-crypto.d.mts.map +1 -0
- package/dist/symmetric-crypto.d.ts +5 -8
- package/dist/symmetric-crypto.d.ts.map +1 -0
- package/dist/symmetric-crypto.js +9 -9
- package/dist/symmetric-crypto.mjs +1 -2
- package/dist/types.d.mts +108 -2
- package/dist/types.d.mts.map +1 -0
- package/dist/types.d.ts +108 -2
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -2
- package/dist/types.js.map +1 -0
- package/dist/types.mjs +9 -2
- package/dist/types.mjs.map +1 -0
- package/dist/utils.d.mts +2 -5
- package/dist/utils.d.mts.map +1 -0
- package/dist/utils.d.ts +2 -5
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +16 -15
- package/dist/utils.mjs +1 -1
- package/package.json +24 -14
- package/dist/asymmetric-crypto-BORmLhnx.js.map +0 -1
- package/dist/asymmetric-crypto-CyXsV4XT.mjs.map +0 -1
- package/dist/constants-Ccp21E03.js +0 -208
- package/dist/constants-Ccp21E03.js.map +0 -1
- package/dist/constants-kTeX-2T0.mjs +0 -34
- package/dist/constants-kTeX-2T0.mjs.map +0 -1
- package/dist/derive-key-Be7hS-cN.mjs.map +0 -1
- package/dist/derive-key-CBf2WxJd.js.map +0 -1
- package/dist/email-crypto-BrT98taw.js.map +0 -1
- package/dist/email-crypto-DJUEjTxA.mjs.map +0 -1
- package/dist/hash-BoqwNkcd.js.map +0 -1
- package/dist/hash-CXeGAwai.mjs.map +0 -1
- package/dist/index-CQqgKsbX.d.ts +0 -50
- package/dist/index-CintVUbp.d.ts +0 -97
- package/dist/index-D5pBU_A5.d.mts +0 -50
- package/dist/index-MaOov-ag.d.mts +0 -97
- package/dist/keystore-crypto-B4yCVo9l.js.map +0 -1
- package/dist/keystore-crypto-Bjgriq9h.mjs.map +0 -1
- package/dist/keystore-service.d.mts +0 -48
- package/dist/keystore-service.d.ts +0 -48
- package/dist/keystore-service.js +0 -122
- package/dist/keystore-service.js.map +0 -1
- package/dist/keystore-service.mjs +0 -114
- package/dist/keystore-service.mjs.map +0 -1
- package/dist/post-quantum-crypto-CAi-cEkV.js +0 -189
- package/dist/post-quantum-crypto-CAi-cEkV.js.map +0 -1
- package/dist/post-quantum-crypto-Vv34t6gX.mjs +0 -154
- package/dist/post-quantum-crypto-Vv34t6gX.mjs.map +0 -1
- package/dist/storage-service-BgIK2aYZ.js +0 -82
- package/dist/storage-service-BgIK2aYZ.js.map +0 -1
- package/dist/storage-service-CubCbhY2.mjs +0 -65
- package/dist/storage-service-CubCbhY2.mjs.map +0 -1
- package/dist/symmetric-crypto-CrdS1Che.mjs.map +0 -1
- package/dist/symmetric-crypto-D65zB396.js.map +0 -1
- package/dist/types-52g887Zi.js +0 -16
- package/dist/types-52g887Zi.js.map +0 -1
- package/dist/types-BiEoleqw.mjs +0 -10
- package/dist/types-BiEoleqw.mjs.map +0 -1
- package/dist/types-Ds3ivE9W.d.ts +0 -104
- package/dist/types-DwQJtrTx.d.mts +0 -104
- package/dist/utils-CNs3cyDj.js.map +0 -1
- package/dist/utils-DS04iUcX.mjs.map +0 -1
package/dist/derive-key.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
require('./
|
|
3
|
-
require('./symmetric-crypto-D65zB396.js');
|
|
4
|
-
const require_derive_key = require('./derive-key-CBf2WxJd.js');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_deriveKeysFromPassword = require('./deriveKeysFromPassword-BYaiSGKL.js');
|
|
5
3
|
|
|
6
|
-
exports.deriveSymmetricCryptoKeyFromContext =
|
|
7
|
-
exports.deriveSymmetricCryptoKeyFromTwoKeys =
|
|
8
|
-
exports.deriveSymmetricKeyFromContext =
|
|
9
|
-
exports.deriveSymmetricKeyFromTwoKeys =
|
|
10
|
-
exports.deriveSymmetricKeyFromTwoKeysAndContext =
|
|
11
|
-
exports.getKeyFromPassword =
|
|
12
|
-
exports.getKeyFromPasswordAndSalt =
|
|
13
|
-
exports.getKeyFromPasswordAndSaltHex =
|
|
14
|
-
exports.getKeyFromPasswordHex =
|
|
15
|
-
exports.verifyKeyFromPasswordHex =
|
|
4
|
+
exports.deriveSymmetricCryptoKeyFromContext = require_deriveKeysFromPassword.deriveSymmetricCryptoKeyFromContext;
|
|
5
|
+
exports.deriveSymmetricCryptoKeyFromTwoKeys = require_deriveKeysFromPassword.deriveSymmetricCryptoKeyFromTwoKeys;
|
|
6
|
+
exports.deriveSymmetricKeyFromContext = require_deriveKeysFromPassword.deriveSymmetricKeyFromContext;
|
|
7
|
+
exports.deriveSymmetricKeyFromTwoKeys = require_deriveKeysFromPassword.deriveSymmetricKeyFromTwoKeys;
|
|
8
|
+
exports.deriveSymmetricKeyFromTwoKeysAndContext = require_deriveKeysFromPassword.deriveSymmetricKeyFromTwoKeysAndContext;
|
|
9
|
+
exports.getKeyFromPassword = require_deriveKeysFromPassword.getKeyFromPassword;
|
|
10
|
+
exports.getKeyFromPasswordAndSalt = require_deriveKeysFromPassword.getKeyFromPasswordAndSalt;
|
|
11
|
+
exports.getKeyFromPasswordAndSaltHex = require_deriveKeysFromPassword.getKeyFromPasswordAndSaltHex;
|
|
12
|
+
exports.getKeyFromPasswordHex = require_deriveKeysFromPassword.getKeyFromPasswordHex;
|
|
13
|
+
exports.verifyKeyFromPasswordHex = require_deriveKeysFromPassword.verifyKeyFromPasswordHex;
|
package/dist/derive-key.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./hash-CXeGAwai.mjs";
|
|
3
|
-
import "./symmetric-crypto-CrdS1Che.mjs";
|
|
4
|
-
import { a as getKeyFromPasswordHex, c as deriveSymmetricCryptoKeyFromTwoKeys, d as deriveSymmetricKeyFromTwoKeysAndContext, i as getKeyFromPasswordAndSaltHex, l as deriveSymmetricKeyFromContext, n as getKeyFromPassword, o as verifyKeyFromPasswordHex, r as getKeyFromPasswordAndSalt, s as deriveSymmetricCryptoKeyFromContext, u as deriveSymmetricKeyFromTwoKeys } from "./derive-key-Be7hS-cN.mjs";
|
|
1
|
+
import { a as verifyKeyFromPasswordHex, c as deriveSymmetricKeyFromContext, i as getKeyFromPasswordHex, l as deriveSymmetricKeyFromTwoKeys, n as getKeyFromPasswordAndSalt, o as deriveSymmetricCryptoKeyFromContext, r as getKeyFromPasswordAndSaltHex, s as deriveSymmetricCryptoKeyFromTwoKeys, t as getKeyFromPassword, u as deriveSymmetricKeyFromTwoKeysAndContext } from "./deriveKeysFromPassword-XIwzErlL.mjs";
|
|
5
2
|
|
|
6
3
|
export { deriveSymmetricCryptoKeyFromContext, deriveSymmetricCryptoKeyFromTwoKeys, deriveSymmetricKeyFromContext, deriveSymmetricKeyFromTwoKeys, deriveSymmetricKeyFromTwoKeysAndContext, getKeyFromPassword, getKeyFromPasswordAndSalt, getKeyFromPasswordAndSaltHex, getKeyFromPasswordHex, verifyKeyFromPasswordHex };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-
|
|
2
|
-
const require_constants = require('./constants
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const require_chunk = require('./chunk-EbLFQX5m.js');
|
|
2
|
+
const require_constants = require('./constants.js');
|
|
3
|
+
const require_genID = require('./genID-YJSl3YhL.js');
|
|
4
|
+
const require_aes = require('./aes-DQo1MyCz.js');
|
|
5
5
|
let _noble_hashes_blake3_js = require("@noble/hashes/blake3.js");
|
|
6
|
+
let _noble_post_quantum_utils_js = require("@noble/post-quantum/utils.js");
|
|
6
7
|
|
|
7
8
|
//#region src/derive-key/deriveKeysFromKey.ts
|
|
8
9
|
/**
|
|
@@ -14,7 +15,7 @@ let _noble_hashes_blake3_js = require("@noble/hashes/blake3.js");
|
|
|
14
15
|
* @returns The derived secret key
|
|
15
16
|
*/
|
|
16
17
|
function deriveSymmetricKeyFromContext(context, baseKey) {
|
|
17
|
-
return (0, _noble_hashes_blake3_js.blake3)(baseKey, { context:
|
|
18
|
+
return (0, _noble_hashes_blake3_js.blake3)(baseKey, { context: require_genID.UTF8ToUint8(context) });
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Derives a symmetric CryptoKey from the base key and context string
|
|
@@ -28,7 +29,7 @@ async function deriveSymmetricCryptoKeyFromContext(context, baseKey) {
|
|
|
28
29
|
try {
|
|
29
30
|
if (baseKey.length != require_constants.AES_KEY_BIT_LENGTH / 8) throw new Error(`Base key length must be exactly ${require_constants.AES_KEY_BIT_LENGTH / 8} bytes`);
|
|
30
31
|
if (!context) throw new Error("Context is empry");
|
|
31
|
-
return await
|
|
32
|
+
return await require_aes.importSymmetricCryptoKey(deriveSymmetricKeyFromContext(context, baseKey));
|
|
32
33
|
} catch (error) {
|
|
33
34
|
throw new Error("Failed to derive CryptoKey from base key and context", { cause: error });
|
|
34
35
|
}
|
|
@@ -52,7 +53,7 @@ function deriveSymmetricKeyFromTwoKeys(key1, key2) {
|
|
|
52
53
|
*/
|
|
53
54
|
async function deriveSymmetricCryptoKeyFromTwoKeys(key1, key2) {
|
|
54
55
|
try {
|
|
55
|
-
return await
|
|
56
|
+
return await require_aes.importSymmetricCryptoKey(deriveSymmetricKeyFromTwoKeys(key1, key2));
|
|
56
57
|
} catch (error) {
|
|
57
58
|
throw new Error("Failed to derive symmetric CryptoKey from two keys", { cause: error });
|
|
58
59
|
}
|
|
@@ -68,7 +69,7 @@ async function deriveSymmetricCryptoKeyFromTwoKeys(key1, key2) {
|
|
|
68
69
|
function deriveSymmetricKeyFromTwoKeysAndContext(key1, key2, context) {
|
|
69
70
|
try {
|
|
70
71
|
if (key2.length != require_constants.AES_KEY_BIT_LENGTH / 8 || key1.length != require_constants.AES_KEY_BIT_LENGTH / 8) throw new Error(`Input key length must be exactly ${require_constants.AES_KEY_BIT_LENGTH / 8} bytes`);
|
|
71
|
-
return (0, _noble_hashes_blake3_js.blake3)((0, _noble_hashes_blake3_js.blake3)(key1, { key: key2 }), { context:
|
|
72
|
+
return (0, _noble_hashes_blake3_js.blake3)((0, _noble_hashes_blake3_js.blake3)(key1, { key: key2 }), { context: require_genID.UTF8ToUint8(context) });
|
|
72
73
|
} catch (error) {
|
|
73
74
|
throw new Error("Failed to derive symmetric key from two keys and context", { cause: error });
|
|
74
75
|
}
|
|
@@ -405,9 +406,9 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
405
406
|
};
|
|
406
407
|
});
|
|
407
408
|
}
|
|
408
|
-
function lockedCreate(mutex
|
|
409
|
+
function lockedCreate(mutex, binary, hashLength) {
|
|
409
410
|
return __awaiter(this, void 0, void 0, function* () {
|
|
410
|
-
const unlock = yield mutex
|
|
411
|
+
const unlock = yield mutex.lock();
|
|
411
412
|
const wasm = yield WASMInterface(binary, hashLength);
|
|
412
413
|
unlock();
|
|
413
414
|
return wasm;
|
|
@@ -610,14 +611,14 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
610
611
|
}
|
|
611
612
|
function argon2Internal(options) {
|
|
612
613
|
return __awaiter(this, void 0, void 0, function* () {
|
|
613
|
-
var _a
|
|
614
|
+
var _a;
|
|
614
615
|
const { parallelism, iterations, hashLength } = options;
|
|
615
616
|
const password = getUInt8Buffer(options.password);
|
|
616
617
|
const salt = getUInt8Buffer(options.salt);
|
|
617
618
|
const version = 19;
|
|
618
619
|
const hashType = getHashType(options.hashType);
|
|
619
620
|
const { memorySize } = options;
|
|
620
|
-
const secret = getUInt8Buffer((_a
|
|
621
|
+
const secret = getUInt8Buffer((_a = options.secret) !== null && _a !== void 0 ? _a : "");
|
|
621
622
|
const [argon2Interface, blake512] = yield Promise.all([WASMInterface(wasmJson$k, 1024), createBLAKE2b(512)]);
|
|
622
623
|
argon2Interface.setMemorySize(memorySize * 1024 + 1024);
|
|
623
624
|
const initVector = new Uint8Array(24);
|
|
@@ -662,7 +663,7 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
662
663
|
});
|
|
663
664
|
}
|
|
664
665
|
const validateOptions$3 = (options) => {
|
|
665
|
-
var _a
|
|
666
|
+
var _a;
|
|
666
667
|
if (!options || typeof options !== "object") throw new Error("Invalid options parameter. It requires an object.");
|
|
667
668
|
if (!options.password) throw new Error("Password must be specified");
|
|
668
669
|
options.password = getUInt8Buffer(options.password);
|
|
@@ -670,7 +671,7 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
670
671
|
if (!options.salt) throw new Error("Salt must be specified");
|
|
671
672
|
options.salt = getUInt8Buffer(options.salt);
|
|
672
673
|
if (options.salt.length < 8) throw new Error("Salt should be at least 8 bytes long");
|
|
673
|
-
options.secret = getUInt8Buffer((_a
|
|
674
|
+
options.secret = getUInt8Buffer((_a = options.secret) !== null && _a !== void 0 ? _a : "");
|
|
674
675
|
if (!Number.isInteger(options.iterations) || options.iterations < 1) throw new Error("Iterations should be a positive number");
|
|
675
676
|
if (!Number.isInteger(options.parallelism) || options.parallelism < 1) throw new Error("Parallelism should be a positive number");
|
|
676
677
|
if (!Number.isInteger(options.hashLength) || options.hashLength < 4) throw new Error("Hash length should be at least 4 bytes.");
|
|
@@ -697,7 +698,7 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
697
698
|
* Calculates hash using the argon2id password-hashing function
|
|
698
699
|
* @returns Computed hash
|
|
699
700
|
*/
|
|
700
|
-
function argon2id
|
|
701
|
+
function argon2id(options) {
|
|
701
702
|
return __awaiter(this, void 0, void 0, function* () {
|
|
702
703
|
validateOptions$3(options);
|
|
703
704
|
return argon2Internal(Object.assign(Object.assign({}, options), { hashType: "id" }));
|
|
@@ -862,7 +863,7 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
862
863
|
* @param key Optional key (string, Buffer or TypedArray). Length should be 32 bytes.
|
|
863
864
|
* @returns Computed hash as a hexadecimal string
|
|
864
865
|
*/
|
|
865
|
-
function blake3
|
|
866
|
+
function blake3(data, bits = 256, key = null) {
|
|
866
867
|
if (validateBits$2(bits)) return Promise.reject(validateBits$2(bits));
|
|
867
868
|
let keyBuffer = null;
|
|
868
869
|
let initParam = 0;
|
|
@@ -1043,8 +1044,8 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
1043
1044
|
wasmCache$g.writeMemory(polyBuffer);
|
|
1044
1045
|
const hash = wasmCache$g.calculate(data);
|
|
1045
1046
|
return Promise.resolve(hash);
|
|
1046
|
-
} catch (err
|
|
1047
|
-
return Promise.reject(err
|
|
1047
|
+
} catch (err) {
|
|
1048
|
+
return Promise.reject(err);
|
|
1048
1049
|
}
|
|
1049
1050
|
}
|
|
1050
1051
|
/**
|
|
@@ -2257,12 +2258,12 @@ var require_index_umd = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
2257
2258
|
exports$1.argon2Verify = argon2Verify;
|
|
2258
2259
|
exports$1.argon2d = argon2d;
|
|
2259
2260
|
exports$1.argon2i = argon2i;
|
|
2260
|
-
exports$1.argon2id = argon2id
|
|
2261
|
+
exports$1.argon2id = argon2id;
|
|
2261
2262
|
exports$1.bcrypt = bcrypt;
|
|
2262
2263
|
exports$1.bcryptVerify = bcryptVerify;
|
|
2263
2264
|
exports$1.blake2b = blake2b;
|
|
2264
2265
|
exports$1.blake2s = blake2s;
|
|
2265
|
-
exports$1.blake3 = blake3
|
|
2266
|
+
exports$1.blake3 = blake3;
|
|
2266
2267
|
exports$1.crc32 = crc32;
|
|
2267
2268
|
exports$1.crc64 = crc64;
|
|
2268
2269
|
exports$1.createAdler32 = createAdler32;
|
|
@@ -2340,13 +2341,7 @@ async function argon2(password, salt, parallelism = require_constants.ARGON2ID_P
|
|
|
2340
2341
|
* @returns The salt
|
|
2341
2342
|
*/
|
|
2342
2343
|
function sampleSalt() {
|
|
2343
|
-
|
|
2344
|
-
const salt = new Uint8Array(require_constants.ARGON2ID_SALT_BYTE_LENGTH);
|
|
2345
|
-
crypto.getRandomValues(salt);
|
|
2346
|
-
return salt;
|
|
2347
|
-
} catch (error) {
|
|
2348
|
-
throw new Error("Failed to sample salt", { cause: error });
|
|
2349
|
-
}
|
|
2344
|
+
return (0, _noble_post_quantum_utils_js.randomBytes)(require_constants.ARGON2ID_SALT_BYTE_LENGTH);
|
|
2350
2345
|
}
|
|
2351
2346
|
|
|
2352
2347
|
//#endregion
|
|
@@ -2395,8 +2390,8 @@ async function getKeyFromPasswordHex(password) {
|
|
|
2395
2390
|
try {
|
|
2396
2391
|
const { key, salt } = await getKeyFromPassword(password);
|
|
2397
2392
|
return {
|
|
2398
|
-
keyHex:
|
|
2399
|
-
saltHex:
|
|
2393
|
+
keyHex: require_genID.uint8ArrayToHex(key),
|
|
2394
|
+
saltHex: require_genID.uint8ArrayToHex(salt)
|
|
2400
2395
|
};
|
|
2401
2396
|
} catch (error) {
|
|
2402
2397
|
throw new Error("Failed to derive key from password", { cause: error });
|
|
@@ -2411,7 +2406,7 @@ async function getKeyFromPasswordHex(password) {
|
|
|
2411
2406
|
*/
|
|
2412
2407
|
async function getKeyFromPasswordAndSaltHex(password, saltHex) {
|
|
2413
2408
|
try {
|
|
2414
|
-
return
|
|
2409
|
+
return require_genID.uint8ArrayToHex(await getKeyFromPasswordAndSalt(password, require_genID.hexToUint8Array(saltHex)));
|
|
2415
2410
|
} catch (error) {
|
|
2416
2411
|
throw new Error("Failed to derive key from password and salt", { cause: error });
|
|
2417
2412
|
}
|
|
@@ -2428,21 +2423,6 @@ async function verifyKeyFromPasswordHex(password, saltHex, keyHex) {
|
|
|
2428
2423
|
return keyHex === await getKeyFromPasswordAndSaltHex(password, saltHex);
|
|
2429
2424
|
}
|
|
2430
2425
|
|
|
2431
|
-
//#endregion
|
|
2432
|
-
//#region src/derive-key/index.ts
|
|
2433
|
-
var derive_key_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
2434
|
-
deriveSymmetricCryptoKeyFromContext: () => deriveSymmetricCryptoKeyFromContext,
|
|
2435
|
-
deriveSymmetricCryptoKeyFromTwoKeys: () => deriveSymmetricCryptoKeyFromTwoKeys,
|
|
2436
|
-
deriveSymmetricKeyFromContext: () => deriveSymmetricKeyFromContext,
|
|
2437
|
-
deriveSymmetricKeyFromTwoKeys: () => deriveSymmetricKeyFromTwoKeys,
|
|
2438
|
-
deriveSymmetricKeyFromTwoKeysAndContext: () => deriveSymmetricKeyFromTwoKeysAndContext,
|
|
2439
|
-
getKeyFromPassword: () => getKeyFromPassword,
|
|
2440
|
-
getKeyFromPasswordAndSalt: () => getKeyFromPasswordAndSalt,
|
|
2441
|
-
getKeyFromPasswordAndSaltHex: () => getKeyFromPasswordAndSaltHex,
|
|
2442
|
-
getKeyFromPasswordHex: () => getKeyFromPasswordHex,
|
|
2443
|
-
verifyKeyFromPasswordHex: () => verifyKeyFromPasswordHex
|
|
2444
|
-
});
|
|
2445
|
-
|
|
2446
2426
|
//#endregion
|
|
2447
2427
|
Object.defineProperty(exports, 'deriveSymmetricCryptoKeyFromContext', {
|
|
2448
2428
|
enumerable: true,
|
|
@@ -2474,12 +2454,6 @@ Object.defineProperty(exports, 'deriveSymmetricKeyFromTwoKeysAndContext', {
|
|
|
2474
2454
|
return deriveSymmetricKeyFromTwoKeysAndContext;
|
|
2475
2455
|
}
|
|
2476
2456
|
});
|
|
2477
|
-
Object.defineProperty(exports, 'derive_key_exports', {
|
|
2478
|
-
enumerable: true,
|
|
2479
|
-
get: function () {
|
|
2480
|
-
return derive_key_exports;
|
|
2481
|
-
}
|
|
2482
|
-
});
|
|
2483
2457
|
Object.defineProperty(exports, 'getKeyFromPassword', {
|
|
2484
2458
|
enumerable: true,
|
|
2485
2459
|
get: function () {
|
|
@@ -2510,4 +2484,4 @@ Object.defineProperty(exports, 'verifyKeyFromPasswordHex', {
|
|
|
2510
2484
|
return verifyKeyFromPasswordHex;
|
|
2511
2485
|
}
|
|
2512
2486
|
});
|
|
2513
|
-
//# sourceMappingURL=
|
|
2487
|
+
//# sourceMappingURL=deriveKeysFromPassword-BYaiSGKL.js.map
|