@sebastienrousseau/crypto-lib 0.0.2 → 0.0.8
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 +334 -185
- package/dist/accel/index.d.ts +11 -0
- package/dist/accel/index.d.ts.map +1 -0
- package/dist/accel/index.js +31 -0
- package/dist/accel/native-pqc-bridge.d.ts +18 -0
- package/dist/accel/native-pqc-bridge.d.ts.map +1 -0
- package/dist/accel/native-pqc-bridge.js +100 -0
- package/dist/accel/wasm-bridge.d.ts +35 -0
- package/dist/accel/wasm-bridge.d.ts.map +1 -0
- package/dist/accel/wasm-bridge.js +161 -0
- package/dist/accel/webcrypto-bridge.d.ts +32 -0
- package/dist/accel/webcrypto-bridge.d.ts.map +1 -0
- package/dist/accel/webcrypto-bridge.js +179 -0
- package/dist/accel/webcrypto-modern.d.ts +40 -0
- package/dist/accel/webcrypto-modern.d.ts.map +1 -0
- package/dist/accel/webcrypto-modern.js +213 -0
- package/dist/accel/worker-pool.d.ts +23 -0
- package/dist/accel/worker-pool.d.ts.map +1 -0
- package/dist/accel/worker-pool.js +119 -0
- package/dist/bin/cryptolib.d.ts +25 -0
- package/dist/bin/cryptolib.d.ts.map +1 -0
- package/dist/bin/cryptolib.js +87 -0
- package/dist/config/config.d.ts +8 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +13 -0
- package/dist/crypto.d.ts +43 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +107 -0
- package/dist/enums.d.ts +81 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +82 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +22 -0
- package/dist/high-level/index.d.ts +11 -0
- package/dist/high-level/index.d.ts.map +1 -0
- package/dist/high-level/index.js +53 -0
- package/dist/high-level/key-wrap.d.ts +16 -0
- package/dist/high-level/key-wrap.d.ts.map +1 -0
- package/dist/high-level/key-wrap.js +93 -0
- package/dist/high-level/multi-recipient.d.ts +25 -0
- package/dist/high-level/multi-recipient.d.ts.map +1 -0
- package/dist/high-level/multi-recipient.js +122 -0
- package/dist/high-level/password-encrypt.d.ts +14 -0
- package/dist/high-level/password-encrypt.d.ts.map +1 -0
- package/dist/high-level/password-encrypt.js +93 -0
- package/dist/high-level/sealedbox.d.ts +13 -0
- package/dist/high-level/sealedbox.d.ts.map +1 -0
- package/dist/high-level/sealedbox.js +119 -0
- package/dist/high-level/secretbox.d.ts +7 -0
- package/dist/high-level/secretbox.d.ts.map +1 -0
- package/dist/high-level/secretbox.js +54 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -2
- package/dist/key/key.d.ts +10 -0
- package/dist/key/key.d.ts.map +1 -0
- package/dist/key/key.js +25 -0
- package/dist/key/keystore.d.ts +11 -0
- package/dist/key/keystore.d.ts.map +1 -0
- package/dist/key/keystore.js +87 -0
- package/dist/keys/index.d.ts +7 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +22 -0
- package/dist/keys/keygen.d.ts +16 -0
- package/dist/keys/keygen.d.ts.map +1 -0
- package/dist/keys/keygen.js +128 -0
- package/dist/keys/keyring.d.ts +35 -0
- package/dist/keys/keyring.d.ts.map +1 -0
- package/dist/keys/keyring.js +136 -0
- package/dist/keys/serialize.d.ts +30 -0
- package/dist/keys/serialize.d.ts.map +1 -0
- package/dist/keys/serialize.js +120 -0
- package/dist/lib/decrypt.d.ts +5 -5
- package/dist/lib/decrypt.d.ts.map +1 -1
- package/dist/lib/decrypt.js +49 -39
- package/dist/lib/encrypt.d.ts +2 -5
- package/dist/lib/encrypt.d.ts.map +1 -1
- package/dist/lib/encrypt.js +34 -39
- package/dist/lib/generate.d.ts +2 -11
- package/dist/lib/generate.d.ts.map +1 -1
- package/dist/lib/generate.js +57 -29
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +53 -0
- package/dist/lib/key-output.d.ts +7 -0
- package/dist/lib/key-output.d.ts.map +1 -0
- package/dist/lib/key-output.js +50 -0
- package/dist/lib/reformat.d.ts +9 -0
- package/dist/lib/reformat.d.ts.map +1 -0
- package/dist/lib/reformat.js +67 -0
- package/dist/lib/revoke.d.ts +3 -3
- package/dist/lib/revoke.d.ts.map +1 -1
- package/dist/lib/revoke.js +36 -28
- package/dist/lib/session.d.ts +5 -0
- package/dist/lib/session.d.ts.map +1 -0
- package/dist/lib/session.js +55 -0
- package/dist/lib/sign.d.ts +4 -0
- package/dist/lib/sign.d.ts.map +1 -0
- package/dist/lib/sign.js +63 -0
- package/dist/lib/verify.d.ts +5 -0
- package/dist/lib/verify.d.ts.map +1 -0
- package/dist/lib/verify.js +52 -0
- package/dist/modern/aead.d.ts +17 -0
- package/dist/modern/aead.d.ts.map +1 -0
- package/dist/modern/aead.js +51 -0
- package/dist/modern/aes.d.ts +35 -0
- package/dist/modern/aes.d.ts.map +1 -0
- package/dist/modern/aes.js +82 -0
- package/dist/modern/cost-limits.d.ts +11 -0
- package/dist/modern/cost-limits.d.ts.map +1 -0
- package/dist/modern/cost-limits.js +35 -0
- package/dist/modern/curves.d.ts +86 -0
- package/dist/modern/curves.d.ts.map +1 -0
- package/dist/modern/curves.js +171 -0
- package/dist/modern/ecdh.d.ts +11 -0
- package/dist/modern/ecdh.d.ts.map +1 -0
- package/dist/modern/ecdh.js +28 -0
- package/dist/modern/fn-dsa.d.ts +19 -0
- package/dist/modern/fn-dsa.d.ts.map +1 -0
- package/dist/modern/fn-dsa.js +57 -0
- package/dist/modern/hash.d.ts +13 -0
- package/dist/modern/hash.d.ts.map +1 -0
- package/dist/modern/hash.js +45 -0
- package/dist/modern/hpke.d.ts +47 -0
- package/dist/modern/hpke.d.ts.map +1 -0
- package/dist/modern/hpke.js +207 -0
- package/dist/modern/index.d.ts +40 -0
- package/dist/modern/index.d.ts.map +1 -0
- package/dist/modern/index.js +194 -0
- package/dist/modern/kdf.d.ts +23 -0
- package/dist/modern/kdf.d.ts.map +1 -0
- package/dist/modern/kdf.js +67 -0
- package/dist/modern/mac.d.ts +51 -0
- package/dist/modern/mac.d.ts.map +1 -0
- package/dist/modern/mac.js +119 -0
- package/dist/modern/password.d.ts +40 -0
- package/dist/modern/password.d.ts.map +1 -0
- package/dist/modern/password.js +123 -0
- package/dist/modern/pq-hash-sign.d.ts +18 -0
- package/dist/modern/pq-hash-sign.d.ts.map +1 -0
- package/dist/modern/pq-hash-sign.js +73 -0
- package/dist/modern/pq-kem.d.ts +88 -0
- package/dist/modern/pq-kem.d.ts.map +1 -0
- package/dist/modern/pq-kem.js +270 -0
- package/dist/modern/pq-sign.d.ts +30 -0
- package/dist/modern/pq-sign.d.ts.map +1 -0
- package/dist/modern/pq-sign.js +94 -0
- package/dist/modern/pq.d.ts +38 -0
- package/dist/modern/pq.d.ts.map +1 -0
- package/dist/modern/pq.js +80 -0
- package/dist/modern/signing.d.ts +16 -0
- package/dist/modern/signing.d.ts.map +1 -0
- package/dist/modern/signing.js +34 -0
- package/dist/protocols/index.d.ts +7 -0
- package/dist/protocols/index.d.ts.map +1 -0
- package/dist/protocols/index.js +46 -0
- package/dist/protocols/iso20022.d.ts +51 -0
- package/dist/protocols/iso20022.d.ts.map +1 -0
- package/dist/protocols/iso20022.js +145 -0
- package/dist/protocols/opaque/ake.d.ts +51 -0
- package/dist/protocols/opaque/ake.d.ts.map +1 -0
- package/dist/protocols/opaque/ake.js +102 -0
- package/dist/protocols/opaque/client.d.ts +45 -0
- package/dist/protocols/opaque/client.d.ts.map +1 -0
- package/dist/protocols/opaque/client.js +63 -0
- package/dist/protocols/opaque/config.d.ts +14 -0
- package/dist/protocols/opaque/config.d.ts.map +1 -0
- package/dist/protocols/opaque/config.js +18 -0
- package/dist/protocols/opaque/credentials.d.ts +29 -0
- package/dist/protocols/opaque/credentials.d.ts.map +1 -0
- package/dist/protocols/opaque/credentials.js +61 -0
- package/dist/protocols/opaque/envelope.d.ts +36 -0
- package/dist/protocols/opaque/envelope.d.ts.map +1 -0
- package/dist/protocols/opaque/envelope.js +77 -0
- package/dist/protocols/opaque/ksf.d.ts +15 -0
- package/dist/protocols/opaque/ksf.d.ts.map +1 -0
- package/dist/protocols/opaque/ksf.js +27 -0
- package/dist/protocols/opaque/messages.d.ts +61 -0
- package/dist/protocols/opaque/messages.d.ts.map +1 -0
- package/dist/protocols/opaque/messages.js +94 -0
- package/dist/protocols/opaque/server.d.ts +33 -0
- package/dist/protocols/opaque/server.d.ts.map +1 -0
- package/dist/protocols/opaque/server.js +74 -0
- package/dist/protocols/opaque/suite.d.ts +58 -0
- package/dist/protocols/opaque/suite.d.ts.map +1 -0
- package/dist/protocols/opaque/suite.js +115 -0
- package/dist/protocols/pake.d.ts +14 -0
- package/dist/protocols/pake.d.ts.map +1 -0
- package/dist/protocols/pake.js +33 -0
- package/dist/protocols/pqxdh.d.ts +53 -0
- package/dist/protocols/pqxdh.d.ts.map +1 -0
- package/dist/protocols/pqxdh.js +143 -0
- package/dist/protocols/ratchet.d.ts +52 -0
- package/dist/protocols/ratchet.d.ts.map +1 -0
- package/dist/protocols/ratchet.js +187 -0
- package/dist/protocols/threshold.d.ts +23 -0
- package/dist/protocols/threshold.d.ts.map +1 -0
- package/dist/protocols/threshold.js +191 -0
- package/dist/registry.d.ts +20 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +399 -0
- package/dist/streaming/index.d.ts +7 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +15 -0
- package/dist/streaming/stream-aead.d.ts +17 -0
- package/dist/streaming/stream-aead.d.ts.map +1 -0
- package/dist/streaming/stream-aead.js +125 -0
- package/dist/streaming/stream-hash.d.ts +9 -0
- package/dist/streaming/stream-hash.d.ts.map +1 -0
- package/dist/streaming/stream-hash.js +52 -0
- package/dist/streaming/web-streams.d.ts +17 -0
- package/dist/streaming/web-streams.d.ts.map +1 -0
- package/dist/streaming/web-streams.js +114 -0
- package/dist/tokens/index.d.ts +5 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +15 -0
- package/dist/tokens/key-rotation.d.ts +20 -0
- package/dist/tokens/key-rotation.d.ts.map +1 -0
- package/dist/tokens/key-rotation.js +76 -0
- package/dist/tokens/paseto.d.ts +46 -0
- package/dist/tokens/paseto.d.ts.map +1 -0
- package/dist/tokens/paseto.js +200 -0
- package/dist/types/types.d.ts +57 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +1 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +56 -0
- package/package.json +77 -130
- package/dist/COPYRIGHT +0 -15
- package/dist/Report.txt +0 -72
- package/dist/bin/crypto-lib.d.ts +0 -13
- package/dist/bin/crypto-lib.d.ts.map +0 -1
- package/dist/bin/crypto-lib.js +0 -52
- package/dist/bin/crypto-lib.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/decrypt.js.map +0 -1
- package/dist/lib/encrypt.js.map +0 -1
- package/dist/lib/generate.js.map +0 -1
- package/dist/lib/revoke.js.map +0 -1
- package/dist/package.json +0 -131
- package/dist/types/types.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type MlDsaLevel } from "../modern/pq-sign";
|
|
2
|
+
export type Iso20022MessageType = "pacs.008" | "pain.001" | "camt.053" | "generic";
|
|
3
|
+
export type Iso20022DigestAlgorithm = "sha256" | "sha384" | "sha512";
|
|
4
|
+
export interface Iso20022DualSignatureEnvelope {
|
|
5
|
+
messageId: string;
|
|
6
|
+
messageType: Iso20022MessageType;
|
|
7
|
+
payloadDigest: string;
|
|
8
|
+
digestAlgorithm: Iso20022DigestAlgorithm;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
classical: {
|
|
11
|
+
algorithm: "ed25519";
|
|
12
|
+
signature: string;
|
|
13
|
+
publicKey: string;
|
|
14
|
+
};
|
|
15
|
+
postQuantum: {
|
|
16
|
+
algorithm: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87";
|
|
17
|
+
signature: string;
|
|
18
|
+
publicKey: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface Iso20022SignOptions {
|
|
22
|
+
messageId: string;
|
|
23
|
+
messageType?: Iso20022MessageType;
|
|
24
|
+
payload: string | Record<string, unknown>;
|
|
25
|
+
classicalKey: {
|
|
26
|
+
privateKeyHex: string;
|
|
27
|
+
publicKeyHex: string;
|
|
28
|
+
};
|
|
29
|
+
postQuantumKey: {
|
|
30
|
+
secretKeyHex: string;
|
|
31
|
+
publicKeyHex: string;
|
|
32
|
+
level?: MlDsaLevel;
|
|
33
|
+
};
|
|
34
|
+
digestAlgorithm?: Iso20022DigestAlgorithm;
|
|
35
|
+
}
|
|
36
|
+
export interface Iso20022VerifyResult {
|
|
37
|
+
valid: boolean;
|
|
38
|
+
digestMatches: boolean;
|
|
39
|
+
classicalValid: boolean;
|
|
40
|
+
postQuantumValid: boolean;
|
|
41
|
+
messageId: string;
|
|
42
|
+
}
|
|
43
|
+
export interface Iso20022TrustedKeys {
|
|
44
|
+
classicalPublicKeyHex: string;
|
|
45
|
+
postQuantumPublicKeyHex: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function canonicalizePayload(payload: string | Record<string, unknown>): string;
|
|
48
|
+
export declare function computeIso20022Digest(payload: string | Record<string, unknown>, algorithm?: Iso20022DigestAlgorithm): string;
|
|
49
|
+
export declare function signIso20022Payment(options: Iso20022SignOptions): Iso20022DualSignatureEnvelope;
|
|
50
|
+
export declare function verifyIso20022Payment(envelope: Iso20022DualSignatureEnvelope, payload: string | Record<string, unknown>, trustedKeys: Iso20022TrustedKeys): Iso20022VerifyResult;
|
|
51
|
+
//# sourceMappingURL=iso20022.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso20022.d.ts","sourceRoot":"","sources":["../../src/protocols/iso20022.ts"],"names":[],"mappings":"AAuBA,OAAO,EAA0B,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AE1B,SAAS,EAAE,MAAM,CAAC;CACnB;AASD,MAAM,WAAW,mBAAmB;IAElC,qBAAqB,EAAE,MAAM,CAAC;IAE9B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAyDD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,MAAM,CAKR;AAiBD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,SAAS,GAAE,uBAAkC,GAC5C,MAAM,CAGR;AAqBD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,mBAAmB,GAC3B,6BAA6B,CA+C/B;AAqDD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,6BAA6B,EACvC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,WAAW,EAAE,mBAAmB,GAC/B,oBAAoB,CAsCtB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canonicalizePayload = canonicalizePayload;
|
|
4
|
+
exports.computeIso20022Digest = computeIso20022Digest;
|
|
5
|
+
exports.signIso20022Payment = signIso20022Payment;
|
|
6
|
+
exports.verifyIso20022Payment = verifyIso20022Payment;
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
const signing_1 = require("../modern/signing");
|
|
9
|
+
const pq_sign_1 = require("../modern/pq-sign");
|
|
10
|
+
const serialize_1 = require("../keys/serialize");
|
|
11
|
+
const STATEMENT_DOMAIN = "crypto-service/iso20022-dual-signature/v2";
|
|
12
|
+
const ML_DSA_LEVELS = {
|
|
13
|
+
"ml-dsa-44": 44,
|
|
14
|
+
"ml-dsa-65": 65,
|
|
15
|
+
"ml-dsa-87": 87,
|
|
16
|
+
};
|
|
17
|
+
function encodeStatement(fields) {
|
|
18
|
+
const parts = [
|
|
19
|
+
STATEMENT_DOMAIN,
|
|
20
|
+
fields.messageType,
|
|
21
|
+
fields.messageId,
|
|
22
|
+
fields.digestAlgorithm,
|
|
23
|
+
fields.payloadDigest,
|
|
24
|
+
fields.timestamp,
|
|
25
|
+
fields.classicalAlgorithm,
|
|
26
|
+
fields.classicalPublicKeyHex.toLowerCase(),
|
|
27
|
+
fields.postQuantumAlgorithm,
|
|
28
|
+
fields.postQuantumPublicKeyHex.toLowerCase(),
|
|
29
|
+
];
|
|
30
|
+
const chunks = [];
|
|
31
|
+
for (const part of parts) {
|
|
32
|
+
const bytes = Buffer.from(part, "utf8");
|
|
33
|
+
const len = Buffer.alloc(4);
|
|
34
|
+
len.writeUInt32BE(bytes.length, 0);
|
|
35
|
+
chunks.push(len, bytes);
|
|
36
|
+
}
|
|
37
|
+
return Buffer.concat(chunks);
|
|
38
|
+
}
|
|
39
|
+
function canonicalizePayload(payload) {
|
|
40
|
+
if (typeof payload === "string") {
|
|
41
|
+
return payload.replace(/\r\n/g, "\n").trim();
|
|
42
|
+
}
|
|
43
|
+
return JSON.stringify(sortObjectKeys(payload));
|
|
44
|
+
}
|
|
45
|
+
function sortObjectKeys(obj) {
|
|
46
|
+
if (obj === null || typeof obj !== "object") {
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(obj)) {
|
|
50
|
+
return obj.map(sortObjectKeys);
|
|
51
|
+
}
|
|
52
|
+
const sorted = {};
|
|
53
|
+
for (const key of Object.keys(obj).sort()) {
|
|
54
|
+
sorted[key] = sortObjectKeys(obj[key]);
|
|
55
|
+
}
|
|
56
|
+
return sorted;
|
|
57
|
+
}
|
|
58
|
+
function computeIso20022Digest(payload, algorithm = "sha256") {
|
|
59
|
+
const canonical = canonicalizePayload(payload);
|
|
60
|
+
return (0, node_crypto_1.createHash)(algorithm).update(canonical, "utf8").digest("hex");
|
|
61
|
+
}
|
|
62
|
+
function signIso20022Payment(options) {
|
|
63
|
+
const digestAlgorithm = options.digestAlgorithm ?? "sha256";
|
|
64
|
+
const messageType = options.messageType ?? "generic";
|
|
65
|
+
const level = options.postQuantumKey.level ?? 65;
|
|
66
|
+
const payloadDigest = computeIso20022Digest(options.payload, digestAlgorithm);
|
|
67
|
+
const timestamp = new Date().toISOString();
|
|
68
|
+
const postQuantumAlgorithm = `ml-dsa-${level}`;
|
|
69
|
+
const statementBytes = encodeStatement({
|
|
70
|
+
messageType,
|
|
71
|
+
messageId: options.messageId,
|
|
72
|
+
digestAlgorithm,
|
|
73
|
+
payloadDigest,
|
|
74
|
+
timestamp,
|
|
75
|
+
classicalAlgorithm: "ed25519",
|
|
76
|
+
classicalPublicKeyHex: options.classicalKey.publicKeyHex,
|
|
77
|
+
postQuantumAlgorithm,
|
|
78
|
+
postQuantumPublicKeyHex: options.postQuantumKey.publicKeyHex,
|
|
79
|
+
});
|
|
80
|
+
const classicalSig = (0, signing_1.ed25519Sign)(options.classicalKey.privateKeyHex, (0, serialize_1.bytesToHex)(statementBytes));
|
|
81
|
+
const pqSig = (0, pq_sign_1.mlDsaSign)(level, options.postQuantumKey.secretKeyHex, statementBytes);
|
|
82
|
+
return {
|
|
83
|
+
messageId: options.messageId,
|
|
84
|
+
messageType,
|
|
85
|
+
payloadDigest,
|
|
86
|
+
digestAlgorithm,
|
|
87
|
+
timestamp,
|
|
88
|
+
classical: {
|
|
89
|
+
algorithm: "ed25519",
|
|
90
|
+
signature: classicalSig.signature,
|
|
91
|
+
publicKey: options.classicalKey.publicKeyHex,
|
|
92
|
+
},
|
|
93
|
+
postQuantum: {
|
|
94
|
+
algorithm: pqSig.algorithm,
|
|
95
|
+
signature: pqSig.signature,
|
|
96
|
+
publicKey: options.postQuantumKey.publicKeyHex,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function verifyClassical(publicKeyHex, statement, signatureHex) {
|
|
101
|
+
try {
|
|
102
|
+
return (0, signing_1.ed25519Verify)(publicKeyHex, (0, serialize_1.bytesToHex)(statement), signatureHex)
|
|
103
|
+
.valid;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function verifyPostQuantum(algorithm, publicKeyHex, statement, signatureHex) {
|
|
110
|
+
const level = ML_DSA_LEVELS[algorithm];
|
|
111
|
+
if (level === undefined) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
return (0, pq_sign_1.mlDsaVerify)(level, publicKeyHex, statement, signatureHex).valid;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function verifyIso20022Payment(envelope, payload, trustedKeys) {
|
|
122
|
+
const computedDigest = computeIso20022Digest(payload, envelope.digestAlgorithm);
|
|
123
|
+
const digestMatches = computedDigest === envelope.payloadDigest;
|
|
124
|
+
const statement = encodeStatement({
|
|
125
|
+
messageType: envelope.messageType,
|
|
126
|
+
messageId: envelope.messageId,
|
|
127
|
+
digestAlgorithm: envelope.digestAlgorithm,
|
|
128
|
+
payloadDigest: envelope.payloadDigest,
|
|
129
|
+
timestamp: envelope.timestamp,
|
|
130
|
+
classicalAlgorithm: envelope.classical.algorithm,
|
|
131
|
+
classicalPublicKeyHex: trustedKeys.classicalPublicKeyHex,
|
|
132
|
+
postQuantumAlgorithm: envelope.postQuantum.algorithm,
|
|
133
|
+
postQuantumPublicKeyHex: trustedKeys.postQuantumPublicKeyHex,
|
|
134
|
+
});
|
|
135
|
+
const classicalValid = verifyClassical(trustedKeys.classicalPublicKeyHex, statement, envelope.classical.signature);
|
|
136
|
+
const postQuantumValid = verifyPostQuantum(envelope.postQuantum.algorithm, trustedKeys.postQuantumPublicKeyHex, statement, envelope.postQuantum.signature);
|
|
137
|
+
return {
|
|
138
|
+
valid: digestMatches && classicalValid && postQuantumValid,
|
|
139
|
+
digestMatches,
|
|
140
|
+
classicalValid,
|
|
141
|
+
postQuantumValid,
|
|
142
|
+
messageId: envelope.messageId,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=iso20022.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CleartextCredentials } from "./envelope";
|
|
2
|
+
import type { AuthResponse, CredentialRequest, CredentialResponse, KE1, KE2, KE3 } from "./messages";
|
|
3
|
+
import type { Suite } from "./suite";
|
|
4
|
+
export interface ClientAkeState {
|
|
5
|
+
clientSecret: Uint8Array;
|
|
6
|
+
ke1: KE1;
|
|
7
|
+
}
|
|
8
|
+
export interface ServerLoginState {
|
|
9
|
+
expectedClientMac: Uint8Array;
|
|
10
|
+
sessionKey: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
export interface DerivedKeys {
|
|
13
|
+
handshakeSecret: Uint8Array;
|
|
14
|
+
km2: Uint8Array;
|
|
15
|
+
km3: Uint8Array;
|
|
16
|
+
sessionKey: Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
export declare function expandLabel(s: Suite, secret: Uint8Array, label: string, context: Uint8Array, length: number): Uint8Array;
|
|
19
|
+
export interface PreambleInput {
|
|
20
|
+
context: Uint8Array;
|
|
21
|
+
clientIdentity: Uint8Array;
|
|
22
|
+
ke1: KE1;
|
|
23
|
+
serverIdentity: Uint8Array;
|
|
24
|
+
credentialResponse: CredentialResponse;
|
|
25
|
+
serverNonce: Uint8Array;
|
|
26
|
+
serverPublicKeyshare: Uint8Array;
|
|
27
|
+
}
|
|
28
|
+
export declare function preamble(p: PreambleInput): Uint8Array;
|
|
29
|
+
export declare function deriveKeys(s: Suite, ikm: Uint8Array, transcript: Uint8Array): DerivedKeys;
|
|
30
|
+
export declare function authClientStart(s: Suite, credentialRequest: CredentialRequest, clientNonce: Uint8Array, clientKeyshareSeed: Uint8Array): ClientAkeState;
|
|
31
|
+
export interface AuthServerRespondInput {
|
|
32
|
+
context: Uint8Array;
|
|
33
|
+
cleartextCredentials: CleartextCredentials;
|
|
34
|
+
serverPrivateKey: Uint8Array;
|
|
35
|
+
clientPublicKey: Uint8Array;
|
|
36
|
+
ke1: KE1;
|
|
37
|
+
credentialResponse: CredentialResponse;
|
|
38
|
+
serverNonce: Uint8Array;
|
|
39
|
+
serverKeyshareSeed: Uint8Array;
|
|
40
|
+
}
|
|
41
|
+
export declare function authServerRespond(s: Suite, input: AuthServerRespondInput): {
|
|
42
|
+
authResponse: AuthResponse;
|
|
43
|
+
state: ServerLoginState;
|
|
44
|
+
keys: DerivedKeys;
|
|
45
|
+
};
|
|
46
|
+
export declare function authClientFinalize(s: Suite, context: Uint8Array, cc: CleartextCredentials, clientPrivateKey: Uint8Array, state: ClientAkeState, ke2: KE2): {
|
|
47
|
+
ke3: KE3;
|
|
48
|
+
sessionKey: Uint8Array;
|
|
49
|
+
};
|
|
50
|
+
export declare function authServerFinalize(state: ServerLoginState, ke3: KE3): Uint8Array;
|
|
51
|
+
//# sourceMappingURL=ake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ake.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/ake.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,GAAG,EACH,GAAG,EACH,GAAG,EACJ,MAAM,YAAY,CAAC;AAYpB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,WAAW,cAAc;IAE7B,YAAY,EAAE,UAAU,CAAC;IAEzB,GAAG,EAAE,GAAG,CAAC;CACV;AAGD,MAAM,WAAW,gBAAgB;IAE/B,iBAAiB,EAAE,UAAU,CAAC;IAE9B,UAAU,EAAE,UAAU,CAAC;CACxB;AAGD,MAAM,WAAW,WAAW;IAC1B,eAAe,EAAE,UAAU,CAAC;IAC5B,GAAG,EAAE,UAAU,CAAC;IAChB,GAAG,E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E,EAAE,oBAAoB,EACxB,gBAAgB,EAAE,UAAU,EAC5B,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,GAAG,GACP;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAyBtC;AAGD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,GAAG,GACP,UAAU,CAQZ"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expandLabel = expandLabel;
|
|
4
|
+
exports.preamble = preamble;
|
|
5
|
+
exports.deriveKeys = deriveKeys;
|
|
6
|
+
exports.authClientStart = authClientStart;
|
|
7
|
+
exports.authServerRespond = authServerRespond;
|
|
8
|
+
exports.authClientFinalize = authClientFinalize;
|
|
9
|
+
exports.authServerFinalize = authServerFinalize;
|
|
10
|
+
const errors_1 = require("../../errors");
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const messages_1 = require("./messages");
|
|
13
|
+
const suite_1 = require("./suite");
|
|
14
|
+
function expandLabel(s, secret, label, context, length) {
|
|
15
|
+
const fullLabel = (0, suite_1.utf8)("OPAQUE-" + label);
|
|
16
|
+
const customLabel = (0, suite_1.concat)((0, suite_1.i2osp)(length, 2), (0, suite_1.i2osp)(fullLabel.length, 1), fullLabel, (0, suite_1.i2osp)(context.length, 1), context);
|
|
17
|
+
return (0, suite_1.kdfExpand)(s, secret, customLabel, length);
|
|
18
|
+
}
|
|
19
|
+
function preamble(p) {
|
|
20
|
+
return (0, suite_1.concat)((0, suite_1.utf8)("OPAQUEv1-"), (0, suite_1.i2osp)(p.context.length, 2), p.context, (0, suite_1.i2osp)(p.clientIdentity.length, 2), p.clientIdentity, (0, messages_1.serializeKE1)(p.ke1), (0, suite_1.i2osp)(p.serverIdentity.length, 2), p.serverIdentity, (0, messages_1.serializeCredentialResponse)(p.credentialResponse), p.serverNonce, p.serverPublicKeyshare);
|
|
21
|
+
}
|
|
22
|
+
function deriveKeys(s, ikm, transcript) {
|
|
23
|
+
const prk = (0, suite_1.kdfExtract)(s, new Uint8Array(0), ikm);
|
|
24
|
+
const th = s.hash(transcript);
|
|
25
|
+
const handshakeSecret = expandLabel(s, prk, "HandshakeSecret", th, s.Nh);
|
|
26
|
+
const none = new Uint8Array(0);
|
|
27
|
+
return {
|
|
28
|
+
handshakeSecret,
|
|
29
|
+
sessionKey: expandLabel(s, prk, "SessionKey", th, s.Nh),
|
|
30
|
+
km2: expandLabel(s, handshakeSecret, "ServerMAC", none, s.Nh),
|
|
31
|
+
km3: expandLabel(s, handshakeSecret, "ClientMAC", none, s.Nh),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function transcriptMacs(s, keys, transcript) {
|
|
35
|
+
const serverMac = (0, suite_1.mac)(s, keys.km2, s.hash(transcript));
|
|
36
|
+
const clientMac = (0, suite_1.mac)(s, keys.km3, s.hash((0, suite_1.concat)(transcript, serverMac)));
|
|
37
|
+
return { serverMac, clientMac };
|
|
38
|
+
}
|
|
39
|
+
function authClientStart(s, credentialRequest, clientNonce, clientKeyshareSeed) {
|
|
40
|
+
const kp = (0, suite_1.deriveDiffieHellmanKeyPair)(s, clientKeyshareSeed);
|
|
41
|
+
const ke1 = {
|
|
42
|
+
credentialRequest,
|
|
43
|
+
authRequest: {
|
|
44
|
+
clientNonce: clientNonce.slice(),
|
|
45
|
+
clientPublicKeyshare: kp.publicKey,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
return { clientSecret: kp.privateKey, ke1 };
|
|
49
|
+
}
|
|
50
|
+
function authServerRespond(s, input) {
|
|
51
|
+
const kp = (0, suite_1.deriveDiffieHellmanKeyPair)(s, input.serverKeyshareSeed);
|
|
52
|
+
const cc = input.cleartextCredentials;
|
|
53
|
+
const transcript = preamble({
|
|
54
|
+
context: input.context,
|
|
55
|
+
clientIdentity: cc.clientIdentity,
|
|
56
|
+
ke1: input.ke1,
|
|
57
|
+
serverIdentity: cc.serverIdentity,
|
|
58
|
+
credentialResponse: input.credentialResponse,
|
|
59
|
+
serverNonce: input.serverNonce,
|
|
60
|
+
serverPublicKeyshare: kp.publicKey,
|
|
61
|
+
});
|
|
62
|
+
const clientKeyshare = input.ke1.authRequest.clientPublicKeyshare;
|
|
63
|
+
const ikm = (0, suite_1.concat)((0, suite_1.diffieHellman)(s, kp.privateKey, clientKeyshare), (0, suite_1.diffieHellman)(s, input.serverPrivateKey, clientKeyshare), (0, suite_1.diffieHellman)(s, kp.privateKey, input.clientPublicKey));
|
|
64
|
+
const keys = deriveKeys(s, ikm, transcript);
|
|
65
|
+
const { serverMac, clientMac } = transcriptMacs(s, keys, transcript);
|
|
66
|
+
const authResponse = {
|
|
67
|
+
serverNonce: input.serverNonce.slice(),
|
|
68
|
+
serverPublicKeyshare: kp.publicKey,
|
|
69
|
+
serverMac,
|
|
70
|
+
};
|
|
71
|
+
const state = {
|
|
72
|
+
expectedClientMac: clientMac,
|
|
73
|
+
sessionKey: keys.sessionKey,
|
|
74
|
+
};
|
|
75
|
+
return { authResponse, state, keys };
|
|
76
|
+
}
|
|
77
|
+
function authClientFinalize(s, context, cc, clientPrivateKey, state, ke2) {
|
|
78
|
+
const serverKeyshare = ke2.authResponse.serverPublicKeyshare;
|
|
79
|
+
const ikm = (0, suite_1.concat)((0, suite_1.diffieHellman)(s, state.clientSecret, serverKeyshare), (0, suite_1.diffieHellman)(s, state.clientSecret, cc.serverPublicKey), (0, suite_1.diffieHellman)(s, clientPrivateKey, serverKeyshare));
|
|
80
|
+
const transcript = preamble({
|
|
81
|
+
context,
|
|
82
|
+
clientIdentity: cc.clientIdentity,
|
|
83
|
+
ke1: state.ke1,
|
|
84
|
+
serverIdentity: cc.serverIdentity,
|
|
85
|
+
credentialResponse: ke2.credentialResponse,
|
|
86
|
+
serverNonce: ke2.authResponse.serverNonce,
|
|
87
|
+
serverPublicKeyshare: serverKeyshare,
|
|
88
|
+
});
|
|
89
|
+
const keys = deriveKeys(s, ikm, transcript);
|
|
90
|
+
const { serverMac, clientMac } = transcriptMacs(s, keys, transcript);
|
|
91
|
+
if (!(0, utils_1.timingSafeEqual)(ke2.authResponse.serverMac, serverMac)) {
|
|
92
|
+
throw new errors_1.CryptoError("OPAQUE server authentication failed: invalid server MAC", suite_1.OpaqueErrorCode.SERVER_AUTHENTICATION);
|
|
93
|
+
}
|
|
94
|
+
return { ke3: { clientMac }, sessionKey: keys.sessionKey };
|
|
95
|
+
}
|
|
96
|
+
function authServerFinalize(state, ke3) {
|
|
97
|
+
if (!(0, utils_1.timingSafeEqual)(ke3.clientMac, state.expectedClientMac)) {
|
|
98
|
+
throw new errors_1.CryptoError("OPAQUE client authentication failed: invalid client MAC", suite_1.OpaqueErrorCode.CLIENT_AUTHENTICATION);
|
|
99
|
+
}
|
|
100
|
+
return state.sessionKey.slice();
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=ake.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { OpaqueConfig } from "./config";
|
|
2
|
+
import type { Identities } from "./envelope";
|
|
3
|
+
import type { KE1, KE2, KE3, RegistrationRecord, RegistrationRequest, RegistrationResponse } from "./messages";
|
|
4
|
+
export interface ClientLoginState {
|
|
5
|
+
config: OpaqueConfig;
|
|
6
|
+
password: Uint8Array;
|
|
7
|
+
blind: Uint8Array;
|
|
8
|
+
clientSecret: Uint8Array;
|
|
9
|
+
ke1: KE1;
|
|
10
|
+
}
|
|
11
|
+
export interface KE1Randomness {
|
|
12
|
+
blind?: Uint8Array;
|
|
13
|
+
clientNonce?: Uint8Array;
|
|
14
|
+
clientKeyshareSeed?: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
export declare function createRegistrationRequestWith(password: Uint8Array | string, config: OpaqueConfig, blind?: Uint8Array): {
|
|
17
|
+
request: RegistrationRequest;
|
|
18
|
+
blind: Uint8Array;
|
|
19
|
+
};
|
|
20
|
+
export declare function createRegistrationRequest(password: Uint8Array | string, config?: OpaqueConfig): {
|
|
21
|
+
request: RegistrationRequest;
|
|
22
|
+
blind: Uint8Array;
|
|
23
|
+
};
|
|
24
|
+
export declare function finalizeRegistrationRequestWith(password: Uint8Array | string, blind: Uint8Array, response: RegistrationResponse, identities: Identities, config: OpaqueConfig, envelopeNonce?: Uint8Array): {
|
|
25
|
+
record: RegistrationRecord;
|
|
26
|
+
exportKey: Uint8Array;
|
|
27
|
+
};
|
|
28
|
+
export declare function finalizeRegistrationRequest(password: Uint8Array | string, blind: Uint8Array, response: RegistrationResponse, identities?: Identities, config?: OpaqueConfig): {
|
|
29
|
+
record: RegistrationRecord;
|
|
30
|
+
exportKey: Uint8Array;
|
|
31
|
+
};
|
|
32
|
+
export declare function generateKE1With(password: Uint8Array | string, config: OpaqueConfig, r: KE1Randomness): {
|
|
33
|
+
ke1: KE1;
|
|
34
|
+
state: ClientLoginState;
|
|
35
|
+
};
|
|
36
|
+
export declare function generateKE1(password: Uint8Array | string, config?: OpaqueConfig): {
|
|
37
|
+
ke1: KE1;
|
|
38
|
+
state: ClientLoginState;
|
|
39
|
+
};
|
|
40
|
+
export declare function generateKE3(state: ClientLoginState, ke2: KE2, identities?: Identities): {
|
|
41
|
+
ke3: KE3;
|
|
42
|
+
sessionKey: Uint8Array;
|
|
43
|
+
exportKey: Uint8Array;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/client.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAO7C,OAAO,KAAK,EACV,GAAG,EACH,GAAG,EACH,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIp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C7B,QAAQ,EAAE,UAAU,GAAG,MAAM,EAC7B,MAAM,EAAE,YAAY,EACpB,CAAC,EAAE,aAAa,GACf;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAkBvC;AASD,wBAAgB,WAAW,CACzB,QAAQ,EAAE,UAAU,GAAG,MAAM,EAC7B,MAAM,GAAE,YAAiB,GACxB;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAEvC;AAgBD,wBAAgB,WAAW,CACzB,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,GAAG,EACR,UAAU,GAAE,UAAe,GAC1B;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,CAoB7D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRegistrationRequestWith = createRegistrationRequestWith;
|
|
4
|
+
exports.createRegistrationRequest = createRegistrationRequest;
|
|
5
|
+
exports.finalizeRegistrationRequestWith = finalizeRegistrationRequestWith;
|
|
6
|
+
exports.finalizeRegistrationRequest = finalizeRegistrationRequest;
|
|
7
|
+
exports.generateKE1With = generateKE1With;
|
|
8
|
+
exports.generateKE1 = generateKE1;
|
|
9
|
+
exports.generateKE3 = generateKE3;
|
|
10
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
11
|
+
const ake_1 = require("./ake");
|
|
12
|
+
const config_1 = require("./config");
|
|
13
|
+
const credentials_1 = require("./credentials");
|
|
14
|
+
const envelope_1 = require("./envelope");
|
|
15
|
+
const messages_1 = require("./messages");
|
|
16
|
+
const suite_1 = require("./suite");
|
|
17
|
+
function createRegistrationRequestWith(password, config, blind) {
|
|
18
|
+
const { s } = (0, config_1.resolveConfig)(config);
|
|
19
|
+
const r = (0, credentials_1.blindPassword)(s, (0, suite_1.toBytes)(password), blind);
|
|
20
|
+
return { request: { blindedMessage: r.blindedMessage }, blind: r.blind };
|
|
21
|
+
}
|
|
22
|
+
function createRegistrationRequest(password, config = {}) {
|
|
23
|
+
return createRegistrationRequestWith(password, config);
|
|
24
|
+
}
|
|
25
|
+
function finalizeRegistrationRequestWith(password, blind, response, identities, config, envelopeNonce = (0, utils_js_1.randomBytes)(suite_1.Nn)) {
|
|
26
|
+
const { s, ksf } = (0, config_1.resolveConfig)(config);
|
|
27
|
+
const res = (0, messages_1.deserializeRegistrationResponse)((0, messages_1.serializeRegistrationResponse)(response), s.id);
|
|
28
|
+
const { randomizedPassword } = (0, credentials_1.finalizeOprf)(s, ksf, (0, suite_1.toBytes)(password), blind, res.evaluatedMessage);
|
|
29
|
+
const stored = (0, envelope_1.store)(s, randomizedPassword, res.serverPublicKey, identities, envelopeNonce);
|
|
30
|
+
const { clientPublicKey, maskingKey, envelope } = stored;
|
|
31
|
+
return {
|
|
32
|
+
record: { clientPublicKey, maskingKey, envelope },
|
|
33
|
+
exportKey: stored.exportKey,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function finalizeRegistrationRequest(password, blind, response, identities = {}, config = {}) {
|
|
37
|
+
return finalizeRegistrationRequestWith(password, blind, response, identities, config);
|
|
38
|
+
}
|
|
39
|
+
function generateKE1With(password, config, r) {
|
|
40
|
+
const { s } = (0, config_1.resolveConfig)(config);
|
|
41
|
+
const pw = (0, suite_1.toBytes)(password);
|
|
42
|
+
const blinded = (0, credentials_1.blindPassword)(s, pw, r.blind);
|
|
43
|
+
const ake = (0, ake_1.authClientStart)(s, { blindedMessage: blinded.blindedMessage }, r.clientNonce ?? (0, utils_js_1.randomBytes)(suite_1.Nn), r.clientKeyshareSeed ?? (0, utils_js_1.randomBytes)(suite_1.Nseed));
|
|
44
|
+
const state = {
|
|
45
|
+
config,
|
|
46
|
+
password: pw,
|
|
47
|
+
blind: blinded.blind,
|
|
48
|
+
clientSecret: ake.clientSecret,
|
|
49
|
+
ke1: ake.ke1,
|
|
50
|
+
};
|
|
51
|
+
return { ke1: ake.ke1, state };
|
|
52
|
+
}
|
|
53
|
+
function generateKE1(password, config = {}) {
|
|
54
|
+
return generateKE1With(password, config, {});
|
|
55
|
+
}
|
|
56
|
+
function generateKE3(state, ke2, identities = {}) {
|
|
57
|
+
const { s, ksf, context } = (0, config_1.resolveConfig)(state.config);
|
|
58
|
+
const k = (0, messages_1.deserializeKE2)((0, messages_1.serializeKE2)(ke2), s.id);
|
|
59
|
+
const recovered = (0, credentials_1.recoverCredentials)(s, ksf, state.password, state.blind, k.credentialResponse, identities);
|
|
60
|
+
const { ke3, sessionKey } = (0, ake_1.authClientFinalize)(s, context, recovered.cleartextCredentials, recovered.clientPrivateKey, state, k);
|
|
61
|
+
return { ke3, sessionKey, exportKey: recovered.exportKey };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Ksf } from "./ksf";
|
|
2
|
+
import type { Suite, SuiteId } from "./suite";
|
|
3
|
+
export interface OpaqueConfig {
|
|
4
|
+
suite?: SuiteId;
|
|
5
|
+
ksf?: Ksf;
|
|
6
|
+
context?: Uint8Array | string;
|
|
7
|
+
}
|
|
8
|
+
export interface ResolvedConfig {
|
|
9
|
+
s: Suite;
|
|
10
|
+
ksf: Ksf;
|
|
11
|
+
context: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveConfig(config: OpaqueConfig): ResolvedConfig;
|
|
14
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/config.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,WAAW,YAAY;IAE3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAKhB,GAAG,CAAC,EAAE,GAAG,CAAC;IAMV,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAC/B;AAGD,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,KAAK,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,UAAU,CAAC;CACrB;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAalE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveConfig = resolveConfig;
|
|
4
|
+
const errors_1 = require("../../errors");
|
|
5
|
+
const ksf_1 = require("./ksf");
|
|
6
|
+
const suite_1 = require("./suite");
|
|
7
|
+
function resolveConfig(config) {
|
|
8
|
+
const context = (0, suite_1.toBytes)(config.context ?? new Uint8Array(0));
|
|
9
|
+
if (context.length > 0xffff) {
|
|
10
|
+
throw new errors_1.CryptoError("OPAQUE context must be at most 65535 bytes", suite_1.OpaqueErrorCode.INVALID_INPUT);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
s: (0, suite_1.getSuite)(config.suite ?? "P256-SHA256"),
|
|
14
|
+
ksf: config.ksf ?? ksf_1.DEFAULT_KSF,
|
|
15
|
+
context,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Ksf } from "./ksf";
|
|
2
|
+
import type { Identities } from "./envelope";
|
|
3
|
+
import type { CredentialRequest, CredentialResponse, RegistrationRecord } from "./messages";
|
|
4
|
+
import type { Suite } from "./suite";
|
|
5
|
+
export declare function deriveOprfKey(s: Suite, oprfSeed: Uint8Array, credentialIdentifier: Uint8Array | string): Uint8Array;
|
|
6
|
+
export declare function blindPassword(s: Suite, password: Uint8Array, blind?: Uint8Array): {
|
|
7
|
+
blind: Uint8Array;
|
|
8
|
+
blindedMessage: Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
export declare function evaluateOprf(s: Suite, oprfSeed: Uint8Array, credentialIdentifier: Uint8Array | string, blindedMessage: Uint8Array): Uint8Array;
|
|
11
|
+
export declare function finalizeOprf(s: Suite, ksf: Ksf, password: Uint8Array, blind: Uint8Array, evaluatedMessage: Uint8Array): {
|
|
12
|
+
oprfOutput: import("@noble/curves/abstract/oprf").Bytes & Uint8Array<ArrayBuffer>;
|
|
13
|
+
randomizedPassword: Uint8Array<ArrayBufferLike>;
|
|
14
|
+
};
|
|
15
|
+
export interface CredentialResponseInput {
|
|
16
|
+
request: CredentialRequest;
|
|
17
|
+
serverPublicKey: Uint8Array;
|
|
18
|
+
record: RegistrationRecord;
|
|
19
|
+
credentialIdentifier: Uint8Array | string;
|
|
20
|
+
oprfSeed: Uint8Array;
|
|
21
|
+
maskingNonce: Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
export declare function createCredentialResponse(s: Suite, input: CredentialResponseInput): CredentialResponse;
|
|
24
|
+
export declare function recoverCredentials(s: Suite, ksf: Ksf, password: Uint8Array, blind: Uint8Array, response: CredentialResponse, ids: Identities): {
|
|
25
|
+
clientPrivateKey: import("@noble/curves/abstract/oprf").ScalarBytes & Uint8Array<ArrayBuffer>;
|
|
26
|
+
cleartextCredentials: import("./envelope").CleartextCredentials;
|
|
27
|
+
exportKey: Uint8Array<ArrayBufferLike>;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/credentials.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,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,EAAE,UAAU;;;;EAkBhB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveOprfKey = deriveOprfKey;
|
|
4
|
+
exports.blindPassword = blindPassword;
|
|
5
|
+
exports.evaluateOprf = evaluateOprf;
|
|
6
|
+
exports.finalizeOprf = finalizeOprf;
|
|
7
|
+
exports.createCredentialResponse = createCredentialResponse;
|
|
8
|
+
exports.recoverCredentials = recoverCredentials;
|
|
9
|
+
const envelope_1 = require("./envelope");
|
|
10
|
+
const messages_1 = require("./messages");
|
|
11
|
+
const suite_1 = require("./suite");
|
|
12
|
+
function deriveOprfKey(s, oprfSeed, credentialIdentifier) {
|
|
13
|
+
const info = (0, suite_1.concat)((0, suite_1.toBytes)(credentialIdentifier), (0, suite_1.utf8)("OprfKey"));
|
|
14
|
+
const seed = (0, suite_1.kdfExpand)(s, oprfSeed, info, s.Nok);
|
|
15
|
+
return s.oprf.deriveKeyPair(seed, (0, suite_1.utf8)("OPAQUE-DeriveKeyPair")).secretKey;
|
|
16
|
+
}
|
|
17
|
+
function blindPassword(s, password, blind) {
|
|
18
|
+
if (blind !== undefined) {
|
|
19
|
+
return { blind, blindedMessage: (0, suite_1.blindWith)(s, password, blind) };
|
|
20
|
+
}
|
|
21
|
+
const r = s.oprf.blind(password);
|
|
22
|
+
return { blind: r.blind, blindedMessage: r.blinded };
|
|
23
|
+
}
|
|
24
|
+
function evaluateOprf(s, oprfSeed, credentialIdentifier, blindedMessage) {
|
|
25
|
+
const key = deriveOprfKey(s, oprfSeed, credentialIdentifier);
|
|
26
|
+
return s.oprf.blindEvaluate(key, blindedMessage);
|
|
27
|
+
}
|
|
28
|
+
function finalizeOprf(s, ksf, password, blind, evaluatedMessage) {
|
|
29
|
+
const oprfOutput = s.oprf.finalize(password, blind, evaluatedMessage);
|
|
30
|
+
return {
|
|
31
|
+
oprfOutput,
|
|
32
|
+
randomizedPassword: (0, envelope_1.randomizePassword)(s, ksf, oprfOutput),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function responsePad(s, maskingKey, nonce) {
|
|
36
|
+
const info = (0, suite_1.concat)(nonce, (0, suite_1.utf8)("CredentialResponsePad"));
|
|
37
|
+
return (0, suite_1.kdfExpand)(s, maskingKey, info, (0, messages_1.maskedResponseLength)(s));
|
|
38
|
+
}
|
|
39
|
+
function createCredentialResponse(s, input) {
|
|
40
|
+
const evaluatedMessage = evaluateOprf(s, input.oprfSeed, input.credentialIdentifier, input.request.blindedMessage);
|
|
41
|
+
const pad = responsePad(s, input.record.maskingKey, input.maskingNonce);
|
|
42
|
+
const plain = (0, suite_1.concat)(input.serverPublicKey, (0, messages_1.serializeEnvelope)(input.record.envelope));
|
|
43
|
+
return {
|
|
44
|
+
evaluatedMessage,
|
|
45
|
+
maskingNonce: input.maskingNonce.slice(),
|
|
46
|
+
maskedResponse: (0, suite_1.xor)(pad, plain),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function recoverCredentials(s, ksf, password, blind, response, ids) {
|
|
50
|
+
const { randomizedPassword } = finalizeOprf(s, ksf, password, blind, response.evaluatedMessage);
|
|
51
|
+
const maskingKey = (0, envelope_1.maskingKeyFor)(s, randomizedPassword);
|
|
52
|
+
const pad = responsePad(s, maskingKey, response.maskingNonce);
|
|
53
|
+
const plain = (0, suite_1.xor)(pad, response.maskedResponse);
|
|
54
|
+
const serverPublicKey = plain.slice(0, s.Npk);
|
|
55
|
+
const envelope = {
|
|
56
|
+
nonce: plain.slice(s.Npk, s.Npk + suite_1.Nn),
|
|
57
|
+
authTag: plain.slice(s.Npk + suite_1.Nn),
|
|
58
|
+
};
|
|
59
|
+
return (0, envelope_1.recover)(s, randomizedPassword, serverPublicKey, envelope, ids);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Ksf } from "./ksf";
|
|
2
|
+
import type { Envelope } from "./messages";
|
|
3
|
+
import type { Suite } from "./suite";
|
|
4
|
+
export interface Identities {
|
|
5
|
+
clientIdentity?: Uint8Array | string;
|
|
6
|
+
serverIdentity?: Uint8Array | string;
|
|
7
|
+
}
|
|
8
|
+
export interface CleartextCredentials {
|
|
9
|
+
serverPublicKey: Uint8Array;
|
|
10
|
+
serverIdentity: Uint8Array;
|
|
11
|
+
clientIdentity: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export declare function createCleartextCredentials(serverPublicKey: Uint8Array, clientPublicKey: Uint8Array, ids: Identities): CleartextCredentials;
|
|
14
|
+
export declare function serializeCleartextCredentials(cc: CleartextCredentials): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
15
|
+
export declare function randomizePassword(s: Suite, ksf: Ksf, oprfOutput: Uint8Array): Uint8Array;
|
|
16
|
+
export declare function maskingKeyFor(s: Suite, randomizedPassword: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
17
|
+
export declare function envelopeKeys(s: Suite, randomizedPassword: Uint8Array, nonce: Uint8Array): {
|
|
18
|
+
authKey: Uint8Array<ArrayBufferLike>;
|
|
19
|
+
exportKey: Uint8Array<ArrayBufferLike>;
|
|
20
|
+
keyPair: {
|
|
21
|
+
privateKey: import("@noble/curves/abstract/oprf").ScalarBytes & Uint8Array<ArrayBuffer>;
|
|
22
|
+
publicKey: import("@noble/curves/abstract/oprf").PointBytes & Uint8Array<ArrayBuffer>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function store(s: Suite, randomizedPassword: Uint8Array, serverPublicKey: Uint8Array, ids: Identities, nonce: Uint8Array): {
|
|
26
|
+
envelope: Envelope;
|
|
27
|
+
clientPublicKey: import("@noble/curves/abstract/oprf").PointBytes & Uint8Array<ArrayBuffer>;
|
|
28
|
+
maskingKey: Uint8Array<ArrayBufferLike>;
|
|
29
|
+
exportKey: Uint8Array<ArrayBufferLike>;
|
|
30
|
+
};
|
|
31
|
+
export declare function recover(s: Suite, randomizedPassword: Uint8Array, serverPublicKey: Uint8Array, envelope: Envelope, ids: Identities): {
|
|
32
|
+
clientPrivateKey: import("@noble/curves/abstract/oprf").ScalarBytes & Uint8Array<ArrayBuffer>;
|
|
33
|
+
cleartextCredentials: CleartextCredentials;
|
|
34
|
+
exportKey: Uint8Array<ArrayBufferLike>;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/envelope.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAa3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,WAAW,UAAU;IAEzB,cAAc,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAErC,cAAc,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CACtC;AAGD,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,UAAU,CAAC;IAC5B,cAAc,EAAE,UAAU,CAAC;IAC3B,cAAc,EAAE,UAAU,CAAC;CAC5B;AAmBD,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,UAAU,EAC3B,eAAe,EAAE,UAAU,EAC3B,GAAG,EAAE,UAAU,GACd,oBAAoB,CAMtB;AAGD,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,oBAAoB,yDAQrE;AAOD,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,KAAK,EACR,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,GACrB,UAAU,CAGZ;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,UAAU,+BAErE;AAGD,wBAAgB,YAAY,CAC1B,CAAC,EAAE,KAAK,EACR,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