@sebastienrousseau/crypto-lib 0.0.2 → 0.0.7
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,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCleartextCredentials = createCleartextCredentials;
|
|
4
|
+
exports.serializeCleartextCredentials = serializeCleartextCredentials;
|
|
5
|
+
exports.randomizePassword = randomizePassword;
|
|
6
|
+
exports.maskingKeyFor = maskingKeyFor;
|
|
7
|
+
exports.envelopeKeys = envelopeKeys;
|
|
8
|
+
exports.store = store;
|
|
9
|
+
exports.recover = recover;
|
|
10
|
+
const errors_1 = require("../../errors");
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const suite_1 = require("./suite");
|
|
13
|
+
function identityOr(value, fallback) {
|
|
14
|
+
if (value === undefined)
|
|
15
|
+
return fallback;
|
|
16
|
+
const bytes = (0, suite_1.toBytes)(value);
|
|
17
|
+
if (bytes.length < 1 || bytes.length > 0xffff) {
|
|
18
|
+
throw new errors_1.CryptoError("OPAQUE identities must be 1 to 65535 bytes", suite_1.OpaqueErrorCode.INVALID_INPUT);
|
|
19
|
+
}
|
|
20
|
+
return bytes;
|
|
21
|
+
}
|
|
22
|
+
function createCleartextCredentials(serverPublicKey, clientPublicKey, ids) {
|
|
23
|
+
return {
|
|
24
|
+
serverPublicKey,
|
|
25
|
+
serverIdentity: identityOr(ids.serverIdentity, serverPublicKey),
|
|
26
|
+
clientIdentity: identityOr(ids.clientIdentity, clientPublicKey),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function serializeCleartextCredentials(cc) {
|
|
30
|
+
return (0, suite_1.concat)(cc.serverPublicKey, (0, suite_1.i2osp)(cc.serverIdentity.length, 2), cc.serverIdentity, (0, suite_1.i2osp)(cc.clientIdentity.length, 2), cc.clientIdentity);
|
|
31
|
+
}
|
|
32
|
+
function randomizePassword(s, ksf, oprfOutput) {
|
|
33
|
+
const stretched = ksf.stretch(oprfOutput);
|
|
34
|
+
return (0, suite_1.kdfExtract)(s, new Uint8Array(0), (0, suite_1.concat)(oprfOutput, stretched));
|
|
35
|
+
}
|
|
36
|
+
function maskingKeyFor(s, randomizedPassword) {
|
|
37
|
+
return (0, suite_1.kdfExpand)(s, randomizedPassword, (0, suite_1.utf8)("MaskingKey"), s.Nh);
|
|
38
|
+
}
|
|
39
|
+
function envelopeKeys(s, randomizedPassword, nonce) {
|
|
40
|
+
const derive = (label, length) => (0, suite_1.kdfExpand)(s, randomizedPassword, (0, suite_1.concat)(nonce, (0, suite_1.utf8)(label)), length);
|
|
41
|
+
return {
|
|
42
|
+
authKey: derive("AuthKey", s.Nh),
|
|
43
|
+
exportKey: derive("ExportKey", s.Nh),
|
|
44
|
+
keyPair: (0, suite_1.deriveDiffieHellmanKeyPair)(s, derive("PrivateKey", suite_1.Nseed)),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function authTag(s, authKey, nonce, cc) {
|
|
48
|
+
return (0, suite_1.mac)(s, authKey, (0, suite_1.concat)(nonce, serializeCleartextCredentials(cc)));
|
|
49
|
+
}
|
|
50
|
+
function store(s, randomizedPassword, serverPublicKey, ids, nonce) {
|
|
51
|
+
const { authKey, exportKey, keyPair } = envelopeKeys(s, randomizedPassword, nonce);
|
|
52
|
+
const cc = createCleartextCredentials(serverPublicKey, keyPair.publicKey, ids);
|
|
53
|
+
const envelope = {
|
|
54
|
+
nonce: nonce.slice(),
|
|
55
|
+
authTag: authTag(s, authKey, nonce, cc),
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
envelope,
|
|
59
|
+
clientPublicKey: keyPair.publicKey,
|
|
60
|
+
maskingKey: maskingKeyFor(s, randomizedPassword),
|
|
61
|
+
exportKey,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function recover(s, randomizedPassword, serverPublicKey, envelope, ids) {
|
|
65
|
+
const { authKey, exportKey, keyPair } = envelopeKeys(s, randomizedPassword, envelope.nonce);
|
|
66
|
+
const cc = createCleartextCredentials(serverPublicKey, keyPair.publicKey, ids);
|
|
67
|
+
const expected = authTag(s, authKey, envelope.nonce, cc);
|
|
68
|
+
if (!(0, utils_1.timingSafeEqual)(envelope.authTag, expected)) {
|
|
69
|
+
throw new errors_1.CryptoError("OPAQUE envelope recovery failed: wrong password or invalid response", suite_1.OpaqueErrorCode.ENVELOPE_RECOVERY);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
clientPrivateKey: keyPair.privateKey,
|
|
73
|
+
cleartextCredentials: cc,
|
|
74
|
+
exportKey,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Ksf {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
stretch(msg: Uint8Array): Uint8Array;
|
|
4
|
+
}
|
|
5
|
+
export interface ScryptKsfParams {
|
|
6
|
+
N: number;
|
|
7
|
+
r: number;
|
|
8
|
+
p: number;
|
|
9
|
+
dkLen: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const RFC9807_SCRYPT_PARAMS: Readonly<ScryptKsfParams>;
|
|
12
|
+
export declare function scryptKsf(params?: Partial<ScryptKsfParams>): Ksf;
|
|
13
|
+
export declare const identityKsf: Ksf;
|
|
14
|
+
export declare const DEFAULT_KSF: Ksf;
|
|
15
|
+
//# sourceMappingURL=ksf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ksf.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/ksf.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,GAAG;IAElB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AAGD,MAAM,WAAW,eAAe;IAE9B,CAAC,EAAE,MAAM,CAAC;IAEV,CAAC,EAAE,MAAM,CAAC;IAEV,CAAC,EAAE,MAAM,CAAC;IAEV,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,eAAe,CAK1D,CAAC;AASH,wBAAgB,SAAS,CAAC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,GAAG,GAAG,CAQpE;AAQD,eAAO,MAAM,WAAW,EAAE,GAGxB,CAAC;AAGH,eAAO,MAAM,WAAW,EAAE,GAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_KSF = exports.identityKsf = exports.RFC9807_SCRYPT_PARAMS = void 0;
|
|
4
|
+
exports.scryptKsf = scryptKsf;
|
|
5
|
+
const scrypt_js_1 = require("@noble/hashes/scrypt.js");
|
|
6
|
+
const cost_limits_1 = require("../../modern/cost-limits");
|
|
7
|
+
exports.RFC9807_SCRYPT_PARAMS = Object.freeze({
|
|
8
|
+
N: 32768,
|
|
9
|
+
r: 8,
|
|
10
|
+
p: 1,
|
|
11
|
+
dkLen: 32,
|
|
12
|
+
});
|
|
13
|
+
function scryptKsf(params = {}) {
|
|
14
|
+
const { N, r, p, dkLen } = { ...exports.RFC9807_SCRYPT_PARAMS, ...params };
|
|
15
|
+
(0, cost_limits_1.checkScryptCosts)(N, r, p);
|
|
16
|
+
const salt = new Uint8Array(16);
|
|
17
|
+
return Object.freeze({
|
|
18
|
+
name: `scrypt(N=${N},r=${r},p=${p},dkLen=${dkLen})`,
|
|
19
|
+
stretch: (msg) => (0, scrypt_js_1.scrypt)(msg, salt, { N, r, p, dkLen }),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.identityKsf = Object.freeze({
|
|
23
|
+
name: "Identity",
|
|
24
|
+
stretch: (msg) => msg.slice(),
|
|
25
|
+
});
|
|
26
|
+
exports.DEFAULT_KSF = scryptKsf();
|
|
27
|
+
//# sourceMappingURL=ksf.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Suite, SuiteId } from "./suite";
|
|
2
|
+
export interface RegistrationRequest {
|
|
3
|
+
blindedMessage: Uint8Array;
|
|
4
|
+
}
|
|
5
|
+
export interface RegistrationResponse {
|
|
6
|
+
evaluatedMessage: Uint8Array;
|
|
7
|
+
serverPublicKey: Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
export interface Envelope {
|
|
10
|
+
nonce: Uint8Array;
|
|
11
|
+
authTag: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export interface RegistrationRecord {
|
|
14
|
+
clientPublicKey: Uint8Array;
|
|
15
|
+
maskingKey: Uint8Array;
|
|
16
|
+
envelope: Envelope;
|
|
17
|
+
}
|
|
18
|
+
export interface CredentialRequest {
|
|
19
|
+
blindedMessage: Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
export interface CredentialResponse {
|
|
22
|
+
evaluatedMessage: Uint8Array;
|
|
23
|
+
maskingNonce: Uint8Array;
|
|
24
|
+
maskedResponse: Uint8Array;
|
|
25
|
+
}
|
|
26
|
+
export interface AuthRequest {
|
|
27
|
+
clientNonce: Uint8Array;
|
|
28
|
+
clientPublicKeyshare: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export interface KE1 {
|
|
31
|
+
credentialRequest: CredentialRequest;
|
|
32
|
+
authRequest: AuthRequest;
|
|
33
|
+
}
|
|
34
|
+
export interface AuthResponse {
|
|
35
|
+
serverNonce: Uint8Array;
|
|
36
|
+
serverPublicKeyshare: Uint8Array;
|
|
37
|
+
serverMac: Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
export interface KE2 {
|
|
40
|
+
credentialResponse: CredentialResponse;
|
|
41
|
+
authResponse: AuthResponse;
|
|
42
|
+
}
|
|
43
|
+
export interface KE3 {
|
|
44
|
+
clientMac: Uint8Array;
|
|
45
|
+
}
|
|
46
|
+
export declare function maskedResponseLength(s: Suite): number;
|
|
47
|
+
export declare function serializeEnvelope(e: Envelope): Uint8Array;
|
|
48
|
+
export declare function serializeCredentialResponse(r: CredentialResponse): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
49
|
+
export declare function serializeRegistrationRequest(m: RegistrationRequest): Uint8Array<ArrayBuffer>;
|
|
50
|
+
export declare function deserializeRegistrationRequest(bytes: Uint8Array, suite?: SuiteId): RegistrationRequest;
|
|
51
|
+
export declare function serializeRegistrationResponse(m: RegistrationResponse): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
52
|
+
export declare function deserializeRegistrationResponse(bytes: Uint8Array, suite?: SuiteId): RegistrationResponse;
|
|
53
|
+
export declare function serializeRegistrationRecord(m: RegistrationRecord): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
54
|
+
export declare function deserializeRegistrationRecord(bytes: Uint8Array, suite?: SuiteId): RegistrationRecord;
|
|
55
|
+
export declare function serializeKE1(m: KE1): Uint8Array;
|
|
56
|
+
export declare function deserializeKE1(bytes: Uint8Array, suite?: SuiteId): KE1;
|
|
57
|
+
export declare function serializeKE2(m: KE2): Uint8Array;
|
|
58
|
+
export declare function deserializeKE2(bytes: Uint8Array, suite?: SuiteId): KE2;
|
|
59
|
+
export declare function serializeKE3(m: KE3): Uint8Array;
|
|
60
|
+
export declare function deserializeKE3(bytes: Uint8Array, suite?: SuiteId): KE3;
|
|
61
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/messages.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,WAAW,mBAAmB;IAElC,cAAc,EAAE,UAAU,CAAC;CAC5B;AAGD,MAAM,WAAW,oBAAoB;IAEnC,gBAAgB,EAAE,UAAU,CAAC;IAE7B,eAAe,EAAE,UAAU,CAAC;CAC7B;AAGD,MAAM,WAAW,QAAQ;IAEvB,KAAK,EAAE,UAAU,CAAC;IAElB,OAAO,EAAE,UAAU,CAAC;CACrB;AAQD,MAAM,WAAW,kBAAkB;IAEjC,eAAe,EAAE,UAAU,CAAC;IAE5B,UAAU,EAAE,UAAU,CAAC;IAEvB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAGD,MAAM,WAAW,iBAAiB;IAEhC,cAAc,EAAE,UAAU,CAAC;CAC5B;AAGD,MAAM,WAAW,kBAAkB;IAEjC,gBAAgB,EAAE,UAAU,CAAC;IAE7B,YAAY,EAAE,UAAU,CAAC;IAEzB,cAAc,EAAE,UAAU,CAAC;CAC5B;AAGD,MAAM,WAAW,WAAW;IAE1B,WAAW,EAAE,UAAU,CAAC;IAExB,oBAAoB,EAAE,UAAU,CAAC;CAClC;AAGD,MAAM,WAAW,GAAG;IAElB,iBAAiB,EAAE,iBAAiB,CAAC;IAErC,WAAW,EAAE,WAAW,CAAC;CAC1B;AAGD,MAAM,WAAW,YAAY;IAE3B,WAAW,EAAE,UAAU,CAAC;IAExB,oBAAoB,EAAE,UAAU,CAAC;IAEjC,SAAS,EAAE,UAAU,CAAC;CACvB;AAGD,MAAM,WAAW,GAAG;IAElB,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,YAAY,EAAE,YAAY,CAAC;CAC5B;AAGD,MAAM,WAAW,GAAG;IAElB,SAAS,EAAE,UAAU,CAAC;CACvB;AAgBD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CAErD;AAGD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,GAAG,UAAU,CAEzD;AAGD,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,kBAAkB,yDAEhE;AAGD,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,mBAAmB,2BAElE;AAGD,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,UAAU,EACjB,KAAK,GAAE,OAAuB,GAC7B,mBAAmB,CAOrB;AAGD,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,oBAAoB,yDAEpE;AAMD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,UAAU,EACjB,KAAK,GAAE,OAAuB,GAC7B,oBAAoB,CAStB;AAGD,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,kBAAkB,yDAEhE;AAMD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,UAAU,EACjB,KAAK,GAAE,OAAuB,GAC7B,kBAAkB,CASpB;AAGD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,UAAU,CAM/C;AAGD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,KAAK,GAAE,OAAuB,GAC7B,GAAG,CAWL;AAGD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,UAAU,CAQ/C;AAGD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,KAAK,GAAE,OAAuB,GAC7B,GAAG,CAiBL;AAGD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,UAAU,CAE/C;AAGD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,EACjB,KAAK,GAAE,OAAuB,GAC7B,GAAG,CAGL"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maskedResponseLength = maskedResponseLength;
|
|
4
|
+
exports.serializeEnvelope = serializeEnvelope;
|
|
5
|
+
exports.serializeCredentialResponse = serializeCredentialResponse;
|
|
6
|
+
exports.serializeRegistrationRequest = serializeRegistrationRequest;
|
|
7
|
+
exports.deserializeRegistrationRequest = deserializeRegistrationRequest;
|
|
8
|
+
exports.serializeRegistrationResponse = serializeRegistrationResponse;
|
|
9
|
+
exports.deserializeRegistrationResponse = deserializeRegistrationResponse;
|
|
10
|
+
exports.serializeRegistrationRecord = serializeRegistrationRecord;
|
|
11
|
+
exports.deserializeRegistrationRecord = deserializeRegistrationRecord;
|
|
12
|
+
exports.serializeKE1 = serializeKE1;
|
|
13
|
+
exports.deserializeKE1 = deserializeKE1;
|
|
14
|
+
exports.serializeKE2 = serializeKE2;
|
|
15
|
+
exports.deserializeKE2 = deserializeKE2;
|
|
16
|
+
exports.serializeKE3 = serializeKE3;
|
|
17
|
+
exports.deserializeKE3 = deserializeKE3;
|
|
18
|
+
const errors_1 = require("../../errors");
|
|
19
|
+
const suite_1 = require("./suite");
|
|
20
|
+
function split(bytes, lengths, label) {
|
|
21
|
+
const total = lengths.reduce((a, b) => a + b, 0);
|
|
22
|
+
if (!(bytes instanceof Uint8Array) || bytes.length !== total) {
|
|
23
|
+
throw new errors_1.CryptoError(`Invalid ${label}: expected ${total} bytes`, suite_1.OpaqueErrorCode.DESERIALIZE);
|
|
24
|
+
}
|
|
25
|
+
let offset = 0;
|
|
26
|
+
return lengths.map((len) => bytes.slice(offset, (offset += len)));
|
|
27
|
+
}
|
|
28
|
+
function maskedResponseLength(s) {
|
|
29
|
+
return s.Npk + suite_1.Nn + s.Nh;
|
|
30
|
+
}
|
|
31
|
+
function serializeEnvelope(e) {
|
|
32
|
+
return (0, suite_1.concat)(e.nonce, e.authTag);
|
|
33
|
+
}
|
|
34
|
+
function serializeCredentialResponse(r) {
|
|
35
|
+
return (0, suite_1.concat)(r.evaluatedMessage, r.maskingNonce, r.maskedResponse);
|
|
36
|
+
}
|
|
37
|
+
function serializeRegistrationRequest(m) {
|
|
38
|
+
return m.blindedMessage.slice();
|
|
39
|
+
}
|
|
40
|
+
function deserializeRegistrationRequest(bytes, suite = "P256-SHA256") {
|
|
41
|
+
const [blindedMessage] = split(bytes, [(0, suite_1.getSuite)(suite).Noe], "RegistrationRequest");
|
|
42
|
+
return { blindedMessage };
|
|
43
|
+
}
|
|
44
|
+
function serializeRegistrationResponse(m) {
|
|
45
|
+
return (0, suite_1.concat)(m.evaluatedMessage, m.serverPublicKey);
|
|
46
|
+
}
|
|
47
|
+
function deserializeRegistrationResponse(bytes, suite = "P256-SHA256") {
|
|
48
|
+
const s = (0, suite_1.getSuite)(suite);
|
|
49
|
+
const [evaluatedMessage, serverPublicKey] = split(bytes, [s.Noe, s.Npk], "RegistrationResponse");
|
|
50
|
+
(0, suite_1.decodeElement)(s, serverPublicKey, "server public key");
|
|
51
|
+
return { evaluatedMessage, serverPublicKey };
|
|
52
|
+
}
|
|
53
|
+
function serializeRegistrationRecord(m) {
|
|
54
|
+
return (0, suite_1.concat)(m.clientPublicKey, m.maskingKey, serializeEnvelope(m.envelope));
|
|
55
|
+
}
|
|
56
|
+
function deserializeRegistrationRecord(bytes, suite = "P256-SHA256") {
|
|
57
|
+
const s = (0, suite_1.getSuite)(suite);
|
|
58
|
+
const [clientPublicKey, maskingKey, nonce, authTag] = split(bytes, [s.Npk, s.Nh, suite_1.Nn, s.Nh], "RegistrationRecord");
|
|
59
|
+
(0, suite_1.decodeElement)(s, clientPublicKey, "client public key");
|
|
60
|
+
return { clientPublicKey, maskingKey, envelope: { nonce, authTag } };
|
|
61
|
+
}
|
|
62
|
+
function serializeKE1(m) {
|
|
63
|
+
return (0, suite_1.concat)(m.credentialRequest.blindedMessage, m.authRequest.clientNonce, m.authRequest.clientPublicKeyshare);
|
|
64
|
+
}
|
|
65
|
+
function deserializeKE1(bytes, suite = "P256-SHA256") {
|
|
66
|
+
const s = (0, suite_1.getSuite)(suite);
|
|
67
|
+
const [blindedMessage, clientNonce, clientPublicKeyshare] = split(bytes, [s.Noe, suite_1.Nn, s.Npk], "KE1");
|
|
68
|
+
return {
|
|
69
|
+
credentialRequest: { blindedMessage },
|
|
70
|
+
authRequest: { clientNonce, clientPublicKeyshare },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function serializeKE2(m) {
|
|
74
|
+
const a = m.authResponse;
|
|
75
|
+
return (0, suite_1.concat)(serializeCredentialResponse(m.credentialResponse), a.serverNonce, a.serverPublicKeyshare, a.serverMac);
|
|
76
|
+
}
|
|
77
|
+
function deserializeKE2(bytes, suite = "P256-SHA256") {
|
|
78
|
+
const s = (0, suite_1.getSuite)(suite);
|
|
79
|
+
const lengths = [s.Noe, suite_1.Nn, maskedResponseLength(s), suite_1.Nn, s.Npk, s.Nh];
|
|
80
|
+
const [evaluatedMessage, maskingNonce, maskedResponse, ...auth] = split(bytes, lengths, "KE2");
|
|
81
|
+
const [serverNonce, serverPublicKeyshare, serverMac] = auth;
|
|
82
|
+
return {
|
|
83
|
+
credentialResponse: { evaluatedMessage, maskingNonce, maskedResponse },
|
|
84
|
+
authResponse: { serverNonce, serverPublicKeyshare, serverMac },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function serializeKE3(m) {
|
|
88
|
+
return m.clientMac.slice();
|
|
89
|
+
}
|
|
90
|
+
function deserializeKE3(bytes, suite = "P256-SHA256") {
|
|
91
|
+
const [clientMac] = split(bytes, [(0, suite_1.getSuite)(suite).Nh], "KE3");
|
|
92
|
+
return { clientMac };
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DerivedKeys, ServerLoginState } from "./ake";
|
|
2
|
+
import type { OpaqueConfig } from "./config";
|
|
3
|
+
import type { Identities } from "./envelope";
|
|
4
|
+
import type { KE1, KE2, KE3, RegistrationRecord, RegistrationRequest, RegistrationResponse } from "./messages";
|
|
5
|
+
export interface ServerSetup {
|
|
6
|
+
serverPrivateKey: Uint8Array;
|
|
7
|
+
serverPublicKey: Uint8Array;
|
|
8
|
+
oprfSeed: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
export interface GenerateKE2Input extends ServerSetup, Identities {
|
|
11
|
+
record: RegistrationRecord;
|
|
12
|
+
credentialIdentifier: Uint8Array | string;
|
|
13
|
+
ke1: KE1;
|
|
14
|
+
}
|
|
15
|
+
export interface KE2Randomness {
|
|
16
|
+
maskingNonce?: Uint8Array;
|
|
17
|
+
serverNonce?: Uint8Array;
|
|
18
|
+
serverKeyshareSeed?: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
export declare function createServerSetup(config?: OpaqueConfig): ServerSetup;
|
|
21
|
+
export declare function createFakeRecord(config?: OpaqueConfig): RegistrationRecord;
|
|
22
|
+
export declare function createRegistrationResponse(request: RegistrationRequest, serverPublicKey: Uint8Array, credentialIdentifier: Uint8Array | string, oprfSeed: Uint8Array, config?: OpaqueConfig): RegistrationResponse;
|
|
23
|
+
export declare function generateKE2With(input: GenerateKE2Input, config: OpaqueConfig, r: KE2Randomness): {
|
|
24
|
+
ke2: KE2;
|
|
25
|
+
state: ServerLoginState;
|
|
26
|
+
keys: DerivedKeys;
|
|
27
|
+
};
|
|
28
|
+
export declare function generateKE2(input: GenerateKE2Input, config?: OpaqueConfig): {
|
|
29
|
+
ke2: KE2;
|
|
30
|
+
state: ServerLoginState;
|
|
31
|
+
};
|
|
32
|
+
export declare function serverFinish(state: ServerLoginState, ke3: KE3): Uint8Array;
|
|
33
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAS7C,OAAO,KAAK,EACV,GAAG,EACH,GAAG,EACH,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,WAAW;IAE1B,gBAAgB,EAAE,UAAU,CAAC;IAE7B,eAAe,EAAE,UAAU,CAAC;IAE5B,QAAQ,EAAE,UAAU,CAAC;CACtB;AAGD,MAAM,WAAW,gBAAiB,SAAQ,WAAW,EAAE,UAAU;IAE/D,MAAM,EAAE,kBAAkB,CAAC;IAE3B,oBAAoB,EAAE,UAAU,GAAG,MAAM,CAAC;IAE1C,GAAG,EAAE,GAAG,CAAC;CACV;AAGD,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,kBAAkB,CAAC,EAAE,UAAU,CAAC;CACjC;AASD,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,YAAiB,GAAG,WAAW,CAQxE;AAYD,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE,YAAiB,GACxB,kBAAkB,CAQpB;AAaD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,mBAAmB,EAC5B,eAAe,EAAE,UAAU,EAC3B,oBAAoB,EAAE,UAAU,GAAG,MAAM,EACzC,QAAQ,EAAE,UAAU,EACpB,MAAM,GAAE,YAAiB,GACxB,oBAAoB,CAetB;AAGD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,YAAY,EACpB,CAAC,EAAE,aAAa,GACf;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CA+B1D;AAYD,wBAAgB,WAAW,CACzB,KAAK,EAAE,gBAAgB,EACvB,MAAM,GAAE,YAAiB,GACxB;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CAGvC;AAaD,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,GAAG,UAAU,CAE1E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createServerSetup = createServerSetup;
|
|
4
|
+
exports.createFakeRecord = createFakeRecord;
|
|
5
|
+
exports.createRegistrationResponse = createRegistrationResponse;
|
|
6
|
+
exports.generateKE2With = generateKE2With;
|
|
7
|
+
exports.generateKE2 = generateKE2;
|
|
8
|
+
exports.serverFinish = serverFinish;
|
|
9
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
10
|
+
const ake_1 = require("./ake");
|
|
11
|
+
const config_1 = require("./config");
|
|
12
|
+
const credentials_1 = require("./credentials");
|
|
13
|
+
const envelope_1 = require("./envelope");
|
|
14
|
+
const messages_1 = require("./messages");
|
|
15
|
+
const suite_1 = require("./suite");
|
|
16
|
+
function createServerSetup(config = {}) {
|
|
17
|
+
const { s } = (0, config_1.resolveConfig)(config);
|
|
18
|
+
const kp = (0, suite_1.deriveDiffieHellmanKeyPair)(s, (0, utils_js_1.randomBytes)(suite_1.Nseed));
|
|
19
|
+
return {
|
|
20
|
+
serverPrivateKey: kp.privateKey,
|
|
21
|
+
serverPublicKey: kp.publicKey,
|
|
22
|
+
oprfSeed: (0, utils_js_1.randomBytes)(s.Nh),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function createFakeRecord(config = {}) {
|
|
26
|
+
const { s } = (0, config_1.resolveConfig)(config);
|
|
27
|
+
return {
|
|
28
|
+
clientPublicKey: (0, suite_1.deriveDiffieHellmanKeyPair)(s, (0, utils_js_1.randomBytes)(suite_1.Nseed))
|
|
29
|
+
.publicKey,
|
|
30
|
+
maskingKey: (0, utils_js_1.randomBytes)(s.Nh),
|
|
31
|
+
envelope: { nonce: new Uint8Array(suite_1.Nn), authTag: new Uint8Array(s.Nh) },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function createRegistrationResponse(request, serverPublicKey, credentialIdentifier, oprfSeed, config = {}) {
|
|
35
|
+
const { s } = (0, config_1.resolveConfig)(config);
|
|
36
|
+
const req = (0, messages_1.deserializeRegistrationRequest)((0, messages_1.serializeRegistrationRequest)(request), s.id);
|
|
37
|
+
return {
|
|
38
|
+
evaluatedMessage: (0, credentials_1.evaluateOprf)(s, oprfSeed, credentialIdentifier, req.blindedMessage),
|
|
39
|
+
serverPublicKey: serverPublicKey.slice(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function generateKE2With(input, config, r) {
|
|
43
|
+
const { s, context } = (0, config_1.resolveConfig)(config);
|
|
44
|
+
const ke1 = (0, messages_1.deserializeKE1)((0, messages_1.serializeKE1)(input.ke1), s.id);
|
|
45
|
+
const record = (0, messages_1.deserializeRegistrationRecord)((0, messages_1.serializeRegistrationRecord)(input.record), s.id);
|
|
46
|
+
const credentialResponse = (0, credentials_1.createCredentialResponse)(s, {
|
|
47
|
+
request: ke1.credentialRequest,
|
|
48
|
+
serverPublicKey: input.serverPublicKey,
|
|
49
|
+
record,
|
|
50
|
+
credentialIdentifier: input.credentialIdentifier,
|
|
51
|
+
oprfSeed: input.oprfSeed,
|
|
52
|
+
maskingNonce: r.maskingNonce ?? (0, utils_js_1.randomBytes)(suite_1.Nn),
|
|
53
|
+
});
|
|
54
|
+
const auth = (0, ake_1.authServerRespond)(s, {
|
|
55
|
+
context,
|
|
56
|
+
cleartextCredentials: (0, envelope_1.createCleartextCredentials)(input.serverPublicKey, record.clientPublicKey, input),
|
|
57
|
+
serverPrivateKey: input.serverPrivateKey,
|
|
58
|
+
clientPublicKey: record.clientPublicKey,
|
|
59
|
+
ke1,
|
|
60
|
+
credentialResponse,
|
|
61
|
+
serverNonce: r.serverNonce ?? (0, utils_js_1.randomBytes)(suite_1.Nn),
|
|
62
|
+
serverKeyshareSeed: r.serverKeyshareSeed ?? (0, utils_js_1.randomBytes)(suite_1.Nseed),
|
|
63
|
+
});
|
|
64
|
+
const ke2 = { credentialResponse, authResponse: auth.authResponse };
|
|
65
|
+
return { ke2, state: auth.state, keys: auth.keys };
|
|
66
|
+
}
|
|
67
|
+
function generateKE2(input, config = {}) {
|
|
68
|
+
const { ke2, state } = generateKE2With(input, config, {});
|
|
69
|
+
return { ke2, state };
|
|
70
|
+
}
|
|
71
|
+
function serverFinish(state, ke3) {
|
|
72
|
+
return (0, ake_1.authServerFinalize)(state, ke3);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { p256_oprf } from "@noble/curves/nist.js";
|
|
2
|
+
import { concatBytes } from "@noble/hashes/utils.js";
|
|
3
|
+
import type { CHash } from "@noble/hashes/utils.js";
|
|
4
|
+
export type SuiteId = "P256-SHA256" | "ristretto255-SHA512";
|
|
5
|
+
export declare const OpaqueErrorCode: {
|
|
6
|
+
readonly ENVELOPE_RECOVERY: "OPAQUE_ENVELOPE_RECOVERY";
|
|
7
|
+
readonly SERVER_AUTHENTICATION: "OPAQUE_SERVER_AUTHENTICATION";
|
|
8
|
+
readonly CLIENT_AUTHENTICATION: "OPAQUE_CLIENT_AUTHENTICATION";
|
|
9
|
+
readonly DESERIALIZE: "OPAQUE_DESERIALIZE";
|
|
10
|
+
readonly INVALID_INPUT: "OPAQUE_INVALID_INPUT";
|
|
11
|
+
};
|
|
12
|
+
export declare const Nn = 32;
|
|
13
|
+
export declare const Nseed = 32;
|
|
14
|
+
interface Element {
|
|
15
|
+
multiply(scalar: bigint): Element;
|
|
16
|
+
equals(other: Element): boolean;
|
|
17
|
+
toBytes(): Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
interface Group {
|
|
20
|
+
fromBytes(bytes: Uint8Array): Element;
|
|
21
|
+
readonly ZERO: Element;
|
|
22
|
+
readonly Fn: {
|
|
23
|
+
fromBytes(bytes: Uint8Array): bigint;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
type Oprf = typeof p256_oprf.oprf;
|
|
27
|
+
export interface Suite {
|
|
28
|
+
readonly id: SuiteId;
|
|
29
|
+
readonly Nh: number;
|
|
30
|
+
readonly Npk: number;
|
|
31
|
+
readonly Noe: number;
|
|
32
|
+
readonly Nok: number;
|
|
33
|
+
readonly hash: CHash;
|
|
34
|
+
readonly oprf: Oprf;
|
|
35
|
+
readonly group: Group;
|
|
36
|
+
readonly hashToGroup: (msg: Uint8Array, opts: {
|
|
37
|
+
DST: Uint8Array;
|
|
38
|
+
}) => Element;
|
|
39
|
+
readonly blindDst: Uint8Array;
|
|
40
|
+
}
|
|
41
|
+
export declare function utf8(s: string): Uint8Array;
|
|
42
|
+
export declare function toBytes(value: Uint8Array | string): Uint8Array;
|
|
43
|
+
export declare function i2osp(n: number, len: 1 | 2): Uint8Array;
|
|
44
|
+
export declare const concat: typeof concatBytes;
|
|
45
|
+
export declare function xor(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
46
|
+
export declare function getSuite(id: SuiteId): Suite;
|
|
47
|
+
export declare function kdfExtract(s: Suite, salt: Uint8Array, ikm: Uint8Array): Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
48
|
+
export declare function kdfExpand(s: Suite, prk: Uint8Array, info: Uint8Array, length: number): Uint8Array;
|
|
49
|
+
export declare function mac(s: Suite, key: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
50
|
+
export declare function decodeElement(s: Suite, bytes: Uint8Array, label: string): Element;
|
|
51
|
+
export declare function deriveDiffieHellmanKeyPair(s: Suite, seed: Uint8Array): {
|
|
52
|
+
privateKey: import("@noble/curves/abstract/oprf").ScalarBytes & Uint8Array<ArrayBuffer>;
|
|
53
|
+
publicKey: import("@noble/curves/abstract/oprf").PointBytes & Uint8Array<ArrayBuffer>;
|
|
54
|
+
};
|
|
55
|
+
export declare function diffieHellman(s: Suite, privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array;
|
|
56
|
+
export declare function blindWith(s: Suite, input: Uint8Array, blind: Uint8Array): Uint8Array;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../../src/protocols/opaque/suite.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqB,SAAS,EAAE,MAAM,uBAAuB,CAAC;AASrE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAIpD,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,qBAAqB,CAAC;AAG5D,eAAO,MAAM,eAAe;;;;;;CAWlB,CAAC;AAGX,eAAO,MAAM,EAAE,KAAK,CAAC;AAErB,eAAO,MAAM,KAAK,KAAK,CAAC;AAGxB,UAAU,OAAO;IACf,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAChC,OAAO,IAAI,UAAU,CAAC;CACvB;AAGD,UAAU,KAAK;IACb,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE;QAAE,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAA;KAAE,CAAC;CACvD;AAGD,KAAK,IAAI,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAMlC,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAErB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,UAAU,CAAA;KAAE,KAAK,OAAO,CAAC;IAE9E,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC/B;AAGD,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAE1C;AAGD,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,CAE9D;AAGD,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,UAAU,CAEvD;AAGD,eAAO,MAAM,MAAM,oBAAc,CAAC;AAGlC,wBAAgB,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAE5D;AA8BD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,KAAK,CAS3C;AAGD,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,yDAErE;AAGD,wBAAgB,SAAS,CACvB,CAAC,EAAE,KAAK,EACR,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,UAAU,CAEZ;AAGD,wBAAgB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAE1E;AAOD,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAcvE;AAOD,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU;;;EAMpE;AAQD,wBAAgB,aAAa,CAC3B,CAAC,EAAE,KAAK,EACR,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,GACpB,UAAU,CAIZ;AAOD,wBAAgB,SAAS,CACvB,CAAC,EAAE,KAAK,EACR,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,GAChB,UAAU,CAKZ"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.concat = exports.Nseed = exports.Nn = exports.OpaqueErrorCode = void 0;
|
|
4
|
+
exports.utf8 = utf8;
|
|
5
|
+
exports.toBytes = toBytes;
|
|
6
|
+
exports.i2osp = i2osp;
|
|
7
|
+
exports.xor = xor;
|
|
8
|
+
exports.getSuite = getSuite;
|
|
9
|
+
exports.kdfExtract = kdfExtract;
|
|
10
|
+
exports.kdfExpand = kdfExpand;
|
|
11
|
+
exports.mac = mac;
|
|
12
|
+
exports.decodeElement = decodeElement;
|
|
13
|
+
exports.deriveDiffieHellmanKeyPair = deriveDiffieHellmanKeyPair;
|
|
14
|
+
exports.diffieHellman = diffieHellman;
|
|
15
|
+
exports.blindWith = blindWith;
|
|
16
|
+
const nist_js_1 = require("@noble/curves/nist.js");
|
|
17
|
+
const ed25519_js_1 = require("@noble/curves/ed25519.js");
|
|
18
|
+
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
19
|
+
const hkdf_js_1 = require("@noble/hashes/hkdf.js");
|
|
20
|
+
const hmac_js_1 = require("@noble/hashes/hmac.js");
|
|
21
|
+
const utils_js_1 = require("@noble/hashes/utils.js");
|
|
22
|
+
const errors_1 = require("../../errors");
|
|
23
|
+
exports.OpaqueErrorCode = {
|
|
24
|
+
ENVELOPE_RECOVERY: "OPAQUE_ENVELOPE_RECOVERY",
|
|
25
|
+
SERVER_AUTHENTICATION: "OPAQUE_SERVER_AUTHENTICATION",
|
|
26
|
+
CLIENT_AUTHENTICATION: "OPAQUE_CLIENT_AUTHENTICATION",
|
|
27
|
+
DESERIALIZE: "OPAQUE_DESERIALIZE",
|
|
28
|
+
INVALID_INPUT: "OPAQUE_INVALID_INPUT",
|
|
29
|
+
};
|
|
30
|
+
exports.Nn = 32;
|
|
31
|
+
exports.Nseed = 32;
|
|
32
|
+
function utf8(s) {
|
|
33
|
+
return new TextEncoder().encode(s);
|
|
34
|
+
}
|
|
35
|
+
function toBytes(value) {
|
|
36
|
+
return typeof value === "string" ? utf8(value) : value;
|
|
37
|
+
}
|
|
38
|
+
function i2osp(n, len) {
|
|
39
|
+
return len === 1 ? Uint8Array.of(n) : Uint8Array.of(n >> 8, n & 0xff);
|
|
40
|
+
}
|
|
41
|
+
exports.concat = utils_js_1.concatBytes;
|
|
42
|
+
function xor(a, b) {
|
|
43
|
+
return a.map((x, i) => x ^ b[i]);
|
|
44
|
+
}
|
|
45
|
+
const SUITES = {
|
|
46
|
+
"P256-SHA256": {
|
|
47
|
+
id: "P256-SHA256",
|
|
48
|
+
Nh: 32,
|
|
49
|
+
Npk: 33,
|
|
50
|
+
Noe: 33,
|
|
51
|
+
Nok: 32,
|
|
52
|
+
hash: sha2_js_1.sha256,
|
|
53
|
+
oprf: nist_js_1.p256_oprf.oprf,
|
|
54
|
+
group: nist_js_1.p256.Point,
|
|
55
|
+
hashToGroup: nist_js_1.p256_hasher.hashToCurve,
|
|
56
|
+
blindDst: utf8("HashToGroup-OPRFV1-\x00-P256-SHA256"),
|
|
57
|
+
},
|
|
58
|
+
"ristretto255-SHA512": {
|
|
59
|
+
id: "ristretto255-SHA512",
|
|
60
|
+
Nh: 64,
|
|
61
|
+
Npk: 32,
|
|
62
|
+
Noe: 32,
|
|
63
|
+
Nok: 32,
|
|
64
|
+
hash: sha2_js_1.sha512,
|
|
65
|
+
oprf: ed25519_js_1.ristretto255_oprf.oprf,
|
|
66
|
+
group: ed25519_js_1.ristretto255.Point,
|
|
67
|
+
hashToGroup: ed25519_js_1.ristretto255_hasher.hashToCurve,
|
|
68
|
+
blindDst: utf8("HashToGroup-OPRFV1-\x00-ristretto255-SHA512"),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
function getSuite(id) {
|
|
72
|
+
const suite = Object.hasOwn(SUITES, id) ? SUITES[id] : undefined;
|
|
73
|
+
if (suite === undefined) {
|
|
74
|
+
throw new errors_1.CryptoError(`Unsupported OPAQUE suite: ${String(id)}`, exports.OpaqueErrorCode.INVALID_INPUT);
|
|
75
|
+
}
|
|
76
|
+
return suite;
|
|
77
|
+
}
|
|
78
|
+
function kdfExtract(s, salt, ikm) {
|
|
79
|
+
return (0, hkdf_js_1.extract)(s.hash, ikm, salt);
|
|
80
|
+
}
|
|
81
|
+
function kdfExpand(s, prk, info, length) {
|
|
82
|
+
return (0, hkdf_js_1.expand)(s.hash, prk, info, length);
|
|
83
|
+
}
|
|
84
|
+
function mac(s, key, msg) {
|
|
85
|
+
return (0, hmac_js_1.hmac)(s.hash, key, msg);
|
|
86
|
+
}
|
|
87
|
+
function decodeElement(s, bytes, label) {
|
|
88
|
+
let element;
|
|
89
|
+
try {
|
|
90
|
+
element = s.group.fromBytes(bytes);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
throw new errors_1.CryptoError(`Invalid ${label}`, exports.OpaqueErrorCode.DESERIALIZE);
|
|
94
|
+
}
|
|
95
|
+
if (element.equals(s.group.ZERO)) {
|
|
96
|
+
throw new errors_1.CryptoError(`Invalid ${label}: identity element`, exports.OpaqueErrorCode.DESERIALIZE);
|
|
97
|
+
}
|
|
98
|
+
return element;
|
|
99
|
+
}
|
|
100
|
+
function deriveDiffieHellmanKeyPair(s, seed) {
|
|
101
|
+
const kp = s.oprf.deriveKeyPair(seed, utf8("OPAQUE-DeriveDiffieHellmanKeyPair"));
|
|
102
|
+
return { privateKey: kp.secretKey, publicKey: kp.publicKey };
|
|
103
|
+
}
|
|
104
|
+
function diffieHellman(s, privateKey, publicKey) {
|
|
105
|
+
return decodeElement(s, publicKey, "public key")
|
|
106
|
+
.multiply(s.group.Fn.fromBytes(privateKey))
|
|
107
|
+
.toBytes();
|
|
108
|
+
}
|
|
109
|
+
function blindWith(s, input, blind) {
|
|
110
|
+
return s
|
|
111
|
+
.hashToGroup(input, { DST: s.blindDst })
|
|
112
|
+
.multiply(s.group.Fn.fromBytes(blind))
|
|
113
|
+
.toBytes();
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=suite.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { OpaqueErrorCode } from "./opaque/suite";
|
|
2
|
+
export type { SuiteId } from "./opaque/suite";
|
|
3
|
+
export { RFC9807_SCRYPT_PARAMS, scryptKsf } from "./opaque/ksf";
|
|
4
|
+
export type { Ksf, ScryptKsfParams } from "./opaque/ksf";
|
|
5
|
+
export type { OpaqueConfig } from "./opaque/config";
|
|
6
|
+
export type { Identities } from "./opaque/envelope";
|
|
7
|
+
export type { ServerLoginState } from "./opaque/ake";
|
|
8
|
+
export { deserializeKE1, deserializeKE2, deserializeKE3, deserializeRegistrationRecord, deserializeRegistrationRequest, deserializeRegistrationResponse, serializeKE1, serializeKE2, serializeKE3, serializeRegistrationRecord, serializeRegistrationRequest, serializeRegistrationResponse, } from "./opaque/messages";
|
|
9
|
+
export type { AuthRequest, AuthResponse, CredentialRequest, CredentialResponse, Envelope, KE1, KE2, KE3, RegistrationRecord, RegistrationRequest, RegistrationResponse, } from "./opaque/messages";
|
|
10
|
+
export { createRegistrationRequest, finalizeRegistrationRequest, generateKE1, generateKE3, } from "./opaque/client";
|
|
11
|
+
export type { ClientLoginState } from "./opaque/client";
|
|
12
|
+
export { createFakeRecord, createRegistrationResponse, createServerSetup, generateKE2, serverFinish, } from "./opaque/server";
|
|
13
|
+
export type { GenerateKE2Input, ServerSetup } from "./opaque/server";
|
|
14
|
+
//# sourceMappingURL=pake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pake.d.ts","sourceRoot":"","sources":["../../src/protocols/pake.ts"],"names":[],"mappings":"AA+EA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,YAAY,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,6BAA6B,EAC7B,8BAA8B,EAC9B,+BAA+B,EAC/B,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,GAAG,EACH,GAAG,EACH,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,WAAW,EACX,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACjB,WAAW,EACX,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serverFinish = exports.generateKE2 = exports.createServerSetup = exports.createRegistrationResponse = exports.createFakeRecord = exports.generateKE3 = exports.generateKE1 = exports.finalizeRegistrationRequest = exports.createRegistrationRequest = exports.serializeRegistrationResponse = exports.serializeRegistrationRequest = exports.serializeRegistrationRecord = exports.serializeKE3 = exports.serializeKE2 = exports.serializeKE1 = exports.deserializeRegistrationResponse = exports.deserializeRegistrationRequest = exports.deserializeRegistrationRecord = exports.deserializeKE3 = exports.deserializeKE2 = exports.deserializeKE1 = exports.scryptKsf = exports.RFC9807_SCRYPT_PARAMS = exports.OpaqueErrorCode = void 0;
|
|
4
|
+
var suite_1 = require("./opaque/suite");
|
|
5
|
+
Object.defineProperty(exports, "OpaqueErrorCode", { enumerable: true, get: function () { return suite_1.OpaqueErrorCode; } });
|
|
6
|
+
var ksf_1 = require("./opaque/ksf");
|
|
7
|
+
Object.defineProperty(exports, "RFC9807_SCRYPT_PARAMS", { enumerable: true, get: function () { return ksf_1.RFC9807_SCRYPT_PARAMS; } });
|
|
8
|
+
Object.defineProperty(exports, "scryptKsf", { enumerable: true, get: function () { return ksf_1.scryptKsf; } });
|
|
9
|
+
var messages_1 = require("./opaque/messages");
|
|
10
|
+
Object.defineProperty(exports, "deserializeKE1", { enumerable: true, get: function () { return messages_1.deserializeKE1; } });
|
|
11
|
+
Object.defineProperty(exports, "deserializeKE2", { enumerable: true, get: function () { return messages_1.deserializeKE2; } });
|
|
12
|
+
Object.defineProperty(exports, "deserializeKE3", { enumerable: true, get: function () { return messages_1.deserializeKE3; } });
|
|
13
|
+
Object.defineProperty(exports, "deserializeRegistrationRecord", { enumerable: true, get: function () { return messages_1.deserializeRegistrationRecord; } });
|
|
14
|
+
Object.defineProperty(exports, "deserializeRegistrationRequest", { enumerable: true, get: function () { return messages_1.deserializeRegistrationRequest; } });
|
|
15
|
+
Object.defineProperty(exports, "deserializeRegistrationResponse", { enumerable: true, get: function () { return messages_1.deserializeRegistrationResponse; } });
|
|
16
|
+
Object.defineProperty(exports, "serializeKE1", { enumerable: true, get: function () { return messages_1.serializeKE1; } });
|
|
17
|
+
Object.defineProperty(exports, "serializeKE2", { enumerable: true, get: function () { return messages_1.serializeKE2; } });
|
|
18
|
+
Object.defineProperty(exports, "serializeKE3", { enumerable: true, get: function () { return messages_1.serializeKE3; } });
|
|
19
|
+
Object.defineProperty(exports, "serializeRegistrationRecord", { enumerable: true, get: function () { return messages_1.serializeRegistrationRecord; } });
|
|
20
|
+
Object.defineProperty(exports, "serializeRegistrationRequest", { enumerable: true, get: function () { return messages_1.serializeRegistrationRequest; } });
|
|
21
|
+
Object.defineProperty(exports, "serializeRegistrationResponse", { enumerable: true, get: function () { return messages_1.serializeRegistrationResponse; } });
|
|
22
|
+
var client_1 = require("./opaque/client");
|
|
23
|
+
Object.defineProperty(exports, "createRegistrationRequest", { enumerable: true, get: function () { return client_1.createRegistrationRequest; } });
|
|
24
|
+
Object.defineProperty(exports, "finalizeRegistrationRequest", { enumerable: true, get: function () { return client_1.finalizeRegistrationRequest; } });
|
|
25
|
+
Object.defineProperty(exports, "generateKE1", { enumerable: true, get: function () { return client_1.generateKE1; } });
|
|
26
|
+
Object.defineProperty(exports, "generateKE3", { enumerable: true, get: function () { return client_1.generateKE3; } });
|
|
27
|
+
var server_1 = require("./opaque/server");
|
|
28
|
+
Object.defineProperty(exports, "createFakeRecord", { enumerable: true, get: function () { return server_1.createFakeRecord; } });
|
|
29
|
+
Object.defineProperty(exports, "createRegistrationResponse", { enumerable: true, get: function () { return server_1.createRegistrationResponse; } });
|
|
30
|
+
Object.defineProperty(exports, "createServerSetup", { enumerable: true, get: function () { return server_1.createServerSetup; } });
|
|
31
|
+
Object.defineProperty(exports, "generateKE2", { enumerable: true, get: function () { return server_1.generateKE2; } });
|
|
32
|
+
Object.defineProperty(exports, "serverFinish", { enumerable: true, get: function () { return server_1.serverFinish; } });
|
|
33
|
+
//# sourceMappingURL=pake.js.map
|