@rstreamlabs/webtty 1.9.1 → 1.10.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/README.md +39 -9
- package/dist/{chunk-QOAMHBHC.mjs → chunk-6DA72SBW.mjs} +368 -47
- package/dist/index.d.mts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +370 -47
- package/dist/index.mjs +5 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +385 -52
- package/dist/node.mjs +20 -6
- package/package.json +5 -5
package/dist/node.mjs
CHANGED
|
@@ -33,15 +33,19 @@ import {
|
|
|
33
33
|
verifyWebTTYServerProofTranscript,
|
|
34
34
|
webTTYClientProofTranscriptBytes,
|
|
35
35
|
webTTYE2EKeyID,
|
|
36
|
+
webTTYFIPSCompatibleKeyEnvelopeSuite,
|
|
37
|
+
webTTYFIPSCompatiblePayloadSuite,
|
|
36
38
|
webTTYRecordedEventEncryptedPayload,
|
|
37
39
|
webTTYServerProofTranscriptBytes,
|
|
38
40
|
webTTYSigningKeyID
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-6DA72SBW.mjs";
|
|
40
42
|
|
|
41
43
|
// src/local-e2e.ts
|
|
42
44
|
var localKeyFileVersion = 1;
|
|
43
45
|
var localKeyFileCryptoSuite = "webtty-e2e-x25519-hpke-aes-256-gcm-v1";
|
|
46
|
+
var localKeyFileFIPSCompatibleCryptoSuite = "webtty-e2e-p256-hkdf-sha256-aes-256-gcm-random-nonce-v1";
|
|
44
47
|
var x25519PublicKeySize = 32;
|
|
48
|
+
var p256PublicKeySize = 65;
|
|
45
49
|
var payloadKeyIDSize = 16;
|
|
46
50
|
var knownServerKeyEnv = "RSTREAM_WEBTTY_KNOWN_SERVER_KEY";
|
|
47
51
|
var knownServersFileEnv = "RSTREAM_WEBTTY_KNOWN_SERVERS_FILE";
|
|
@@ -69,9 +73,8 @@ async function parseWebTTYKnownServerKey(value) {
|
|
|
69
73
|
validateSigningKeyMaterial(parts[2] ?? "", parts[3] ?? "");
|
|
70
74
|
}
|
|
71
75
|
if (parts.length === 1) {
|
|
72
|
-
const publicKey2 =
|
|
76
|
+
const publicKey2 = decodeEncryptionPublicKey(
|
|
73
77
|
parts[0] ?? "",
|
|
74
|
-
x25519PublicKeySize,
|
|
75
78
|
"known WebTTY server public key"
|
|
76
79
|
);
|
|
77
80
|
return { keyId: await webTTYE2EKeyID(publicKey2), publicKey: publicKey2 };
|
|
@@ -81,9 +84,8 @@ async function parseWebTTYKnownServerKey(value) {
|
|
|
81
84
|
payloadKeyIDSize,
|
|
82
85
|
"known WebTTY server key id"
|
|
83
86
|
);
|
|
84
|
-
const publicKey =
|
|
87
|
+
const publicKey = decodeEncryptionPublicKey(
|
|
85
88
|
parts[1] ?? "",
|
|
86
|
-
x25519PublicKeySize,
|
|
87
89
|
"known WebTTY server public key"
|
|
88
90
|
);
|
|
89
91
|
const expectedKeyId = await webTTYE2EKeyID(publicKey);
|
|
@@ -178,7 +180,7 @@ function decodeWebTTYKnownServerKeysFile(data, filePath) {
|
|
|
178
180
|
);
|
|
179
181
|
}
|
|
180
182
|
const cryptoSuite = parsed.crypto_suite;
|
|
181
|
-
if (cryptoSuite !== localKeyFileCryptoSuite) {
|
|
183
|
+
if (cryptoSuite !== localKeyFileCryptoSuite && cryptoSuite !== localKeyFileFIPSCompatibleCryptoSuite) {
|
|
182
184
|
throw new Error(
|
|
183
185
|
`unsupported known WebTTY server keys crypto suite ${String(cryptoSuite)}`
|
|
184
186
|
);
|
|
@@ -288,6 +290,16 @@ function decodeFixedKeyMaterial(value, size, label) {
|
|
|
288
290
|
}
|
|
289
291
|
return decoded;
|
|
290
292
|
}
|
|
293
|
+
function decodeEncryptionPublicKey(value, label) {
|
|
294
|
+
const decoded = decodeWebTTYE2EKeyMaterial(value.trim());
|
|
295
|
+
if (decoded.byteLength === x25519PublicKeySize) return decoded;
|
|
296
|
+
if (decoded.byteLength === p256PublicKeySize && decoded[0] === 4) {
|
|
297
|
+
return decoded;
|
|
298
|
+
}
|
|
299
|
+
throw new Error(
|
|
300
|
+
`${label} must decode to a ${x25519PublicKeySize}-byte X25519 key or an uncompressed ${p256PublicKeySize}-byte P-256 point`
|
|
301
|
+
);
|
|
302
|
+
}
|
|
291
303
|
function validateSigningKeyMaterial(keyID, publicKey) {
|
|
292
304
|
decodeFixedKeyMaterial(keyID, 32, "known WebTTY server signing key id");
|
|
293
305
|
decodeWebTTYE2EKeyMaterial(publicKey.trim());
|
|
@@ -445,6 +457,8 @@ export {
|
|
|
445
457
|
verifyWebTTYServerProofTranscript,
|
|
446
458
|
webTTYClientProofTranscriptBytes,
|
|
447
459
|
webTTYE2EKeyID,
|
|
460
|
+
webTTYFIPSCompatibleKeyEnvelopeSuite,
|
|
461
|
+
webTTYFIPSCompatiblePayloadSuite,
|
|
448
462
|
webTTYRecordedEventEncryptedPayload,
|
|
449
463
|
webTTYServerProofTranscriptBytes,
|
|
450
464
|
webTTYSigningKeyID
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstreamlabs/webtty",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Client-side implementation of the rstream WebTTY protocol.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"type-check": "tsc --noEmit"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@turbo/gen": "^2.10.
|
|
44
|
+
"@turbo/gen": "^2.10.11",
|
|
45
45
|
"@types/node": "^26",
|
|
46
46
|
"eslint": "9.39.5",
|
|
47
47
|
"eslint-config": "*",
|
|
48
|
-
"protobufjs-cli": "^2.6.
|
|
48
|
+
"protobufjs-cli": "^2.6.2",
|
|
49
49
|
"tsup": "^8.5.1",
|
|
50
50
|
"typescript": "6.0.3",
|
|
51
51
|
"typescript-config": "*",
|
|
52
|
-
"ws": "^8.21.
|
|
52
|
+
"ws": "^8.21.3"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"protobufjs": "^8.7.
|
|
55
|
+
"protobufjs": "^8.7.2"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|