raz-encrypt 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +448 -442
- package/dist/canonicalJson.d.ts +0 -15
- package/dist/canonicalJson.js +13 -73
- package/dist/canonicalJson.js.map +1 -1
- package/dist/core.d.ts +2 -4
- package/dist/core.js +1 -3
- package/dist/core.js.map +1 -1
- package/dist/crypto/classical.d.ts +0 -2
- package/dist/crypto/classical.js +0 -4
- package/dist/crypto/classical.js.map +1 -1
- package/dist/crypto/frameCipher.js +2 -8
- package/dist/crypto/frameCipher.js.map +1 -1
- package/dist/crypto/hybrid.d.ts +8 -95
- package/dist/crypto/hybrid.js +49 -374
- package/dist/crypto/hybrid.js.map +1 -1
- package/dist/crypto/nodeHybrid.d.ts +4 -6
- package/dist/crypto/nodeHybrid.js +2 -3
- package/dist/crypto/nodeHybrid.js.map +1 -1
- package/dist/crypto/pqc.d.ts +2 -7
- package/dist/crypto/pqc.js +4 -13
- package/dist/crypto/pqc.js.map +1 -1
- package/dist/crypto/ratchet.js +0 -5
- package/dist/crypto/ratchet.js.map +1 -1
- package/dist/fileCrypto.d.ts +2 -44
- package/dist/fileCrypto.js +28 -197
- package/dist/fileCrypto.js.map +1 -1
- package/dist/identity.d.ts +4 -69
- package/dist/identity.js +12 -111
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/store.d.ts +5 -42
- package/dist/store.js +22 -254
- package/dist/store.js.map +1 -1
- package/dist/trust.d.ts +2 -143
- package/dist/trust.js +27 -376
- package/dist/trust.js.map +1 -1
- package/package.json +69 -62
- package/dist/crypto/confirmedSession.d.ts +0 -47
- package/dist/crypto/confirmedSession.js +0 -84
- package/dist/crypto/confirmedSession.js.map +0 -1
- package/dist/crypto/frameSession.d.ts +0 -40
- package/dist/crypto/frameSession.js +0 -96
- package/dist/crypto/frameSession.js.map +0 -1
- package/dist/passphrase.d.ts +0 -27
- package/dist/passphrase.js +0 -69
- package/dist/passphrase.js.map +0 -1
package/dist/trust.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust.js","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAuC,MAAM,oBAAoB,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAkC,MAAM,eAAe,CAAC;AAwCrF;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,MAAM,qBAAqB,GAAG,WAAW,CAAC,qCAAqC,CAAC,CAAC;AACjF,2EAA2E;AAC3E,4EAA4E;AAC5E,cAAc;AACd,MAAM,oBA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MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAkB,EAAE,KAAa;IACrE,OAAO,CAAC,MAAM,wBAAwB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAkB,EAAE,KAAa;IAC9E,OAAO,CAAC,MAAM,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACnD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;SACrC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,QAAkB,EAAE,KAAa;IAC5E,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AACtF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,62 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "raz-encrypt",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Local-first, hybrid classical+post-quantum signing and verification for two consenting parties. No server, no database required.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"engines": {
|
|
8
|
-
"node": ">=20"
|
|
9
|
-
},
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.js"
|
|
16
|
-
},
|
|
17
|
-
"./core": {
|
|
18
|
-
"types": "./dist/core.d.ts",
|
|
19
|
-
"import": "./dist/core.js"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"files": [
|
|
23
|
-
"dist"
|
|
24
|
-
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsc -p tsconfig.json",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"test": "vitest run",
|
|
29
|
-
"test:watch": "vitest",
|
|
30
|
-
"demo:setup": "tsx demo/alice.ts && tsx demo/bob.ts && tsx demo/exchange.ts",
|
|
31
|
-
"demo:sign": "tsx demo/sign-as-alice.ts",
|
|
32
|
-
"demo:verify": "tsx demo/verify-as-bob.ts",
|
|
33
|
-
"demo:tamper": "tsx demo/verify-as-bob.ts --tamper",
|
|
34
|
-
"demo:clean": "rm -rf demo/.alice-store demo/.bob-store demo/alice-card.json demo/bob-card.json demo/signed-doc.json",
|
|
35
|
-
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"@noble/
|
|
41
|
-
"@noble/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
},
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "raz-encrypt",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "Local-first, hybrid classical+post-quantum signing and verification for two consenting parties. No server, no database required.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./core": {
|
|
18
|
+
"types": "./dist/core.d.ts",
|
|
19
|
+
"import": "./dist/core.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.json",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"demo:setup": "tsx demo/alice.ts && tsx demo/bob.ts && tsx demo/exchange.ts",
|
|
31
|
+
"demo:sign": "tsx demo/sign-as-alice.ts",
|
|
32
|
+
"demo:verify": "tsx demo/verify-as-bob.ts",
|
|
33
|
+
"demo:tamper": "tsx demo/verify-as-bob.ts --tamper",
|
|
34
|
+
"demo:clean": "rm -rf demo/.alice-store demo/.bob-store demo/alice-card.json demo/bob-card.json demo/signed-doc.json",
|
|
35
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build",
|
|
36
|
+
"lint": "eslint src",
|
|
37
|
+
"sbom": "cyclonedx-npm --omit dev --output-file sbom.cdx.json"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@noble/ciphers": "2.4.0",
|
|
41
|
+
"@noble/curves": "2.4.0",
|
|
42
|
+
"@noble/hashes": "2.4.0",
|
|
43
|
+
"@noble/post-quantum": "0.7.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@cyclonedx/cyclonedx-npm": "6.0.1",
|
|
47
|
+
"@eslint/js": "10.0.1",
|
|
48
|
+
"@types/node": "^26.6.4",
|
|
49
|
+
"eslint": "10.12.0",
|
|
50
|
+
"eslint-plugin-security": "4.2.0",
|
|
51
|
+
"fast-check": "^4.10.2",
|
|
52
|
+
"tsx": "^4.19.2",
|
|
53
|
+
"typescript": "^5.7.2",
|
|
54
|
+
"typescript-eslint": "8.71.1",
|
|
55
|
+
"vitest": "^5.0.0"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/razmans/raz-encrypt.git"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/razmans/raz-encrypt/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/razmans/raz-encrypt#readme",
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public",
|
|
67
|
+
"provenance": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { EncryptedFrame } from "./frameCipher.js";
|
|
2
|
-
import { type HandshakeRole, type HandshakeTranscript, type InitiatorSessionResult, type ResponderSessionResult } from "./hybrid.js";
|
|
3
|
-
/**
|
|
4
|
-
* ConfirmedSession (issue #40/ADR 0025): a high-level gate in front of
|
|
5
|
-
* FrameSender/FrameReceiver that makes it hard to skip key confirmation by
|
|
6
|
-
* accident. `createFrameChannels` already builds a ready-to-use
|
|
7
|
-
* sender/receiver pair straight from SessionKeys with no confirmation gate
|
|
8
|
-
* at all — a caller could start sending and receiving the instant the
|
|
9
|
-
* handshake returns, with nothing to signal that confirmation (issue #8's
|
|
10
|
-
* makeKeyConfirmation/verifyKeyConfirmation) was skipped entirely.
|
|
11
|
-
*
|
|
12
|
-
* This class adds exactly one thing, no new crypto: a gate. It performs NO
|
|
13
|
-
* network I/O — the caller still transports the handshake messages and the
|
|
14
|
-
* confirmation tags over whatever channel they already use, exactly as for
|
|
15
|
-
* the low-level functions, which are completely unchanged and remain the
|
|
16
|
-
* supported API for advanced use.
|
|
17
|
-
*/
|
|
18
|
-
export declare class UnconfirmedSessionError extends Error {
|
|
19
|
-
constructor(operation: "seal" | "open");
|
|
20
|
-
}
|
|
21
|
-
export declare class ConfirmedSession {
|
|
22
|
-
private readonly role;
|
|
23
|
-
private readonly counterpartRole;
|
|
24
|
-
private readonly confirmationKey;
|
|
25
|
-
private readonly transcript;
|
|
26
|
-
private readonly sender;
|
|
27
|
-
private readonly receiver;
|
|
28
|
-
private confirmed;
|
|
29
|
-
/** The tag to send the counterpart — computed eagerly, send it as soon as you have a channel to send it over. */
|
|
30
|
-
readonly ownConfirmationTag: string;
|
|
31
|
-
constructor(role: HandshakeRole, result: InitiatorSessionResult | ResponderSessionResult, transcript: HandshakeTranscript);
|
|
32
|
-
/** Whether `confirmPeer` has already succeeded. `seal`/`open` are only usable once this is true. */
|
|
33
|
-
get isConfirmed(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Verifies the tag received from the counterpart. Returns `false` for a
|
|
36
|
-
* wrong or malformed tag — never throws, matching `verifyKeyConfirmation`'s
|
|
37
|
-
* own contract — so you decide what to do (retry, abort, log). Once this
|
|
38
|
-
* returns `true`, the gate opens permanently; nothing closes it again.
|
|
39
|
-
*/
|
|
40
|
-
confirmPeer(peerTag: unknown): boolean;
|
|
41
|
-
/** Encrypts `plaintext` at the next counter. Throws UnconfirmedSessionError until `confirmPeer` has succeeded. */
|
|
42
|
-
seal(plaintext: Uint8Array, aad?: Uint8Array): EncryptedFrame;
|
|
43
|
-
/** Opens a received frame. Throws UnconfirmedSessionError until `confirmPeer` has succeeded — reading content from an unconfirmed counterpart is exactly the mistake key confirmation exists to prevent. */
|
|
44
|
-
open(frame: EncryptedFrame, aad?: Uint8Array): Uint8Array;
|
|
45
|
-
/** Wipes the wrapped sender/receiver's key copies and this object's own copy of the confirmation key. Unusable afterwards. */
|
|
46
|
-
destroy(): void;
|
|
47
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { createFrameChannels } from "./frameSession.js";
|
|
2
|
-
import { makeKeyConfirmation, verifyKeyConfirmation, } from "./hybrid.js";
|
|
3
|
-
/**
|
|
4
|
-
* ConfirmedSession (issue #40/ADR 0025): a high-level gate in front of
|
|
5
|
-
* FrameSender/FrameReceiver that makes it hard to skip key confirmation by
|
|
6
|
-
* accident. `createFrameChannels` already builds a ready-to-use
|
|
7
|
-
* sender/receiver pair straight from SessionKeys with no confirmation gate
|
|
8
|
-
* at all — a caller could start sending and receiving the instant the
|
|
9
|
-
* handshake returns, with nothing to signal that confirmation (issue #8's
|
|
10
|
-
* makeKeyConfirmation/verifyKeyConfirmation) was skipped entirely.
|
|
11
|
-
*
|
|
12
|
-
* This class adds exactly one thing, no new crypto: a gate. It performs NO
|
|
13
|
-
* network I/O — the caller still transports the handshake messages and the
|
|
14
|
-
* confirmation tags over whatever channel they already use, exactly as for
|
|
15
|
-
* the low-level functions, which are completely unchanged and remain the
|
|
16
|
-
* supported API for advanced use.
|
|
17
|
-
*/
|
|
18
|
-
export class UnconfirmedSessionError extends Error {
|
|
19
|
-
constructor(operation) {
|
|
20
|
-
super(`Cannot ${operation}: key confirmation has not succeeded yet. Call confirmPeer(peerTag) with the tag received from the counterpart first.`);
|
|
21
|
-
this.name = "UnconfirmedSessionError";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export class ConfirmedSession {
|
|
25
|
-
role;
|
|
26
|
-
counterpartRole;
|
|
27
|
-
confirmationKey;
|
|
28
|
-
transcript;
|
|
29
|
-
sender;
|
|
30
|
-
receiver;
|
|
31
|
-
confirmed = false;
|
|
32
|
-
/** The tag to send the counterpart — computed eagerly, send it as soon as you have a channel to send it over. */
|
|
33
|
-
ownConfirmationTag;
|
|
34
|
-
constructor(role, result, transcript) {
|
|
35
|
-
this.role = role;
|
|
36
|
-
this.counterpartRole = role === "initiator" ? "responder" : "initiator";
|
|
37
|
-
// A private copy, same reason FrameSender/FrameReceiver copy their keys
|
|
38
|
-
// (./frameSession.js): destroy() must never reach back and mutate the
|
|
39
|
-
// caller's own handshake-result object.
|
|
40
|
-
this.confirmationKey = result.confirmationKey.slice();
|
|
41
|
-
this.transcript = transcript;
|
|
42
|
-
this.ownConfirmationTag = makeKeyConfirmation(result.confirmationKey, role, transcript);
|
|
43
|
-
const { sender, receiver } = createFrameChannels(result.keys, role);
|
|
44
|
-
this.sender = sender;
|
|
45
|
-
this.receiver = receiver;
|
|
46
|
-
}
|
|
47
|
-
/** Whether `confirmPeer` has already succeeded. `seal`/`open` are only usable once this is true. */
|
|
48
|
-
get isConfirmed() {
|
|
49
|
-
return this.confirmed;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Verifies the tag received from the counterpart. Returns `false` for a
|
|
53
|
-
* wrong or malformed tag — never throws, matching `verifyKeyConfirmation`'s
|
|
54
|
-
* own contract — so you decide what to do (retry, abort, log). Once this
|
|
55
|
-
* returns `true`, the gate opens permanently; nothing closes it again.
|
|
56
|
-
*/
|
|
57
|
-
confirmPeer(peerTag) {
|
|
58
|
-
if (this.confirmed)
|
|
59
|
-
return true;
|
|
60
|
-
if (verifyKeyConfirmation(this.confirmationKey, this.counterpartRole, this.transcript, peerTag)) {
|
|
61
|
-
this.confirmed = true;
|
|
62
|
-
}
|
|
63
|
-
return this.confirmed;
|
|
64
|
-
}
|
|
65
|
-
/** Encrypts `plaintext` at the next counter. Throws UnconfirmedSessionError until `confirmPeer` has succeeded. */
|
|
66
|
-
seal(plaintext, aad) {
|
|
67
|
-
if (!this.confirmed)
|
|
68
|
-
throw new UnconfirmedSessionError("seal");
|
|
69
|
-
return this.sender.seal(plaintext, aad);
|
|
70
|
-
}
|
|
71
|
-
/** Opens a received frame. Throws UnconfirmedSessionError until `confirmPeer` has succeeded — reading content from an unconfirmed counterpart is exactly the mistake key confirmation exists to prevent. */
|
|
72
|
-
open(frame, aad) {
|
|
73
|
-
if (!this.confirmed)
|
|
74
|
-
throw new UnconfirmedSessionError("open");
|
|
75
|
-
return this.receiver.open(frame, aad);
|
|
76
|
-
}
|
|
77
|
-
/** Wipes the wrapped sender/receiver's key copies and this object's own copy of the confirmation key. Unusable afterwards. */
|
|
78
|
-
destroy() {
|
|
79
|
-
this.sender.destroy();
|
|
80
|
-
this.receiver.destroy();
|
|
81
|
-
this.confirmationKey.fill(0);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=confirmedSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirmedSession.js","sourceRoot":"","sources":["../../src/crypto/confirmedSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA8B,MAAM,mBAAmB,CAAC;AAEpF,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAKtB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YAAY,SAA0B;QACpC,KAAK,CAAC,UAAU,SAAS,uHAAuH,CAAC,CAAC;QAClJ,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED,MAAM,OAAO,gBAAgB;IACV,IAAI,CAAgB;IACpB,eAAe,CAAgB;IAC/B,eAAe,CAAa;IAC5B,UAAU,CAAsB;IAChC,MAAM,CAAc;IACpB,QAAQ,CAAgB;IACjC,SAAS,GAAG,KAAK,CAAC;IAE1B,iHAAiH;IACxG,kBAAkB,CAAS;IAEpC,YAAY,IAAmB,EAAE,MAAuD,EAAE,UAA+B;QACvH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;QACxE,wEAAwE;QACxE,sEAAsE;QACtE,wCAAwC;QACxC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QACtD,IAAI,CAA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I,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { type EncryptedFrame } from "./frameCipher.js";
|
|
2
|
-
import type { SessionKeys } from "./hybrid.js";
|
|
3
|
-
/** Thrown for counter misuse: exhausted space, a replayed or out-of-order counter, a malformed counter, or use after destroy(). */
|
|
4
|
-
export declare class FrameCounterError extends Error {
|
|
5
|
-
constructor(message: string);
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Seals frames under one directional key, owning the counter. Use exactly one
|
|
9
|
-
* sender per key, and never create a second sender for a key that has already
|
|
10
|
-
* been used: a new sender starts again at counter 0.
|
|
11
|
-
*/
|
|
12
|
-
export declare class FrameSender {
|
|
13
|
-
private key;
|
|
14
|
-
private next;
|
|
15
|
-
private exhausted;
|
|
16
|
-
constructor(key: Uint8Array);
|
|
17
|
-
/** Encrypts `plaintext` at the next counter. The counter is spent before encrypting, so a failure can never lead to reuse. `aad` has the same meaning as in encryptFrame. */
|
|
18
|
-
seal(plaintext: Uint8Array, aad?: Uint8Array): EncryptedFrame;
|
|
19
|
-
/** Wipes this sender's private copy of the key. The array you passed in is not touched. */
|
|
20
|
-
destroy(): void;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Opens frames under one directional key and rejects any counter that is not
|
|
24
|
-
* higher than the last frame it opened. Gaps are allowed (a dropped frame is
|
|
25
|
-
* not an attack); repeats and reordering are not. State only moves after a
|
|
26
|
-
* frame authenticates, so forged frames cannot advance it.
|
|
27
|
-
*/
|
|
28
|
-
export declare class FrameReceiver {
|
|
29
|
-
private key;
|
|
30
|
-
private last;
|
|
31
|
-
constructor(key: Uint8Array);
|
|
32
|
-
open(frame: EncryptedFrame, aad?: Uint8Array): Uint8Array;
|
|
33
|
-
/** Wipes this receiver's private copy of the key. The array you passed in is not touched. */
|
|
34
|
-
destroy(): void;
|
|
35
|
-
}
|
|
36
|
-
/** Pairs the right directional keys for your role so a sender can never be given the receiving key by mistake. */
|
|
37
|
-
export declare function createFrameChannels(keys: SessionKeys, role: "initiator" | "responder"): {
|
|
38
|
-
sender: FrameSender;
|
|
39
|
-
receiver: FrameReceiver;
|
|
40
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { decryptFrame, encryptFrame } from "./frameCipher.js";
|
|
2
|
-
// Stateful wrappers around encryptFrame/decryptFrame (ADR 0020, issue #35).
|
|
3
|
-
//
|
|
4
|
-
// AES-GCM breaks badly if a (key, nonce) pair is ever used twice, and the
|
|
5
|
-
// low-level functions take the counter from the caller, so a stray retry, a
|
|
6
|
-
// restored snapshot or a second code path sharing a key can reuse one without
|
|
7
|
-
// anyone noticing. These classes own the counter instead: the sender can only
|
|
8
|
-
// move forward and never repeats, the receiver only accepts a counter higher
|
|
9
|
-
// than the last one it successfully opened.
|
|
10
|
-
const KEY_LENGTH = 32;
|
|
11
|
-
/** Thrown for counter misuse: exhausted space, a replayed or out-of-order counter, a malformed counter, or use after destroy(). */
|
|
12
|
-
export class FrameCounterError extends Error {
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "FrameCounterError";
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function copyKey(key) {
|
|
19
|
-
if (!(key instanceof Uint8Array) || key.length !== KEY_LENGTH) {
|
|
20
|
-
throw new TypeError(`Frame key must be a ${KEY_LENGTH}-byte Uint8Array.`);
|
|
21
|
-
}
|
|
22
|
-
return key.slice();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Seals frames under one directional key, owning the counter. Use exactly one
|
|
26
|
-
* sender per key, and never create a second sender for a key that has already
|
|
27
|
-
* been used: a new sender starts again at counter 0.
|
|
28
|
-
*/
|
|
29
|
-
export class FrameSender {
|
|
30
|
-
key;
|
|
31
|
-
next = 0;
|
|
32
|
-
exhausted = false;
|
|
33
|
-
constructor(key) {
|
|
34
|
-
this.key = copyKey(key);
|
|
35
|
-
}
|
|
36
|
-
/** Encrypts `plaintext` at the next counter. The counter is spent before encrypting, so a failure can never lead to reuse. `aad` has the same meaning as in encryptFrame. */
|
|
37
|
-
seal(plaintext, aad) {
|
|
38
|
-
if (!this.key)
|
|
39
|
-
throw new FrameCounterError("This FrameSender was destroyed.");
|
|
40
|
-
if (this.exhausted)
|
|
41
|
-
throw new FrameCounterError("Frame counter space is exhausted for this key; establish a new session.");
|
|
42
|
-
const counter = this.next;
|
|
43
|
-
if (counter === Number.MAX_SAFE_INTEGER)
|
|
44
|
-
this.exhausted = true;
|
|
45
|
-
else
|
|
46
|
-
this.next = counter + 1;
|
|
47
|
-
return encryptFrame(this.key, counter, plaintext, aad);
|
|
48
|
-
}
|
|
49
|
-
/** Wipes this sender's private copy of the key. The array you passed in is not touched. */
|
|
50
|
-
destroy() {
|
|
51
|
-
this.key?.fill(0);
|
|
52
|
-
this.key = null;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Opens frames under one directional key and rejects any counter that is not
|
|
57
|
-
* higher than the last frame it opened. Gaps are allowed (a dropped frame is
|
|
58
|
-
* not an attack); repeats and reordering are not. State only moves after a
|
|
59
|
-
* frame authenticates, so forged frames cannot advance it.
|
|
60
|
-
*/
|
|
61
|
-
export class FrameReceiver {
|
|
62
|
-
key;
|
|
63
|
-
last = -1;
|
|
64
|
-
constructor(key) {
|
|
65
|
-
this.key = copyKey(key);
|
|
66
|
-
}
|
|
67
|
-
open(frame, aad) {
|
|
68
|
-
if (!this.key)
|
|
69
|
-
throw new FrameCounterError("This FrameReceiver was destroyed.");
|
|
70
|
-
const counter = frame?.counter;
|
|
71
|
-
if (typeof counter !== "number" || !Number.isSafeInteger(counter) || counter < 0) {
|
|
72
|
-
throw new FrameCounterError("Frame counter must be a non-negative safe integer.");
|
|
73
|
-
}
|
|
74
|
-
if (counter <= this.last)
|
|
75
|
-
throw new FrameCounterError(`Frame counter ${counter} was already used or is out of order (last accepted: ${this.last}).`);
|
|
76
|
-
const plaintext = decryptFrame(this.key, frame, aad);
|
|
77
|
-
this.last = counter;
|
|
78
|
-
return plaintext;
|
|
79
|
-
}
|
|
80
|
-
/** Wipes this receiver's private copy of the key. The array you passed in is not touched. */
|
|
81
|
-
destroy() {
|
|
82
|
-
this.key?.fill(0);
|
|
83
|
-
this.key = null;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/** Pairs the right directional keys for your role so a sender can never be given the receiving key by mistake. */
|
|
87
|
-
export function createFrameChannels(keys, role) {
|
|
88
|
-
if (role === "initiator") {
|
|
89
|
-
return { sender: new FrameSender(keys.initiatorToResponder), receiver: new FrameReceiver(keys.responderToInitiator) };
|
|
90
|
-
}
|
|
91
|
-
if (role === "responder") {
|
|
92
|
-
return { sender: new FrameSender(keys.responderToInitiator), receiver: new FrameReceiver(keys.initiatorToResponder) };
|
|
93
|
-
}
|
|
94
|
-
throw new TypeError(`Unknown role "${String(role)}": expected "initiator" or "responder".`);
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=frameSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frameSession.js","sourceRoot":"","sources":["../../src/crypto/frameSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAuB,MAAM,kBAAkB,CAAC;AAGnF,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,4CAA4C;AAE5C,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,mIAAmI;AACnI,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,G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,EAAE,CAAC;QACzB,OAAO,EAAE,MAAM,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,QAAQ,EAAE,IAAI,aAAa,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC;IACxH,CAAC;IACD,MAAM,IAAI,SAAS,CAAC,iBAAiB,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;AAC9F,CAAC"}
|
package/dist/passphrase.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passphrase handling shared by every place a passphrase becomes key
|
|
3
|
-
* material (ADR 0017).
|
|
4
|
-
*
|
|
5
|
-
* Normalization: the same visible passphrase can be encoded as different
|
|
6
|
-
* Unicode code point sequences (composed vs decomposed accents, full-width
|
|
7
|
-
* digits, ...) depending on the keyboard, OS or app that typed it, which
|
|
8
|
-
* would derive different keys. Passphrases are normalized to NFKC before
|
|
9
|
-
* the KDF so what the user sees is what unlocks. For pure-ASCII passphrases
|
|
10
|
-
* NFKC is the identity, so nothing changes for them.
|
|
11
|
-
*/
|
|
12
|
-
export declare function normalizePassphrase(passphrase: string): string;
|
|
13
|
-
export declare const MIN_PASSPHRASE_LENGTH = 12;
|
|
14
|
-
/**
|
|
15
|
-
* A caller-supplied passphrase check, run by createIdentity AFTER the
|
|
16
|
-
* built-in checks (length, repeated-character, the small blocklist above)
|
|
17
|
-
* pass. Receives the already-normalized passphrase. Throw (synchronously or
|
|
18
|
-
* via a rejected promise) to reject it with your own message — e.g. because
|
|
19
|
-
* it's found in a real breach corpus, or scores poorly under a strength
|
|
20
|
-
* estimator. This is the actual fix for NIST SP 800-63B's breach-check
|
|
21
|
-
* expectation (ADR 0021): the built-in blocklist above is deliberately not
|
|
22
|
-
* grown to try to meet that bar itself, and this library adds no built-in
|
|
23
|
-
* network-calling checker (e.g. an HIBP lookup) of its own.
|
|
24
|
-
*/
|
|
25
|
-
export type PassphraseChecker = (normalized: string) => void | Promise<void>;
|
|
26
|
-
/** Throws if `passphrase` (already normalized) is unacceptable for a NEW identity. Loading an existing identity never calls this. */
|
|
27
|
-
export declare function assertAcceptablePassphrase(normalized: string): void;
|
package/dist/passphrase.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passphrase handling shared by every place a passphrase becomes key
|
|
3
|
-
* material (ADR 0017).
|
|
4
|
-
*
|
|
5
|
-
* Normalization: the same visible passphrase can be encoded as different
|
|
6
|
-
* Unicode code point sequences (composed vs decomposed accents, full-width
|
|
7
|
-
* digits, ...) depending on the keyboard, OS or app that typed it, which
|
|
8
|
-
* would derive different keys. Passphrases are normalized to NFKC before
|
|
9
|
-
* the KDF so what the user sees is what unlocks. For pure-ASCII passphrases
|
|
10
|
-
* NFKC is the identity, so nothing changes for them.
|
|
11
|
-
*/
|
|
12
|
-
export function normalizePassphrase(passphrase) {
|
|
13
|
-
return passphrase.normalize("NFKC");
|
|
14
|
-
}
|
|
15
|
-
export const MIN_PASSPHRASE_LENGTH = 12;
|
|
16
|
-
/**
|
|
17
|
-
* A deliberately small blocklist of the passphrases that fit a 12-character
|
|
18
|
-
* minimum and appear at the top of every breach list. NIST SP 800-63B asks
|
|
19
|
-
* verifiers to compare against known-compromised values; a few dozen entries
|
|
20
|
-
* cannot do that job, so treat this as a floor, not a strength meter. Apps
|
|
21
|
-
* that care should run a real estimator (e.g. zxcvbn) before calling
|
|
22
|
-
* createIdentity.
|
|
23
|
-
*/
|
|
24
|
-
const COMMON_PASSPHRASES = new Set([
|
|
25
|
-
"passwordpassword",
|
|
26
|
-
"password1234",
|
|
27
|
-
"password12345",
|
|
28
|
-
"password123456",
|
|
29
|
-
"passw0rd1234",
|
|
30
|
-
"123456789012",
|
|
31
|
-
"1234567890123",
|
|
32
|
-
"12345678901234",
|
|
33
|
-
"123456123456",
|
|
34
|
-
"1234512345",
|
|
35
|
-
"111111111111",
|
|
36
|
-
"000000000000",
|
|
37
|
-
"qwertyuiopas",
|
|
38
|
-
"qwertyuiop12",
|
|
39
|
-
"qwertyuiop123",
|
|
40
|
-
"qwertyqwerty",
|
|
41
|
-
"asdfghjklqwe",
|
|
42
|
-
"zxcvbnmasdfg",
|
|
43
|
-
"abcdefghijkl",
|
|
44
|
-
"abcdefghijklm",
|
|
45
|
-
"abcabcabcabc",
|
|
46
|
-
"iloveyouiloveyou",
|
|
47
|
-
"letmeinletmein",
|
|
48
|
-
"welcome12345",
|
|
49
|
-
"welcome123456",
|
|
50
|
-
"administrator",
|
|
51
|
-
"changemechangeme",
|
|
52
|
-
"trustno1trustno1",
|
|
53
|
-
"monkeymonkey",
|
|
54
|
-
"footballfootball",
|
|
55
|
-
]);
|
|
56
|
-
/** Throws if `passphrase` (already normalized) is unacceptable for a NEW identity. Loading an existing identity never calls this. */
|
|
57
|
-
export function assertAcceptablePassphrase(normalized) {
|
|
58
|
-
const codePoints = [...normalized];
|
|
59
|
-
if (codePoints.length < MIN_PASSPHRASE_LENGTH) {
|
|
60
|
-
throw new Error(`Passphrase must be at least ${MIN_PASSPHRASE_LENGTH} characters long.`);
|
|
61
|
-
}
|
|
62
|
-
if (new Set(codePoints).size === 1) {
|
|
63
|
-
throw new Error("Passphrase must not be a single repeated character.");
|
|
64
|
-
}
|
|
65
|
-
if (COMMON_PASSPHRASES.has(normalized.toLowerCase().replace(/\s+/g, ""))) {
|
|
66
|
-
throw new Error("Passphrase is on the list of very common passphrases; choose something less guessable.");
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=passphrase.js.map
|
package/dist/passphrase.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passphrase.js","sourceRoot":"","sources":["../src/passphrase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,OAAO,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,CAAC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