@sebastienrousseau/crypto-lib 0.0.34 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/accel/index.d.ts +5 -4
- package/dist/accel/index.d.ts.map +1 -1
- package/dist/accel/index.js +5 -5
- package/dist/accel/kdf-backend.d.ts +13 -0
- package/dist/accel/kdf-backend.d.ts.map +1 -0
- package/dist/accel/kdf-backend.js +81 -0
- package/dist/accel/native-pqc-bridge.d.ts.map +1 -1
- package/dist/accel/native-pqc-bridge.js +12 -52
- package/dist/accel/pq-backend.d.ts +3652 -0
- package/dist/accel/pq-backend.d.ts.map +1 -0
- package/dist/accel/pq-backend.js +215 -0
- package/dist/accel/runtime.d.ts +3 -0
- package/dist/accel/runtime.d.ts.map +1 -0
- package/dist/accel/runtime.js +9 -0
- package/dist/accel/wasm-bridge.d.ts.map +1 -1
- package/dist/accel/wasm-bridge.js +14 -13
- package/dist/accel/webcrypto-bridge.d.ts.map +1 -1
- package/dist/accel/webcrypto-bridge.js +14 -13
- package/dist/accel/webcrypto-modern.d.ts.map +1 -1
- package/dist/accel/webcrypto-modern.js +15 -14
- package/dist/accel/worker-pool.d.ts +18 -0
- package/dist/accel/worker-pool.d.ts.map +1 -1
- package/dist/accel/worker-pool.js +113 -37
- package/dist/bin/cryptolib.d.ts +7 -4
- package/dist/bin/cryptolib.d.ts.map +1 -1
- package/dist/bin/cryptolib.js +6 -6
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +2 -1
- package/dist/encoding.d.ts +10 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +84 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +20 -1
- package/dist/high-level/key-wrap.d.ts.map +1 -1
- package/dist/high-level/key-wrap.js +12 -17
- package/dist/high-level/multi-recipient.d.ts.map +1 -1
- package/dist/high-level/multi-recipient.js +15 -28
- package/dist/high-level/password-encrypt.d.ts.map +1 -1
- package/dist/high-level/password-encrypt.js +11 -11
- package/dist/high-level/sealedbox.d.ts.map +1 -1
- package/dist/high-level/sealedbox.js +16 -28
- package/dist/high-level/secretbox.d.ts.map +1 -1
- package/dist/high-level/secretbox.js +11 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/key/keystore.d.ts.map +1 -1
- package/dist/key/keystore.js +2 -1
- package/dist/keys/keygen.d.ts.map +1 -1
- package/dist/keys/keygen.js +13 -14
- package/dist/keys/keyring.d.ts.map +1 -1
- package/dist/keys/keyring.js +4 -2
- package/dist/keys/serialize.d.ts.map +1 -1
- package/dist/keys/serialize.js +18 -16
- package/dist/lib/decrypt.d.ts.map +1 -1
- package/dist/lib/decrypt.js +2 -1
- package/dist/lib/generate.d.ts +2 -1
- package/dist/lib/generate.d.ts.map +1 -1
- package/dist/lib/generate.js +7 -6
- package/dist/lib/key-output.d.ts +4 -1
- package/dist/lib/key-output.d.ts.map +1 -1
- package/dist/lib/key-output.js +2 -2
- package/dist/lib/reformat.d.ts +2 -1
- package/dist/lib/reformat.d.ts.map +1 -1
- package/dist/lib/reformat.js +2 -2
- package/dist/lib/revoke.d.ts +2 -1
- package/dist/lib/revoke.d.ts.map +1 -1
- package/dist/lib/revoke.js +2 -2
- package/dist/lib/verify.d.ts +6 -2
- package/dist/lib/verify.d.ts.map +1 -1
- package/dist/lib/verify.js +28 -9
- package/dist/modern/aead.d.ts.map +1 -1
- package/dist/modern/aead.js +11 -10
- package/dist/modern/aes.d.ts.map +1 -1
- package/dist/modern/aes.js +10 -9
- package/dist/modern/cost-limits.d.ts.map +1 -1
- package/dist/modern/cost-limits.js +3 -2
- package/dist/modern/curves.d.ts +10 -5
- package/dist/modern/curves.d.ts.map +1 -1
- package/dist/modern/curves.js +43 -36
- package/dist/modern/ecdh.d.ts +2 -1
- package/dist/modern/ecdh.d.ts.map +1 -1
- package/dist/modern/ecdh.js +10 -9
- package/dist/modern/fn-dsa.d.ts.map +1 -1
- package/dist/modern/fn-dsa.js +9 -8
- package/dist/modern/hash.d.ts.map +1 -1
- package/dist/modern/hash.js +5 -3
- package/dist/modern/hpke-xwing.d.ts +10 -0
- package/dist/modern/hpke-xwing.d.ts.map +1 -0
- package/dist/modern/hpke-xwing.js +26 -0
- package/dist/modern/hpke.d.ts +1 -1
- package/dist/modern/hpke.d.ts.map +1 -1
- package/dist/modern/hpke.js +60 -28
- package/dist/modern/hybrid-combiner.d.ts +20 -0
- package/dist/modern/hybrid-combiner.d.ts.map +1 -0
- package/dist/modern/hybrid-combiner.js +79 -0
- package/dist/modern/index.d.ts +10 -10
- package/dist/modern/index.d.ts.map +1 -1
- package/dist/modern/index.js +17 -7
- package/dist/modern/kdf.d.ts.map +1 -1
- package/dist/modern/kdf.js +12 -12
- package/dist/modern/mac.d.ts +1 -0
- package/dist/modern/mac.d.ts.map +1 -1
- package/dist/modern/mac.js +24 -15
- package/dist/modern/password.d.ts.map +1 -1
- package/dist/modern/password.js +19 -18
- package/dist/modern/pq-hash-sign.d.ts.map +1 -1
- package/dist/modern/pq-hash-sign.js +23 -22
- package/dist/modern/pq-kem.d.ts +8 -0
- package/dist/modern/pq-kem.d.ts.map +1 -1
- package/dist/modern/pq-kem.js +71 -79
- package/dist/modern/pq-sign.d.ts +9 -2
- package/dist/modern/pq-sign.d.ts.map +1 -1
- package/dist/modern/pq-sign.js +60 -23
- package/dist/modern/pq.d.ts +0 -17
- package/dist/modern/pq.d.ts.map +1 -1
- package/dist/modern/pq.js +15 -43
- package/dist/modern/signing.d.ts +2 -1
- package/dist/modern/signing.d.ts.map +1 -1
- package/dist/modern/signing.js +14 -13
- package/dist/protocols/iso20022.d.ts.map +1 -1
- package/dist/protocols/iso20022.js +12 -6
- package/dist/protocols/opaque/ksf.js +2 -2
- package/dist/protocols/opaque/suite.d.ts +1 -8
- package/dist/protocols/opaque/suite.d.ts.map +1 -1
- package/dist/protocols/opaque/suite.js +5 -10
- package/dist/protocols/pqxdh.d.ts +9 -2
- package/dist/protocols/pqxdh.d.ts.map +1 -1
- package/dist/protocols/pqxdh.js +99 -94
- package/dist/protocols/ratchet.d.ts.map +1 -1
- package/dist/protocols/ratchet.js +14 -15
- package/dist/protocols/threshold.d.ts.map +1 -1
- package/dist/protocols/threshold.js +16 -15
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +26 -0
- package/dist/streaming/chunks.d.ts +40 -0
- package/dist/streaming/chunks.d.ts.map +1 -0
- package/dist/streaming/chunks.js +173 -0
- package/dist/streaming/stream-aead.d.ts +9 -0
- package/dist/streaming/stream-aead.d.ts.map +1 -1
- package/dist/streaming/stream-aead.js +33 -82
- package/dist/streaming/stream-hash.d.ts.map +1 -1
- package/dist/streaming/stream-hash.js +6 -4
- package/dist/streaming/stream-multi-pq-aead.d.ts +12 -0
- package/dist/streaming/stream-multi-pq-aead.d.ts.map +1 -1
- package/dist/streaming/stream-multi-pq-aead.js +90 -147
- package/dist/streaming/stream-pq-aead.d.ts +7 -3
- package/dist/streaming/stream-pq-aead.d.ts.map +1 -1
- package/dist/streaming/stream-pq-aead.js +34 -114
- package/dist/streaming/web-streams.d.ts +5 -2
- package/dist/streaming/web-streams.d.ts.map +1 -1
- package/dist/streaming/web-streams.js +90 -151
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +13 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/key-rotation.d.ts.map +1 -1
- package/dist/tokens/key-rotation.js +4 -2
- package/dist/tokens/paseto.d.ts +2 -0
- package/dist/tokens/paseto.d.ts.map +1 -1
- package/dist/tokens/paseto.js +56 -29
- package/dist/types/types.d.ts +1 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -2
- package/package.json +12 -2
- package/dist/config/config.d.ts +0 -8
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/config.js +0 -13
- package/dist/key/key.d.ts +0 -10
- package/dist/key/key.d.ts.map +0 -1
- package/dist/key/key.js +0 -25
package/dist/modern/fn-dsa.js
CHANGED
|
@@ -4,12 +4,13 @@ exports.fnDsaKeygen = fnDsaKeygen;
|
|
|
4
4
|
exports.fnDsaSign = fnDsaSign;
|
|
5
5
|
exports.fnDsaVerify = fnDsaVerify;
|
|
6
6
|
const falcon_js_1 = require("@noble/post-quantum/falcon.js");
|
|
7
|
-
const
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const encoding_1 = require("../encoding");
|
|
8
9
|
function assertHex(input, label) {
|
|
9
|
-
if (!
|
|
10
|
-
throw new
|
|
10
|
+
if (!(0, encoding_1.isHex)(input)) {
|
|
11
|
+
throw new errors_1.CryptoError(`Invalid hex string for ${label}`, errors_1.CryptoErrorCode.INVALID_HEX);
|
|
11
12
|
}
|
|
12
|
-
return
|
|
13
|
+
return (0, encoding_1.decodeHex)(input);
|
|
13
14
|
}
|
|
14
15
|
function getFalcon(level) {
|
|
15
16
|
switch (level) {
|
|
@@ -18,7 +19,7 @@ function getFalcon(level) {
|
|
|
18
19
|
case 1024:
|
|
19
20
|
return falcon_js_1.falcon1024;
|
|
20
21
|
default:
|
|
21
|
-
throw new
|
|
22
|
+
throw new errors_1.CryptoError(`Unsupported FN-DSA level: ${level}. Supported: 512, 1024`, errors_1.CryptoErrorCode.UNSUPPORTED_ALGORITHM);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
function algorithmName(level) {
|
|
@@ -28,8 +29,8 @@ function fnDsaKeygen(level) {
|
|
|
28
29
|
const falcon = getFalcon(level);
|
|
29
30
|
const { publicKey, secretKey } = falcon.keygen();
|
|
30
31
|
return {
|
|
31
|
-
publicKey:
|
|
32
|
-
secretKey:
|
|
32
|
+
publicKey: (0, encoding_1.toHex)(publicKey),
|
|
33
|
+
secretKey: (0, encoding_1.toHex)(secretKey),
|
|
33
34
|
algorithm: algorithmName(level),
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -39,7 +40,7 @@ function fnDsaSign(level, secretKeyHex, messageHex) {
|
|
|
39
40
|
const msg = assertHex(messageHex, "message");
|
|
40
41
|
const signature = falcon.sign(msg, secretKey);
|
|
41
42
|
return {
|
|
42
|
-
signature:
|
|
43
|
+
signature: (0, encoding_1.toHex)(signature),
|
|
43
44
|
algorithm: algorithmName(level),
|
|
44
45
|
};
|
|
45
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/modern/hash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/modern/hash.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,eAAe,sFAQlB,CAAC;AAGX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAG7D,MAAM,WAAW,WAAW;IAE1B,SAAS,EAAE,aAAa,CAAC;IAEzB,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAGD,MAAM,WAAW,UAAU;IAEzB,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,aAAa,CAAC;IAEzB,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,wBAAgB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAsCrD"}
|
package/dist/modern/hash.js
CHANGED
|
@@ -6,6 +6,8 @@ const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
|
6
6
|
const sha3_js_1 = require("@noble/hashes/sha3.js");
|
|
7
7
|
const blake2_js_1 = require("@noble/hashes/blake2.js");
|
|
8
8
|
const blake3_js_1 = require("@noble/hashes/blake3.js");
|
|
9
|
+
const errors_1 = require("../errors");
|
|
10
|
+
const encoding_1 = require("../encoding");
|
|
9
11
|
exports.HASH_ALGORITHMS = [
|
|
10
12
|
"sha256",
|
|
11
13
|
"sha384",
|
|
@@ -18,7 +20,7 @@ exports.HASH_ALGORITHMS = [
|
|
|
18
20
|
function toBytes(input) {
|
|
19
21
|
if (input instanceof Uint8Array)
|
|
20
22
|
return input;
|
|
21
|
-
return
|
|
23
|
+
return (0, encoding_1.utf8)(input);
|
|
22
24
|
}
|
|
23
25
|
function hash(options) {
|
|
24
26
|
const data = toBytes(options.data);
|
|
@@ -46,10 +48,10 @@ function hash(options) {
|
|
|
46
48
|
digest = (0, blake3_js_1.blake3)(data);
|
|
47
49
|
break;
|
|
48
50
|
default:
|
|
49
|
-
throw new
|
|
51
|
+
throw new errors_1.CryptoError(`Unsupported algorithm: ${options.algorithm}. Supported: ${exports.HASH_ALGORITHMS.join(", ")}`, errors_1.CryptoErrorCode.UNSUPPORTED_ALGORITHM);
|
|
50
52
|
}
|
|
51
53
|
return {
|
|
52
|
-
digest:
|
|
54
|
+
digest: (0, encoding_1.toHex)(digest),
|
|
53
55
|
algorithm: options.algorithm,
|
|
54
56
|
length: digest.length,
|
|
55
57
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const xwingKeygen: () => {
|
|
2
|
+
publicKey: Uint8Array;
|
|
3
|
+
secretKey: Uint8Array;
|
|
4
|
+
};
|
|
5
|
+
export declare function xwingEncap(recipientPub: Uint8Array, eseed: Uint8Array): {
|
|
6
|
+
sharedSecret: Uint8Array;
|
|
7
|
+
enc: Uint8Array;
|
|
8
|
+
};
|
|
9
|
+
export declare function xwingDecap(enc: Uint8Array, recipientPriv: Uint8Array): Uint8Array;
|
|
10
|
+
//# sourceMappingURL=hpke-xwing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hpke-xwing.d.ts","sourceRoot":"","sources":["../../src/modern/hpke-xwing.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,WAAW,QAAO;IAC7B,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;CACL,CAAC;AAOpB,wBAAgB,UAAU,CACxB,YAAY,EAAE,UAAU,EACxB,KAAK,EAAE,UAAU,GAChB;IAAE,YAAY,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,CAS/C;AAGD,wBAAgB,UAAU,CACxB,GAAG,EAAE,UAAU,EACf,aAAa,EAAE,UAAU,GACxB,UAAU,CAcZ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.xwingKeygen = void 0;
|
|
4
|
+
exports.xwingEncap = xwingEncap;
|
|
5
|
+
exports.xwingDecap = xwingDecap;
|
|
6
|
+
const hybrid_js_1 = require("@noble/post-quantum/hybrid.js");
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
const xwingKeygen = () => hybrid_js_1.ml_kem768_x25519.keygen();
|
|
9
|
+
exports.xwingKeygen = xwingKeygen;
|
|
10
|
+
function xwingEncap(recipientPub, eseed) {
|
|
11
|
+
if (recipientPub.length !== 1216) {
|
|
12
|
+
throw new errors_1.CryptoError("Invalid x-wing public key length (expected 1216 bytes)", errors_1.CryptoErrorCode.INVALID_KEY);
|
|
13
|
+
}
|
|
14
|
+
const { cipherText, sharedSecret } = hybrid_js_1.ml_kem768_x25519.encapsulate(recipientPub, eseed);
|
|
15
|
+
return { sharedSecret, enc: cipherText };
|
|
16
|
+
}
|
|
17
|
+
function xwingDecap(enc, recipientPriv) {
|
|
18
|
+
if (recipientPriv.length !== 32) {
|
|
19
|
+
throw new errors_1.CryptoError("Invalid x-wing private key length (expected 32 bytes)", errors_1.CryptoErrorCode.INVALID_KEY);
|
|
20
|
+
}
|
|
21
|
+
if (enc.length !== 1120) {
|
|
22
|
+
throw new errors_1.CryptoError("Invalid x-wing encapsulated key length (expected 1120 bytes)", errors_1.CryptoErrorCode.INVALID_CIPHERTEXT);
|
|
23
|
+
}
|
|
24
|
+
return hybrid_js_1.ml_kem768_x25519.decapsulate(enc, recipientPriv);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=hpke-xwing.js.map
|
package/dist/modern/hpke.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HpkeKem = "x25519" | "p256" | "x25519-ml-kem-768";
|
|
1
|
+
export type HpkeKem = "x25519" | "p256" | "x-wing" | "x25519-ml-kem-768";
|
|
2
2
|
export type HpkeAead = "chacha20-poly1305" | "aes-128-gcm";
|
|
3
3
|
export type HpkeMode = "base" | "psk";
|
|
4
4
|
export interface HpkeKeyPair {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hpke.d.ts","sourceRoot":"","sources":["../../src/modern/hpke.ts"],"names":[],"mappings":"AA+
|
|
1
|
+
{"version":3,"file":"hpke.d.ts","sourceRoot":"","sources":["../../src/modern/hpke.ts"],"names":[],"mappings":"AA+EA,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,MAAM,GACN,QAAQ,GAER,mBAAmB,CAAC;AAUxB,MAAM,MAAM,QAAQ,GAAG,mBAAmB,GAAG,aAAa,CAAC;AAU3D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAUtC,MAAM,WAAW,WAAW;IAE1B,SAAS,EAAE,MAAM,CAAC;IAElB,UAAU,EAAE,MAAM,CAAC;CACpB;AAUD,MAAM,WAAW,cAAc;IAE7B,UAAU,EAAE,MAAM,CAAC;IAEnB,eAAe,EAAE,MAAM,CAAC;CACzB;AAUD,MAAM,WAAW,cAAc;IAE7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAUD,MAAM,WAAW,gBAAgB;IAE/B,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAUD,MAAM,WAAW,cAAc;IAE7B,GAAG,EAAE,MAAM,CAAC;IAEZ,KAAK,EAAE,MAAM,CAAC;CACf;AA2cD,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,OAAkB,GAAG,WAAW,CAsBxE;AAuBD,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAEhC,kBAAkB,EAAE,MAAM,CAAC;IAE3B,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB,GAAG,CAAC,EAAE,cAAc,CAAC;CACtB,GAAG,cAAc,CAOjB;AAYD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,EACvC,mBAAmB,EAAE,UAAU,GAC9B,cAAc,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB,CA2BA;AA0BD,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAEhC,mBAAmB,EAAE,MAAM,CAAC;IAE5B,eAAe,EAAE,MAAM,CAAC;IAExB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB,GAAG,CAAC,EAAE,cAAc,CAAC;CACtB,GAAG,cAAc,CAgBjB"}
|
package/dist/modern/hpke.js
CHANGED
|
@@ -10,24 +10,28 @@ const hkdf_js_1 = require("@noble/hashes/hkdf.js");
|
|
|
10
10
|
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
11
11
|
const chacha_js_1 = require("@noble/ciphers/chacha.js");
|
|
12
12
|
const aes_js_1 = require("@noble/ciphers/aes.js");
|
|
13
|
-
const
|
|
13
|
+
const hpke_xwing_1 = require("./hpke-xwing");
|
|
14
|
+
const utils_js_1 = require("@noble/ciphers/utils.js");
|
|
15
|
+
const pq_backend_1 = require("../accel/pq-backend");
|
|
16
|
+
const errors_1 = require("../errors");
|
|
17
|
+
const encoding_1 = require("../encoding");
|
|
14
18
|
const KEM_X25519 = 0x0020;
|
|
15
19
|
const KEM_P256 = 0x0010;
|
|
16
20
|
const KEM_X25519_MLKEM768 = 0x0030;
|
|
21
|
+
const KEM_XWING = 0x647a;
|
|
17
22
|
const KDF_HKDF_SHA256 = 0x0001;
|
|
18
23
|
const AEAD_AES_128_GCM = 0x0001;
|
|
19
24
|
const AEAD_CHACHA20_POLY1305 = 0x0003;
|
|
20
25
|
const MODE_BASE = 0x00;
|
|
21
26
|
const MODE_PSK = 0x01;
|
|
22
|
-
const HEX_RE = /^[0-9a-fA-F]*$/;
|
|
23
27
|
function hexToBytes(hex) {
|
|
24
|
-
if (!
|
|
25
|
-
throw new
|
|
28
|
+
if (!(0, encoding_1.isHex)(hex)) {
|
|
29
|
+
throw new errors_1.CryptoError("Invalid hex string", errors_1.CryptoErrorCode.INVALID_HEX);
|
|
26
30
|
}
|
|
27
|
-
return
|
|
31
|
+
return (0, encoding_1.decodeHex)(hex);
|
|
28
32
|
}
|
|
29
33
|
function bytesToHex(bytes) {
|
|
30
|
-
return
|
|
34
|
+
return (0, encoding_1.toHex)(bytes);
|
|
31
35
|
}
|
|
32
36
|
function i2osp2(n) {
|
|
33
37
|
return new Uint8Array([(n >> 8) & 0xff, n & 0xff]);
|
|
@@ -60,6 +64,11 @@ function suiteParams(kem, aead) {
|
|
|
60
64
|
nEnc = 65;
|
|
61
65
|
nSk = 32;
|
|
62
66
|
}
|
|
67
|
+
else if (kem === "x-wing") {
|
|
68
|
+
kemId = KEM_XWING;
|
|
69
|
+
nEnc = 1120;
|
|
70
|
+
nSk = 32;
|
|
71
|
+
}
|
|
63
72
|
else {
|
|
64
73
|
kemId = KEM_X25519_MLKEM768;
|
|
65
74
|
nEnc = 1120;
|
|
@@ -81,17 +90,17 @@ function suiteParams(kem, aead) {
|
|
|
81
90
|
};
|
|
82
91
|
}
|
|
83
92
|
function hpkeSuiteId(params) {
|
|
84
|
-
return concat(
|
|
93
|
+
return concat((0, encoding_1.utf8)("HPKE"), i2osp2(params.kemId), i2osp2(params.kdfId), i2osp2(params.aeadId));
|
|
85
94
|
}
|
|
86
95
|
function kemSuiteId(kemId) {
|
|
87
|
-
return concat(
|
|
96
|
+
return concat((0, encoding_1.utf8)("KEM"), i2osp2(kemId));
|
|
88
97
|
}
|
|
89
98
|
function labeledExtract(suiteId, salt, label, ikm) {
|
|
90
|
-
const labeledIkm = concat(
|
|
99
|
+
const labeledIkm = concat((0, encoding_1.utf8)("HPKE-v1"), suiteId, (0, encoding_1.utf8)(label), ikm);
|
|
91
100
|
return (0, hkdf_js_1.extract)(sha2_js_1.sha256, labeledIkm, salt.length > 0 ? salt : undefined);
|
|
92
101
|
}
|
|
93
102
|
function labeledExpand(suiteId, prk, label, info, length) {
|
|
94
|
-
const labeledInfo = concat(i2osp2(length),
|
|
103
|
+
const labeledInfo = concat(i2osp2(length), (0, encoding_1.utf8)("HPKE-v1"), suiteId, (0, encoding_1.utf8)(label), info);
|
|
95
104
|
return (0, hkdf_js_1.expand)(sha2_js_1.sha256, prk, labeledInfo, length);
|
|
96
105
|
}
|
|
97
106
|
function kemPublicKey(kem, sk) {
|
|
@@ -126,16 +135,39 @@ function dhkemDecap(kem, enc, recipientPriv, params) {
|
|
|
126
135
|
const recipientPub = kemPublicKey(kem, recipientPriv);
|
|
127
136
|
return extractAndExpand(params, dh, concat(enc, recipientPub));
|
|
128
137
|
}
|
|
138
|
+
function encap(kem, recipientPub, ephemeral, params) {
|
|
139
|
+
if (kem === "x-wing")
|
|
140
|
+
return (0, hpke_xwing_1.xwingEncap)(recipientPub, ephemeral);
|
|
141
|
+
if (kem === "x25519-ml-kem-768") {
|
|
142
|
+
return hybridEncap(recipientPub, ephemeral, params);
|
|
143
|
+
}
|
|
144
|
+
return dhkemEncap(kem, recipientPub, ephemeral, params);
|
|
145
|
+
}
|
|
146
|
+
function decap(kem, enc, recipientPriv, params) {
|
|
147
|
+
if (kem === "x-wing")
|
|
148
|
+
return (0, hpke_xwing_1.xwingDecap)(enc, recipientPriv);
|
|
149
|
+
if (kem === "x25519-ml-kem-768") {
|
|
150
|
+
return hybridDecap(enc, recipientPriv, params);
|
|
151
|
+
}
|
|
152
|
+
return dhkemDecap(kem, enc, recipientPriv, params);
|
|
153
|
+
}
|
|
154
|
+
function ephemeralSecret(kem) {
|
|
155
|
+
if (kem === "x-wing")
|
|
156
|
+
return (0, utils_js_1.randomBytes)(64);
|
|
157
|
+
if (kem === "x25519-ml-kem-768")
|
|
158
|
+
return ed25519_js_1.x25519.utils.randomSecretKey();
|
|
159
|
+
return kemRandomPrivateKey(kem);
|
|
160
|
+
}
|
|
129
161
|
function hybridEncap(recipientPub, ephemeralPrivateKey, params) {
|
|
130
162
|
if (recipientPub.length !== 1216) {
|
|
131
|
-
throw new
|
|
163
|
+
throw new errors_1.CryptoError("Invalid recipient public key length for x25519-ml-kem-768", errors_1.CryptoErrorCode.INVALID_KEY);
|
|
132
164
|
}
|
|
133
165
|
const pkX = recipientPub.subarray(0, 32);
|
|
134
166
|
const pkMlKem = recipientPub.subarray(32);
|
|
135
167
|
const ephPrivX = ephemeralPrivateKey.subarray(0, 32);
|
|
136
168
|
const encX = ed25519_js_1.x25519.getPublicKey(ephPrivX);
|
|
137
169
|
const ssClassical = ed25519_js_1.x25519.getSharedSecret(ephPrivX, pkX);
|
|
138
|
-
const { cipherText: ctMlKem, sharedSecret: ssMlKem } =
|
|
170
|
+
const { cipherText: ctMlKem, sharedSecret: ssMlKem } = pq_backend_1.ml_kem768.encapsulate(pkMlKem);
|
|
139
171
|
const enc = concat(encX, ctMlKem);
|
|
140
172
|
const ikm = concat(ssClassical, ssMlKem);
|
|
141
173
|
const sharedSecret = extractAndExpand(params, ikm, concat(enc, recipientPub));
|
|
@@ -143,19 +175,19 @@ function hybridEncap(recipientPub, ephemeralPrivateKey, params) {
|
|
|
143
175
|
}
|
|
144
176
|
function hybridDecap(enc, recipientPriv, params) {
|
|
145
177
|
if (recipientPriv.length !== 2432) {
|
|
146
|
-
throw new
|
|
178
|
+
throw new errors_1.CryptoError("Invalid recipient private key length for x25519-ml-kem-768", errors_1.CryptoErrorCode.INVALID_KEY);
|
|
147
179
|
}
|
|
148
180
|
if (enc.length !== 1120) {
|
|
149
|
-
throw new
|
|
181
|
+
throw new errors_1.CryptoError("Invalid encapsulated key length for x25519-ml-kem-768", errors_1.CryptoErrorCode.INVALID_CIPHERTEXT);
|
|
150
182
|
}
|
|
151
183
|
const skX = recipientPriv.subarray(0, 32);
|
|
152
184
|
const skMlKem = recipientPriv.subarray(32);
|
|
153
185
|
const encX = enc.subarray(0, 32);
|
|
154
186
|
const ctMlKem = enc.subarray(32);
|
|
155
187
|
const ssClassical = ed25519_js_1.x25519.getSharedSecret(skX, encX);
|
|
156
|
-
const ssMlKem =
|
|
188
|
+
const ssMlKem = pq_backend_1.ml_kem768.decapsulate(ctMlKem, skMlKem);
|
|
157
189
|
const pkX = ed25519_js_1.x25519.getPublicKey(skX);
|
|
158
|
-
const pkMlKem =
|
|
190
|
+
const pkMlKem = pq_backend_1.ml_kem768.getPublicKey(skMlKem);
|
|
159
191
|
const recipientPub = concat(pkX, pkMlKem);
|
|
160
192
|
const ikm = concat(ssClassical, ssMlKem);
|
|
161
193
|
return extractAndExpand(params, ikm, concat(enc, recipientPub));
|
|
@@ -186,7 +218,7 @@ function scheduleInputs(options) {
|
|
|
186
218
|
const psk = hexToBytes(options.psk.psk);
|
|
187
219
|
const pskId = hexToBytes(options.psk.pskId);
|
|
188
220
|
if (psk.length === 0 || pskId.length === 0) {
|
|
189
|
-
throw new
|
|
221
|
+
throw new errors_1.CryptoError("PSK mode requires a non-empty psk and pskId", errors_1.CryptoErrorCode.INVALID_INPUT);
|
|
190
222
|
}
|
|
191
223
|
return { mode: MODE_PSK, info, psk, pskId };
|
|
192
224
|
}
|
|
@@ -203,10 +235,17 @@ function aeadOpen(aead, key, nonce, aad, ciphertext) {
|
|
|
203
235
|
return (0, aes_js_1.gcm)(key, nonce, aad).decrypt(ciphertext);
|
|
204
236
|
}
|
|
205
237
|
function hpkeGenerateKeyPair(kem = "x25519") {
|
|
238
|
+
if (kem === "x-wing") {
|
|
239
|
+
const { publicKey, secretKey } = (0, hpke_xwing_1.xwingKeygen)();
|
|
240
|
+
return {
|
|
241
|
+
publicKey: bytesToHex(publicKey),
|
|
242
|
+
privateKey: bytesToHex(secretKey),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
206
245
|
if (kem === "x25519-ml-kem-768") {
|
|
207
246
|
const skX = ed25519_js_1.x25519.utils.randomSecretKey();
|
|
208
247
|
const pkX = ed25519_js_1.x25519.getPublicKey(skX);
|
|
209
|
-
const { publicKey: pkMlKem, secretKey: skMlKem } =
|
|
248
|
+
const { publicKey: pkMlKem, secretKey: skMlKem } = pq_backend_1.ml_kem768.keygen();
|
|
210
249
|
return {
|
|
211
250
|
publicKey: bytesToHex(concat(pkX, pkMlKem)),
|
|
212
251
|
privateKey: bytesToHex(concat(skX, skMlKem)),
|
|
@@ -220,10 +259,7 @@ function hpkeGenerateKeyPair(kem = "x25519") {
|
|
|
220
259
|
}
|
|
221
260
|
function hpkeSeal(options) {
|
|
222
261
|
const kem = options.suite?.kem ?? "x25519";
|
|
223
|
-
const
|
|
224
|
-
? ed25519_js_1.x25519.utils.randomSecretKey()
|
|
225
|
-
: kemRandomPrivateKey(kem);
|
|
226
|
-
const sealed = hpkeSealWithEphemeral(options, ephemeralPrivateKey);
|
|
262
|
+
const sealed = hpkeSealWithEphemeral(options, ephemeralSecret(kem));
|
|
227
263
|
return {
|
|
228
264
|
ciphertext: sealed.ciphertext,
|
|
229
265
|
encapsulatedKey: sealed.encapsulatedKey,
|
|
@@ -237,9 +273,7 @@ function hpkeSealWithEphemeral(options, ephemeralPrivateKey) {
|
|
|
237
273
|
const plaintext = hexToBytes(options.plaintext);
|
|
238
274
|
const aad = options.aad ? hexToBytes(options.aad) : new Uint8Array(0);
|
|
239
275
|
const inputs = scheduleInputs(options);
|
|
240
|
-
const { sharedSecret, enc } = kem
|
|
241
|
-
? hybridEncap(recipientPub, ephemeralPrivateKey, params)
|
|
242
|
-
: dhkemEncap(kem, recipientPub, ephemeralPrivateKey, params);
|
|
276
|
+
const { sharedSecret, enc } = encap(kem, recipientPub, ephemeralPrivateKey, params);
|
|
243
277
|
const ks = keySchedule(params, sharedSecret, inputs);
|
|
244
278
|
const ct = aeadSeal(aead, ks.key, ks.baseNonce, aad, plaintext);
|
|
245
279
|
return {
|
|
@@ -260,9 +294,7 @@ function hpkeOpen(options) {
|
|
|
260
294
|
const ciphertext = hexToBytes(options.ciphertext);
|
|
261
295
|
const aad = options.aad ? hexToBytes(options.aad) : new Uint8Array(0);
|
|
262
296
|
const inputs = scheduleInputs(options);
|
|
263
|
-
const sharedSecret = kem
|
|
264
|
-
? hybridDecap(enc, recipientPriv, params)
|
|
265
|
-
: dhkemDecap(kem, enc, recipientPriv, params);
|
|
297
|
+
const sharedSecret = decap(kem, enc, recipientPriv, params);
|
|
266
298
|
const { key, baseNonce } = keySchedule(params, sharedSecret, inputs);
|
|
267
299
|
const pt = aeadOpen(aead, key, baseNonce, aad, ciphertext);
|
|
268
300
|
return { plaintext: bytesToHex(pt) };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HybridKemAlgorithm } from "./pq-kem";
|
|
2
|
+
export interface HybridTranscript {
|
|
3
|
+
algorithm: HybridKemAlgorithm;
|
|
4
|
+
ssClassical: Uint8Array;
|
|
5
|
+
ssMlKem: Uint8Array;
|
|
6
|
+
ctClassical: Uint8Array;
|
|
7
|
+
pkClassical: Uint8Array;
|
|
8
|
+
ctMlKem: Uint8Array;
|
|
9
|
+
pkMlKem: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
export declare function combineHybrid(t: HybridTranscript): Uint8Array;
|
|
12
|
+
export interface HybridSend {
|
|
13
|
+
ephPub: Uint8Array;
|
|
14
|
+
mlKemCt: Uint8Array;
|
|
15
|
+
key: Uint8Array;
|
|
16
|
+
}
|
|
17
|
+
export declare function hybridSend(recipX25519Pub: Uint8Array, recipMlKemPub: Uint8Array, construction: string): HybridSend;
|
|
18
|
+
export declare function hybridReceiveKeys(recipX25519Sec: Uint8Array, recipMlKemSec: Uint8Array, ephPub: Uint8Array, mlKemCt: Uint8Array, construction: string, legacyKey: (ssClassical: Uint8Array, ssMlKem: Uint8Array) => Uint8Array): Uint8Array[];
|
|
19
|
+
export declare function openWithFirstKey<T>(keys: Uint8Array[], open: (key: Uint8Array) => T): T;
|
|
20
|
+
//# sourceMappingURL=hybrid-combiner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hybrid-combiner.d.ts","sourceRoot":"","sources":["../../src/modern/hybrid-combiner.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,WAAW,gBAAgB;IAE/B,SAAS,EAAE,kBAAkB,CAAC;IAE9B,WAAW,EAAE,UAAU,CAAC;IAExB,OAAO,EAAE,UAAU,CAAC;IAEpB,WAAW,EAAE,UAAU,CAAC;IAExB,WAAW,EAAE,UAAU,CAAC;IAExB,OAAO,EAAE,UAAU,CAAC;IAEpB,OAAO,EAAE,UAAU,CAAC;CACrB;AAcD,wBAAgB,aAAa,CAAC,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAU7D;AASD,MAAM,WAAW,UAAU;IAEzB,MAAM,EAAE,UAAU,CAAC;IAEnB,OAAO,EAAE,UAAU,CAAC;IAEpB,GAAG,EAAE,UAAU,CAAC;CACjB;AAMD,wBAAgB,UAAU,CACxB,cAAc,EAAE,UAAU,EAC1B,aAAa,EAAE,UAAU,EACzB,YAAY,EAAE,MAAM,GACnB,UAAU,CAgBZ;AAMD,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,UAAU,EAC1B,aAAa,EAAE,UAAU,EACzB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,KAAK,UAAU,GACtE,UAAU,EAAE,CAgBd;AAMD,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,UAAU,EAAE,EAClB,IAAI,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,CAAC,GAC3B,CAAC,CAUH"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.combineHybrid = combineHybrid;
|
|
4
|
+
exports.hybridSend = hybridSend;
|
|
5
|
+
exports.hybridReceiveKeys = hybridReceiveKeys;
|
|
6
|
+
exports.openWithFirstKey = openWithFirstKey;
|
|
7
|
+
const ed25519_js_1 = require("@noble/curves/ed25519.js");
|
|
8
|
+
const hkdf_js_1 = require("@noble/hashes/hkdf.js");
|
|
9
|
+
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
10
|
+
const utils_js_1 = require("@noble/ciphers/utils.js");
|
|
11
|
+
const pq_backend_1 = require("../accel/pq-backend");
|
|
12
|
+
const encoding_1 = require("../encoding");
|
|
13
|
+
function lengthPrefixed(bytes) {
|
|
14
|
+
const out = new Uint8Array(4 + bytes.length);
|
|
15
|
+
new DataView(out.buffer).setUint32(0, bytes.length, false);
|
|
16
|
+
out.set(bytes, 4);
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
function combineHybrid(t) {
|
|
20
|
+
const ikm = (0, encoding_1.concat)([t.ssClassical, t.ssMlKem]);
|
|
21
|
+
const info = (0, encoding_1.concat)([
|
|
22
|
+
lengthPrefixed((0, encoding_1.utf8)(`crypto-service/hybrid-kem/v2/${t.algorithm}`)),
|
|
23
|
+
lengthPrefixed(t.ctClassical),
|
|
24
|
+
lengthPrefixed(t.pkClassical),
|
|
25
|
+
lengthPrefixed(t.ctMlKem),
|
|
26
|
+
lengthPrefixed(t.pkMlKem),
|
|
27
|
+
]);
|
|
28
|
+
return (0, hkdf_js_1.hkdf)(sha2_js_1.sha256, ikm, undefined, info, 32);
|
|
29
|
+
}
|
|
30
|
+
function constructionKey(secret, construction) {
|
|
31
|
+
const info = new TextEncoder().encode(`crypto-service/${construction}/v2`);
|
|
32
|
+
return (0, hkdf_js_1.hkdf)(sha2_js_1.sha256, secret, undefined, info, 32);
|
|
33
|
+
}
|
|
34
|
+
function hybridSend(recipX25519Pub, recipMlKemPub, construction) {
|
|
35
|
+
const ephPriv = (0, utils_js_1.randomBytes)(32);
|
|
36
|
+
const ephPub = ed25519_js_1.x25519.getPublicKey(ephPriv);
|
|
37
|
+
const ssClassical = ed25519_js_1.x25519.getSharedSecret(ephPriv, recipX25519Pub);
|
|
38
|
+
const { cipherText: mlKemCt, sharedSecret: ssMlKem } = pq_backend_1.ml_kem768.encapsulate(recipMlKemPub);
|
|
39
|
+
const secret = combineHybrid({
|
|
40
|
+
algorithm: "x25519-ml-kem-768",
|
|
41
|
+
ssClassical,
|
|
42
|
+
ssMlKem,
|
|
43
|
+
ctClassical: ephPub,
|
|
44
|
+
pkClassical: recipX25519Pub,
|
|
45
|
+
ctMlKem: mlKemCt,
|
|
46
|
+
pkMlKem: recipMlKemPub,
|
|
47
|
+
});
|
|
48
|
+
return { ephPub, mlKemCt, key: constructionKey(secret, construction) };
|
|
49
|
+
}
|
|
50
|
+
function hybridReceiveKeys(recipX25519Sec, recipMlKemSec, ephPub, mlKemCt, construction, legacyKey) {
|
|
51
|
+
const ssMlKem = pq_backend_1.ml_kem768.decapsulate(mlKemCt, recipMlKemSec);
|
|
52
|
+
const ssClassical = ed25519_js_1.x25519.getSharedSecret(recipX25519Sec, ephPub);
|
|
53
|
+
const secret = combineHybrid({
|
|
54
|
+
algorithm: "x25519-ml-kem-768",
|
|
55
|
+
ssClassical,
|
|
56
|
+
ssMlKem,
|
|
57
|
+
ctClassical: ephPub,
|
|
58
|
+
pkClassical: ed25519_js_1.x25519.getPublicKey(recipX25519Sec),
|
|
59
|
+
ctMlKem: mlKemCt,
|
|
60
|
+
pkMlKem: pq_backend_1.ml_kem768.getPublicKey(recipMlKemSec),
|
|
61
|
+
});
|
|
62
|
+
return [
|
|
63
|
+
constructionKey(secret, construction),
|
|
64
|
+
legacyKey(ssClassical, ssMlKem),
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
function openWithFirstKey(keys, open) {
|
|
68
|
+
let firstError;
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
try {
|
|
71
|
+
return open(key);
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
firstError ??= e;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
throw firstError;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=hybrid-combiner.js.map
|
package/dist/modern/index.d.ts
CHANGED
|
@@ -6,25 +6,25 @@ export { hash, HASH_ALGORITHMS } from "./hash";
|
|
|
6
6
|
export type { HashOptions, HashResult, HashAlgorithm } from "./hash";
|
|
7
7
|
export { kdfDerive, KDF_ALGORITHMS } from "./kdf";
|
|
8
8
|
export type { KdfDeriveOptions, KdfResult, KdfAlgorithm } from "./kdf";
|
|
9
|
-
export { generateEd25519KeyPair, ed25519Sign, ed25519Verify } from "./signing";
|
|
9
|
+
export { ed25519Keygen, generateEd25519KeyPair, ed25519Sign, ed25519Verify, } from "./signing";
|
|
10
10
|
export type { Ed25519KeyPair, SignResult, VerifyResult } from "./signing";
|
|
11
|
-
export { generateX25519KeyPair, x25519Exchange } from "./ecdh";
|
|
11
|
+
export { x25519Keygen, generateX25519KeyPair, x25519Exchange } from "./ecdh";
|
|
12
12
|
export type { X25519KeyPair, KeyExchangeResult } from "./ecdh";
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
15
|
-
export { mlKemKeygen, mlKemEncapsulate
|
|
16
|
-
export type { MlKemLevel, MlKemAlgorithm, MlKemKeyPairResult, MlKemEncapsulateResult
|
|
13
|
+
export { hybridGenerateKeyPair, hybridEncapsulate, hybridDecapsulate, } from "./pq";
|
|
14
|
+
export type { HybridKeyPair, HybridEncapsulateResult, HybridDecapsulateResult, } from "./pq";
|
|
15
|
+
export { mlKemKeygen, mlKemEncapsulate, mlKemDecapsulate, mlKemGenerateKeyPair, mlKemEncap, mlKemDecap, hybridKemKeygen, hybridKemEncapsulate, hybridKemDecapsulate, p256MlKemKeygen, p256MlKemEncapsulate, p256MlKemDecapsulate, x448MlKemKeygen, x448MlKemEncapsulate, x448MlKemDecapsulate, RFC10024_X25519_MLKEM768, RFC10024_SECP256R1_MLKEM768, RFC10024_CODEPOINTS, normalizeHybridKemAlgorithm, } from "./pq-kem";
|
|
16
|
+
export type { MlKemLevel, MlKemAlgorithm, MlKemKeyPairResult, MlKemEncapsulateResult, MlKemDecapsulateResult, MlKemKeyPair, MlKemEncapResult, MlKemDecapResult, HybridKemAlgorithm, HybridKemKeyPair, HybridKemEncapsulateResult, HybridKemDecapsulateResult, P256MlKemKeyPair, P256MlKemEncapsulateResult, P256MlKemDecapsulateResult, X448MlKemKeyPair, X448MlKemEncapsulateResult, X448MlKemDecapsulateResult, } from "./pq-kem";
|
|
17
17
|
export { mlDsaKeygen, mlDsaSign, mlDsaVerify, hybridSign, hybridVerify, } from "./pq-sign";
|
|
18
|
-
export type { MlDsaLevel, MlDsaAlgorithm, MlDsaKeyPairResult, MlDsaSignResult, MlDsaVerifyResult, HybridSignResult, HybridVerifyResult, } from "./pq-sign";
|
|
18
|
+
export type { MlDsaLevel, MlDsaAlgorithm, MlDsaKeyPairResult, MlDsaSignResult, MlDsaVerifyResult, HybridSignResult, HybridVerifyResult, HybridSignOptions, HybridVerifyOptions, } from "./pq-sign";
|
|
19
19
|
export { fnDsaKeygen, fnDsaSign, fnDsaVerify } from "./fn-dsa";
|
|
20
20
|
export type { FnDsaLevel, FnDsaAlgorithm, FnDsaKeyPairResult, FnDsaSignResult, FnDsaVerifyResult, } from "./fn-dsa";
|
|
21
21
|
export { slhDsaKeygen, slhDsaSign, slhDsaVerify } from "./pq-hash-sign";
|
|
22
22
|
export type { SlhDsaVariant, SlhDsaKeyPairResult, SlhDsaSignResult, SlhDsaVerifyResult, } from "./pq-hash-sign";
|
|
23
|
-
export { computeHmac, verifyHmac, HMAC_ALGORITHMS, computeKmac, verifyKmac, KMAC_ALGORITHMS, } from "./mac";
|
|
23
|
+
export { computeHmac, verifyHmac, HMAC_ALGORITHMS, computeKmac, verifyKmac, KMAC_ALGORITHMS, MIN_MAC_KEY_BYTES, } from "./mac";
|
|
24
24
|
export type { HmacAlgorithm, HmacComputeOptions, HmacComputeResult, HmacVerifyOptions, HmacVerifyResult, KmacAlgorithm, KmacComputeOptions, KmacComputeResult, KmacVerifyOptions, KmacVerifyResult, } from "./mac";
|
|
25
25
|
export { hashPassword, verifyPassword, verifyPasswordPhc } from "./password";
|
|
26
26
|
export type { Argon2Variant, Argon2Params, HashPasswordOptions, HashPasswordResult, VerifyPasswordOptions, VerifyPasswordResult, VerifyPhcOptions, } from "./password";
|
|
27
|
-
export { generateP256KeyPair, p256Sign, p256Verify, generateP384KeyPair, p384Sign, p384Verify, generateEd448KeyPair, ed448Sign, ed448Verify, generateX448KeyPair, x448Exchange, ecdhP256, ecdhP384, generateSchnorrKeyPair, schnorrSign, schnorrVerify, } from "./curves";
|
|
27
|
+
export { p256Keygen, generateP256KeyPair, p256Sign, p256Verify, p384Keygen, generateP384KeyPair, p384Sign, p384Verify, ed448Keygen, generateEd448KeyPair, ed448Sign, ed448Verify, x448Keygen, generateX448KeyPair, x448Exchange, ecdhP256, ecdhP384, schnorrKeygen, generateSchnorrKeyPair, schnorrSign, schnorrVerify, } from "./curves";
|
|
28
28
|
export type { P256KeyPair, P256SignResult, P256VerifyResult, P384KeyPair, P384SignResult, P384VerifyResult, Ed448KeyPair, Ed448SignResult, Ed448VerifyResult, X448KeyPair, X448ExchangeResult, EcdhP256Result, EcdhP384Result, SchnorrKeyPair, SchnorrSignResult, SchnorrVerifyResult, } from "./curves";
|
|
29
29
|
export { hpkeGenerateKeyPair, hpkeSeal, hpkeOpen } from "./hpke";
|
|
30
30
|
export type { HpkeKem, HpkeAead, HpkeMode, HpkeKeyPair, HpkeSealResult, HpkeOpenResult, HpkeSuiteOptions, HpkePskOptions, } from "./hpke";
|
|
@@ -34,7 +34,7 @@ export declare const SUPPORTED_ALGORITHMS: {
|
|
|
34
34
|
readonly kdf: readonly ["scrypt", "hkdf-sha256", "pbkdf2-sha256", "argon2id", "argon2i", "argon2d"];
|
|
35
35
|
readonly mac: readonly ["hmac-sha256", "hmac-sha384", "hmac-sha512", "hmac-sha3-256", "hmac-sha3-512", "kmac-128", "kmac-256"];
|
|
36
36
|
readonly signing: readonly ["ed25519", "ed448", "ecdsa-p256", "ecdsa-p384", "schnorr", "ml-dsa-44", "ml-dsa-65", "ml-dsa-87", "slh-dsa-sha2-128f", "slh-dsa-sha2-128s", "slh-dsa-sha2-192f", "slh-dsa-sha2-192s", "slh-dsa-sha2-256f", "slh-dsa-sha2-256s", "slh-dsa-shake-128f", "slh-dsa-shake-128s", "slh-dsa-shake-192f", "slh-dsa-shake-192s", "slh-dsa-shake-256f", "slh-dsa-shake-256s", "ed25519-ml-dsa-44", "ed25519-ml-dsa-65", "ed25519-ml-dsa-87", "fn-dsa-512", "fn-dsa-1024"];
|
|
37
|
-
readonly keyExchange: readonly ["x25519", "x448", "ecdh-p256", "ecdh-p384", "x25519-ml-kem-512", "x25519-ml-kem-768", "x25519-ml-kem-1024", "p256-ml-kem-768", "x448-ml-kem-1024", "hpke-x25519-chacha20", "hpke-x25519-aes128gcm", "hpke-p256-aes128gcm", "hpke-x25519-ml-kem-768-chacha20", "hpke-x25519-ml-kem-768-aes128gcm"];
|
|
37
|
+
readonly keyExchange: readonly ["x25519", "x448", "ecdh-p256", "ecdh-p384", "x25519-ml-kem-512", "x25519-ml-kem-768", "x25519-ml-kem-1024", "p256-ml-kem-768", "x448-ml-kem-1024", "hpke-x25519-chacha20", "hpke-x25519-aes128gcm", "hpke-p256-aes128gcm", "hpke-x-wing-chacha20", "hpke-x-wing-aes128gcm", "hpke-x25519-ml-kem-768-chacha20", "hpke-x25519-ml-kem-768-aes128gcm"];
|
|
38
38
|
readonly postQuantum: readonly ["ml-kem-512", "ml-kem-768", "ml-kem-1024", "ml-dsa-44", "ml-dsa-65", "ml-dsa-87", "slh-dsa-sha2-128f", "slh-dsa-sha2-128s", "slh-dsa-sha2-192f", "slh-dsa-sha2-192s", "slh-dsa-sha2-256f", "slh-dsa-sha2-256s", "slh-dsa-shake-128f", "slh-dsa-shake-128s", "slh-dsa-shake-192f", "slh-dsa-shake-192s", "slh-dsa-shake-256f", "slh-dsa-shake-256s", "fn-dsa-512", "fn-dsa-1024"];
|
|
39
39
|
};
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modern/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAElD,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,OAAO,CAAC;AAEf,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE/C,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAElD,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modern/index.ts"],"names":[],"mappings":"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"}
|
package/dist/modern/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.SUPPORTED_ALGORITHMS = exports.hpkeOpen = exports.hpkeSeal = exports.hpkeGenerateKeyPair = exports.schnorrVerify = exports.schnorrSign = exports.generateSchnorrKeyPair = exports.ecdhP384 = exports.ecdhP256 = exports.x448Exchange = exports.generateX448KeyPair = exports.ed448Verify = exports.ed448Sign = exports.generateEd448KeyPair = exports.p384Verify = exports.p384Sign = exports.generateP384KeyPair = exports.p256Verify = exports.p256Sign = exports.generateP256KeyPair = exports.verifyPasswordPhc = exports.verifyPassword = exports.hashPassword = exports.KMAC_ALGORITHMS = exports.verifyKmac = exports.computeKmac = exports.HMAC_ALGORITHMS = void 0;
|
|
3
|
+
exports.slhDsaVerify = exports.slhDsaSign = exports.slhDsaKeygen = exports.fnDsaVerify = exports.fnDsaSign = exports.fnDsaKeygen = exports.hybridVerify = exports.hybridSign = exports.mlDsaVerify = exports.mlDsaSign = exports.mlDsaKeygen = exports.normalizeHybridKemAlgorithm = exports.RFC10024_CODEPOINTS = exports.RFC10024_SECP256R1_MLKEM768 = exports.RFC10024_X25519_MLKEM768 = exports.x448MlKemDecapsulate = exports.x448MlKemEncapsulate = exports.x448MlKemKeygen = exports.p256MlKemDecapsulate = exports.p256MlKemEncapsulate = exports.p256MlKemKeygen = exports.hybridKemDecapsulate = exports.hybridKemEncapsulate = exports.hybridKemKeygen = exports.mlKemDecap = exports.mlKemEncap = exports.mlKemGenerateKeyPair = exports.mlKemDecapsulate = exports.mlKemEncapsulate = exports.mlKemKeygen = exports.hybridDecapsulate = exports.hybridEncapsulate = exports.hybridGenerateKeyPair = exports.x25519Exchange = exports.generateX25519KeyPair = exports.x25519Keygen = exports.ed25519Verify = exports.ed25519Sign = exports.generateEd25519KeyPair = exports.ed25519Keygen = exports.KDF_ALGORITHMS = exports.kdfDerive = exports.HASH_ALGORITHMS = exports.hash = exports.aesGcmSivDecrypt = exports.aesGcmSivEncrypt = exports.aesGcmDecrypt = exports.aesGcmEncrypt = exports.aeadDecrypt = exports.aeadEncrypt = void 0;
|
|
4
|
+
exports.SUPPORTED_ALGORITHMS = exports.hpkeOpen = exports.hpkeSeal = exports.hpkeGenerateKeyPair = exports.schnorrVerify = exports.schnorrSign = exports.generateSchnorrKeyPair = exports.schnorrKeygen = exports.ecdhP384 = exports.ecdhP256 = exports.x448Exchange = exports.generateX448KeyPair = exports.x448Keygen = exports.ed448Verify = exports.ed448Sign = exports.generateEd448KeyPair = exports.ed448Keygen = exports.p384Verify = exports.p384Sign = exports.generateP384KeyPair = exports.p384Keygen = exports.p256Verify = exports.p256Sign = exports.generateP256KeyPair = exports.p256Keygen = exports.verifyPasswordPhc = exports.verifyPassword = exports.hashPassword = exports.MIN_MAC_KEY_BYTES = exports.KMAC_ALGORITHMS = exports.verifyKmac = exports.computeKmac = exports.HMAC_ALGORITHMS = exports.verifyHmac = exports.computeHmac = void 0;
|
|
5
5
|
var aead_1 = require("./aead");
|
|
6
6
|
Object.defineProperty(exports, "aeadEncrypt", { enumerable: true, get: function () { return aead_1.aeadEncrypt; } });
|
|
7
7
|
Object.defineProperty(exports, "aeadDecrypt", { enumerable: true, get: function () { return aead_1.aeadDecrypt; } });
|
|
@@ -17,23 +17,25 @@ var kdf_1 = require("./kdf");
|
|
|
17
17
|
Object.defineProperty(exports, "kdfDerive", { enumerable: true, get: function () { return kdf_1.kdfDerive; } });
|
|
18
18
|
Object.defineProperty(exports, "KDF_ALGORITHMS", { enumerable: true, get: function () { return kdf_1.KDF_ALGORITHMS; } });
|
|
19
19
|
var signing_1 = require("./signing");
|
|
20
|
+
Object.defineProperty(exports, "ed25519Keygen", { enumerable: true, get: function () { return signing_1.ed25519Keygen; } });
|
|
20
21
|
Object.defineProperty(exports, "generateEd25519KeyPair", { enumerable: true, get: function () { return signing_1.generateEd25519KeyPair; } });
|
|
21
22
|
Object.defineProperty(exports, "ed25519Sign", { enumerable: true, get: function () { return signing_1.ed25519Sign; } });
|
|
22
23
|
Object.defineProperty(exports, "ed25519Verify", { enumerable: true, get: function () { return signing_1.ed25519Verify; } });
|
|
23
24
|
var ecdh_1 = require("./ecdh");
|
|
25
|
+
Object.defineProperty(exports, "x25519Keygen", { enumerable: true, get: function () { return ecdh_1.x25519Keygen; } });
|
|
24
26
|
Object.defineProperty(exports, "generateX25519KeyPair", { enumerable: true, get: function () { return ecdh_1.generateX25519KeyPair; } });
|
|
25
27
|
Object.defineProperty(exports, "x25519Exchange", { enumerable: true, get: function () { return ecdh_1.x25519Exchange; } });
|
|
26
28
|
var pq_1 = require("./pq");
|
|
27
|
-
Object.defineProperty(exports, "mlKemGenerateKeyPair", { enumerable: true, get: function () { return pq_1.mlKemGenerateKeyPair; } });
|
|
28
|
-
Object.defineProperty(exports, "mlKemEncapsulate", { enumerable: true, get: function () { return pq_1.mlKemEncapsulate; } });
|
|
29
|
-
Object.defineProperty(exports, "mlKemDecapsulate", { enumerable: true, get: function () { return pq_1.mlKemDecapsulate; } });
|
|
30
29
|
Object.defineProperty(exports, "hybridGenerateKeyPair", { enumerable: true, get: function () { return pq_1.hybridGenerateKeyPair; } });
|
|
31
30
|
Object.defineProperty(exports, "hybridEncapsulate", { enumerable: true, get: function () { return pq_1.hybridEncapsulate; } });
|
|
32
31
|
Object.defineProperty(exports, "hybridDecapsulate", { enumerable: true, get: function () { return pq_1.hybridDecapsulate; } });
|
|
33
32
|
var pq_kem_1 = require("./pq-kem");
|
|
34
33
|
Object.defineProperty(exports, "mlKemKeygen", { enumerable: true, get: function () { return pq_kem_1.mlKemKeygen; } });
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
Object.defineProperty(exports, "
|
|
34
|
+
Object.defineProperty(exports, "mlKemEncapsulate", { enumerable: true, get: function () { return pq_kem_1.mlKemEncapsulate; } });
|
|
35
|
+
Object.defineProperty(exports, "mlKemDecapsulate", { enumerable: true, get: function () { return pq_kem_1.mlKemDecapsulate; } });
|
|
36
|
+
Object.defineProperty(exports, "mlKemGenerateKeyPair", { enumerable: true, get: function () { return pq_kem_1.mlKemGenerateKeyPair; } });
|
|
37
|
+
Object.defineProperty(exports, "mlKemEncap", { enumerable: true, get: function () { return pq_kem_1.mlKemEncap; } });
|
|
38
|
+
Object.defineProperty(exports, "mlKemDecap", { enumerable: true, get: function () { return pq_kem_1.mlKemDecap; } });
|
|
37
39
|
Object.defineProperty(exports, "hybridKemKeygen", { enumerable: true, get: function () { return pq_kem_1.hybridKemKeygen; } });
|
|
38
40
|
Object.defineProperty(exports, "hybridKemEncapsulate", { enumerable: true, get: function () { return pq_kem_1.hybridKemEncapsulate; } });
|
|
39
41
|
Object.defineProperty(exports, "hybridKemDecapsulate", { enumerable: true, get: function () { return pq_kem_1.hybridKemDecapsulate; } });
|
|
@@ -68,24 +70,30 @@ Object.defineProperty(exports, "HMAC_ALGORITHMS", { enumerable: true, get: funct
|
|
|
68
70
|
Object.defineProperty(exports, "computeKmac", { enumerable: true, get: function () { return mac_1.computeKmac; } });
|
|
69
71
|
Object.defineProperty(exports, "verifyKmac", { enumerable: true, get: function () { return mac_1.verifyKmac; } });
|
|
70
72
|
Object.defineProperty(exports, "KMAC_ALGORITHMS", { enumerable: true, get: function () { return mac_1.KMAC_ALGORITHMS; } });
|
|
73
|
+
Object.defineProperty(exports, "MIN_MAC_KEY_BYTES", { enumerable: true, get: function () { return mac_1.MIN_MAC_KEY_BYTES; } });
|
|
71
74
|
var password_1 = require("./password");
|
|
72
75
|
Object.defineProperty(exports, "hashPassword", { enumerable: true, get: function () { return password_1.hashPassword; } });
|
|
73
76
|
Object.defineProperty(exports, "verifyPassword", { enumerable: true, get: function () { return password_1.verifyPassword; } });
|
|
74
77
|
Object.defineProperty(exports, "verifyPasswordPhc", { enumerable: true, get: function () { return password_1.verifyPasswordPhc; } });
|
|
75
78
|
var curves_1 = require("./curves");
|
|
79
|
+
Object.defineProperty(exports, "p256Keygen", { enumerable: true, get: function () { return curves_1.p256Keygen; } });
|
|
76
80
|
Object.defineProperty(exports, "generateP256KeyPair", { enumerable: true, get: function () { return curves_1.generateP256KeyPair; } });
|
|
77
81
|
Object.defineProperty(exports, "p256Sign", { enumerable: true, get: function () { return curves_1.p256Sign; } });
|
|
78
82
|
Object.defineProperty(exports, "p256Verify", { enumerable: true, get: function () { return curves_1.p256Verify; } });
|
|
83
|
+
Object.defineProperty(exports, "p384Keygen", { enumerable: true, get: function () { return curves_1.p384Keygen; } });
|
|
79
84
|
Object.defineProperty(exports, "generateP384KeyPair", { enumerable: true, get: function () { return curves_1.generateP384KeyPair; } });
|
|
80
85
|
Object.defineProperty(exports, "p384Sign", { enumerable: true, get: function () { return curves_1.p384Sign; } });
|
|
81
86
|
Object.defineProperty(exports, "p384Verify", { enumerable: true, get: function () { return curves_1.p384Verify; } });
|
|
87
|
+
Object.defineProperty(exports, "ed448Keygen", { enumerable: true, get: function () { return curves_1.ed448Keygen; } });
|
|
82
88
|
Object.defineProperty(exports, "generateEd448KeyPair", { enumerable: true, get: function () { return curves_1.generateEd448KeyPair; } });
|
|
83
89
|
Object.defineProperty(exports, "ed448Sign", { enumerable: true, get: function () { return curves_1.ed448Sign; } });
|
|
84
90
|
Object.defineProperty(exports, "ed448Verify", { enumerable: true, get: function () { return curves_1.ed448Verify; } });
|
|
91
|
+
Object.defineProperty(exports, "x448Keygen", { enumerable: true, get: function () { return curves_1.x448Keygen; } });
|
|
85
92
|
Object.defineProperty(exports, "generateX448KeyPair", { enumerable: true, get: function () { return curves_1.generateX448KeyPair; } });
|
|
86
93
|
Object.defineProperty(exports, "x448Exchange", { enumerable: true, get: function () { return curves_1.x448Exchange; } });
|
|
87
94
|
Object.defineProperty(exports, "ecdhP256", { enumerable: true, get: function () { return curves_1.ecdhP256; } });
|
|
88
95
|
Object.defineProperty(exports, "ecdhP384", { enumerable: true, get: function () { return curves_1.ecdhP384; } });
|
|
96
|
+
Object.defineProperty(exports, "schnorrKeygen", { enumerable: true, get: function () { return curves_1.schnorrKeygen; } });
|
|
89
97
|
Object.defineProperty(exports, "generateSchnorrKeyPair", { enumerable: true, get: function () { return curves_1.generateSchnorrKeyPair; } });
|
|
90
98
|
Object.defineProperty(exports, "schnorrSign", { enumerable: true, get: function () { return curves_1.schnorrSign; } });
|
|
91
99
|
Object.defineProperty(exports, "schnorrVerify", { enumerable: true, get: function () { return curves_1.schnorrVerify; } });
|
|
@@ -167,6 +175,8 @@ exports.SUPPORTED_ALGORITHMS = {
|
|
|
167
175
|
"hpke-x25519-chacha20",
|
|
168
176
|
"hpke-x25519-aes128gcm",
|
|
169
177
|
"hpke-p256-aes128gcm",
|
|
178
|
+
"hpke-x-wing-chacha20",
|
|
179
|
+
"hpke-x-wing-aes128gcm",
|
|
170
180
|
"hpke-x25519-ml-kem-768-chacha20",
|
|
171
181
|
"hpke-x25519-ml-kem-768-aes128gcm",
|
|
172
182
|
],
|
package/dist/modern/kdf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kdf.d.ts","sourceRoot":"","sources":["../../src/modern/kdf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kdf.d.ts","sourceRoot":"","sources":["../../src/modern/kdf.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,cAAc,qDAIjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAG3D,MAAM,WAAW,gBAAgB;IAE/B,SAAS,EAAE,YAAY,CAAC;IAExB,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;IAE9B,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,MAAM,CAAC,EAAE;QAEP,CAAC,CAAC,EAAE,MAAM,CAAC;QAEX,CAAC,CAAC,EAAE,MAAM,CAAC;QAEX,CAAC,CAAC,EAAE,MAAM,CAAC;QAEX,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;KAC5B,CAAC;CACH;AAGD,MAAM,WAAW,SAAS;IAExB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IAEb,SAAS,EAAE,YAAY,CAAC;IAExB,SAAS,EAAE,MAAM,CAAC;CACnB;AAyDD,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA+B9D"}
|