@sideband/secure-relay 0.2.1 → 0.2.3

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.
Files changed (46) hide show
  1. package/README.md +27 -8
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/constants.d.ts +49 -0
  4. package/dist/constants.d.ts.map +1 -0
  5. package/dist/constants.js +51 -0
  6. package/dist/constants.js.map +1 -0
  7. package/dist/crypto.d.ts +70 -0
  8. package/dist/crypto.d.ts.map +1 -0
  9. package/dist/crypto.js +144 -0
  10. package/dist/crypto.js.map +1 -0
  11. package/dist/frame.d.ts +213 -0
  12. package/dist/frame.d.ts.map +1 -0
  13. package/dist/frame.js +547 -0
  14. package/dist/frame.js.map +1 -0
  15. package/dist/handshake.d.ts +39 -0
  16. package/dist/handshake.d.ts.map +1 -0
  17. package/dist/handshake.js +93 -0
  18. package/dist/handshake.js.map +1 -0
  19. package/dist/index.d.ts +46 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +12 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/replay.d.ts +32 -0
  24. package/dist/replay.d.ts.map +1 -0
  25. package/dist/replay.js +88 -0
  26. package/dist/replay.js.map +1 -0
  27. package/dist/session.d.ts +67 -0
  28. package/dist/session.d.ts.map +1 -0
  29. package/dist/session.js +122 -0
  30. package/dist/session.js.map +1 -0
  31. package/dist/types.d.ts +119 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/types.js +80 -0
  34. package/dist/types.js.map +1 -0
  35. package/package.json +4 -4
  36. package/src/constants.ts +3 -3
  37. package/src/crypto.test.ts +5 -5
  38. package/src/crypto.ts +9 -9
  39. package/src/frame.test.ts +59 -10
  40. package/src/frame.ts +101 -77
  41. package/src/handshake.test.ts +29 -41
  42. package/src/handshake.ts +25 -27
  43. package/src/index.ts +4 -10
  44. package/src/integration.test.ts +97 -138
  45. package/src/session.test.ts +12 -10
  46. package/src/types.ts +1 -12
package/dist/types.js ADDED
@@ -0,0 +1,80 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /** Direction of message flow (used in nonce construction) */
3
+ export const Direction = {
4
+ ClientToDaemon: 1,
5
+ DaemonToClient: 2,
6
+ };
7
+ /**
8
+ * SBRP error codes (string constants for SDK use).
9
+ *
10
+ * Wire codes use numeric values in Control frames (see frame.ts).
11
+ * These string constants provide type-safe SDK-level error handling.
12
+ */
13
+ export const SbrpErrorCode = {
14
+ // Authentication (0x01xx) - Terminal
15
+ Unauthorized: "unauthorized",
16
+ Forbidden: "forbidden",
17
+ // Routing (0x02xx) - Varies
18
+ DaemonNotFound: "daemon_not_found",
19
+ DaemonOffline: "daemon_offline",
20
+ // Session (0x03xx) - Terminal
21
+ SessionNotFound: "session_not_found",
22
+ SessionExpired: "session_expired",
23
+ // Wire Format (0x04xx) - Terminal
24
+ MalformedFrame: "malformed_frame",
25
+ PayloadTooLarge: "payload_too_large",
26
+ InvalidFrameType: "invalid_frame_type",
27
+ InvalidSessionId: "invalid_session_id",
28
+ DisallowedSender: "disallowed_sender",
29
+ // Internal (0x06xx) - Terminal
30
+ InternalError: "internal_error",
31
+ // Rate Limiting (0x09xx) - Non-terminal
32
+ RateLimited: "rate_limited",
33
+ // Session State (0x10xx) - Non-terminal
34
+ SessionPaused: "session_paused",
35
+ SessionResumed: "session_resumed",
36
+ SessionEnded: "session_ended",
37
+ SessionPending: "session_pending",
38
+ // Endpoint-only (0xExxx) - Never on wire
39
+ IdentityKeyChanged: "identity_key_changed",
40
+ HandshakeFailed: "handshake_failed",
41
+ HandshakeTimeout: "handshake_timeout",
42
+ DecryptFailed: "decrypt_failed",
43
+ SequenceError: "sequence_error",
44
+ };
45
+ /** Signal codes for Signal frame (0x04) */
46
+ export const SignalCode = {
47
+ Ready: 0x00,
48
+ Close: 0x01,
49
+ };
50
+ /** Reason codes for Signal frames (§13.4) */
51
+ export const SignalReason = {
52
+ /** No specific reason (default for ready signal) */
53
+ None: 0x00,
54
+ /** Process restart, memory cleared */
55
+ StateLost: 0x01,
56
+ /** Graceful daemon shutdown */
57
+ Shutdown: 0x02,
58
+ /** Internal policy denial */
59
+ Policy: 0x03,
60
+ /** Internal daemon error */
61
+ Error: 0x04,
62
+ };
63
+ /** SBRP-specific error */
64
+ export class SbrpError extends Error {
65
+ code;
66
+ constructor(code, message) {
67
+ super(message);
68
+ this.code = code;
69
+ this.name = "SbrpError";
70
+ }
71
+ }
72
+ /** Brand a string as DaemonId (no validation) */
73
+ export function asDaemonId(value) {
74
+ return value;
75
+ }
76
+ /** Brand a string as ClientId (no validation) */
77
+ export function asClientId(value) {
78
+ return value;
79
+ }
80
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AA4DtC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;CACT,CAAC;AAIX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,qCAAqC;IACrC,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IAEtB,4BAA4B;IAC5B,cAAc,EAAE,kBAAkB;IAClC,aAAa,EAAE,gBAAgB;IAE/B,8BAA8B;IAC9B,eAAe,EAAE,mBAAmB;IACpC,cAAc,EAAE,iBAAiB;IAEjC,kCAAkC;IAClC,cAAc,EAAE,iBAAiB;IACjC,eAAe,EAAE,mBAAmB;IACpC,gBAAgB,EAAE,oBAAoB;IACtC,gBAAgB,EAAE,oBAAoB;IACtC,gBAAgB,EAAE,mBAAmB;IAErC,+BAA+B;IAC/B,aAAa,EAAE,gBAAgB;IAE/B,wCAAwC;IACxC,WAAW,EAAE,cAAc;IAE3B,wCAAwC;IACxC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,YAAY,EAAE,eAAe;IAC7B,cAAc,EAAE,iBAAiB;IAEjC,yCAAyC;IACzC,kBAAkB,EAAE,sBAAsB;IAC1C,eAAe,EAAE,kBAAkB;IACnC,gBAAgB,EAAE,mBAAmB;IACrC,aAAa,EAAE,gBAAgB;IAC/B,aAAa,EAAE,gBAAgB;CACvB,CAAC;AAIX,2CAA2C;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;CACH,CAAC;AAIX,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,oDAAoD;IACpD,IAAI,EAAE,IAAI;IACV,sCAAsC;IACtC,SAAS,EAAE,IAAI;IACf,+BAA+B;IAC/B,QAAQ,EAAE,IAAI;IACd,6BAA6B;IAC7B,MAAM,EAAE,IAAI;IACZ,4BAA4B;IAC5B,KAAK,EAAE,IAAI;CACH,CAAC;AAIX,0BAA0B;AAC1B,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEhB;IADlB,YACkB,IAAmB,EACnC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAe;QAInC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAED,iDAAiD;AACjD,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAiB,CAAC;AAC3B,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAiB,CAAC;AAC3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideband/secure-relay",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Secure Relay Protocol (SBRP): E2EE handshake, session encryption, and TOFU identity pinning for relay-mediated communication.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -45,9 +45,9 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "dependencies": {
48
- "@noble/ciphers": "^1.2.1",
49
- "@noble/curves": "^1.8.1",
50
- "@noble/hashes": "^1.7.1"
48
+ "@noble/ciphers": "^2.1.1",
49
+ "@noble/curves": "^2.0.1",
50
+ "@noble/hashes": "^2.0.1"
51
51
  },
52
52
  "files": [
53
53
  "dist",
package/src/constants.ts CHANGED
@@ -13,7 +13,7 @@ export const SBRP_TRANSCRIPT_CONTEXT = "sbrp-v1-transcript";
13
13
  /** HKDF info string for session key derivation */
14
14
  export const SBRP_SESSION_KEYS_INFO = "sbrp-session-keys";
15
15
 
16
- /** Length of session keys in bytes (browserToDaemon + daemonToBrowser) */
16
+ /** Length of session keys in bytes (clientToDaemon + daemonToClient) */
17
17
  export const SESSION_KEYS_LENGTH = 64;
18
18
 
19
19
  /** Length of a single symmetric key in bytes */
@@ -58,8 +58,8 @@ export const MAX_PAYLOAD_SIZE = 65536;
58
58
  /** HandshakeInit payload: X25519 ephemeral public key */
59
59
  export const HANDSHAKE_INIT_PAYLOAD_SIZE = 32;
60
60
 
61
- /** HandshakeAccept payload: X25519 ephemeral (32) + Ed25519 signature (64) */
62
- export const HANDSHAKE_ACCEPT_PAYLOAD_SIZE = 96;
61
+ /** HandshakeAccept payload: Ed25519 identity key (32) + X25519 ephemeral (32) + Ed25519 signature (64) */
62
+ export const HANDSHAKE_ACCEPT_PAYLOAD_SIZE = 128;
63
63
 
64
64
  /** Minimum encrypted payload: nonce (12) + authTag (16), no plaintext */
65
65
  export const MIN_ENCRYPTED_PAYLOAD_SIZE = NONCE_LENGTH + AUTH_TAG_LENGTH;
@@ -153,7 +153,7 @@ describe("crypto", () => {
153
153
 
154
154
  const signature = signPayload(payload, privateKey);
155
155
  // Tamper with signature
156
- signature[0] ^= 0xff;
156
+ signature[0] = signature[0]! ^ 0xff;
157
157
 
158
158
  const valid = verifySignature(payload, signature, publicKey);
159
159
  expect(valid).toBe(false);
@@ -398,7 +398,7 @@ describe("crypto", () => {
398
398
  expect(encrypted.length).toBeGreaterThanOrEqual(NONCE_LENGTH + 16); // nonce + authTag
399
399
  const nonce = encrypted.slice(0, NONCE_LENGTH);
400
400
  const expected = constructNonce(Direction.ClientToDaemon, 42n);
401
- expect(nonce).toEqual(expected);
401
+ expect(Array.from(nonce)).toEqual(Array.from(expected));
402
402
  });
403
403
 
404
404
  it("decryption fails with wrong key", () => {
@@ -416,7 +416,7 @@ describe("crypto", () => {
416
416
 
417
417
  const encrypted = encrypt(key, Direction.ClientToDaemon, 1n, plaintext);
418
418
  // Tamper with ciphertext (after nonce)
419
- encrypted[NONCE_LENGTH + 1] ^= 0xff;
419
+ encrypted[NONCE_LENGTH + 1] = encrypted[NONCE_LENGTH + 1]! ^ 0xff;
420
420
 
421
421
  expect(() => decrypt(key, encrypted)).toThrow();
422
422
  });
@@ -427,7 +427,7 @@ describe("crypto", () => {
427
427
 
428
428
  const encrypted = encrypt(key, Direction.ClientToDaemon, 1n, plaintext);
429
429
  // Tamper with last byte (auth tag)
430
- encrypted[encrypted.length - 1] ^= 0xff;
430
+ encrypted[encrypted.length - 1] = encrypted[encrypted.length - 1]! ^ 0xff;
431
431
 
432
432
  expect(() => decrypt(key, encrypted)).toThrow();
433
433
  });
@@ -438,7 +438,7 @@ describe("crypto", () => {
438
438
 
439
439
  const encrypted = encrypt(key, Direction.ClientToDaemon, 1n, plaintext);
440
440
  // Tamper with nonce
441
- encrypted[0] ^= 0xff;
441
+ encrypted[0] = encrypted[0]! ^ 0xff;
442
442
 
443
443
  expect(() => decrypt(key, encrypted)).toThrow();
444
444
  });
package/src/crypto.ts CHANGED
@@ -7,12 +7,12 @@
7
7
  * and @noble/hashes for SHA-256/HKDF.
8
8
  */
9
9
 
10
- import { chacha20poly1305 } from "@noble/ciphers/chacha";
11
- import { ed25519 } from "@noble/curves/ed25519";
12
- import { x25519 } from "@noble/curves/ed25519";
13
- import { hkdf } from "@noble/hashes/hkdf";
14
- import { sha256 } from "@noble/hashes/sha256";
15
- import { concatBytes, randomBytes } from "@noble/hashes/utils";
10
+ import { chacha20poly1305 } from "@noble/ciphers/chacha.js";
11
+ import { ed25519 } from "@noble/curves/ed25519.js";
12
+ import { x25519 } from "@noble/curves/ed25519.js";
13
+ import { hkdf } from "@noble/hashes/hkdf.js";
14
+ import { sha256 } from "@noble/hashes/sha2.js";
15
+ import { concatBytes, randomBytes } from "@noble/hashes/utils.js";
16
16
  import {
17
17
  AUTH_TAG_LENGTH,
18
18
  DIRECTION_CLIENT_TO_DAEMON,
@@ -36,14 +36,14 @@ const textEncoder = new TextEncoder();
36
36
 
37
37
  /** Generate a new Ed25519 identity keypair */
38
38
  export function generateIdentityKeyPair(): IdentityKeyPair {
39
- const privateKey = ed25519.utils.randomPrivateKey();
39
+ const privateKey = ed25519.utils.randomSecretKey();
40
40
  const publicKey = ed25519.getPublicKey(privateKey);
41
41
  return { publicKey, privateKey };
42
42
  }
43
43
 
44
44
  /** Generate a new X25519 ephemeral keypair */
45
45
  export function generateEphemeralKeyPair(): EphemeralKeyPair {
46
- const privateKey = x25519.utils.randomPrivateKey();
46
+ const privateKey = x25519.utils.randomSecretKey();
47
47
  const publicKey = x25519.getPublicKey(privateKey);
48
48
  return { publicKey, privateKey };
49
49
  }
@@ -137,7 +137,7 @@ export function deriveSessionKeys(
137
137
  sha256,
138
138
  sharedSecret,
139
139
  transcriptHash,
140
- SBRP_SESSION_KEYS_INFO,
140
+ textEncoder.encode(SBRP_SESSION_KEYS_INFO),
141
141
  SESSION_KEYS_LENGTH,
142
142
  );
143
143
 
package/src/frame.test.ts CHANGED
@@ -100,6 +100,13 @@ describe("frame codec", () => {
100
100
  expect(() => readFrameHeader(short)).toThrow(SbrpError);
101
101
  });
102
102
 
103
+ it("rejects unknown frame type", () => {
104
+ const frame = new Uint8Array(FRAME_HEADER_SIZE);
105
+ frame[0] = 0x99; // Unknown type
106
+ expect(() => readFrameHeader(frame)).toThrow(SbrpError);
107
+ expect(() => readFrameHeader(frame)).toThrow(/Unknown frame type/);
108
+ });
109
+
103
110
  it("rejects invalid payload length in header", () => {
104
111
  const frame = new Uint8Array(FRAME_HEADER_SIZE);
105
112
  frame[0] = FrameType.Data;
@@ -222,9 +229,23 @@ describe("frame codec", () => {
222
229
  );
223
230
  });
224
231
 
232
+ it("rejects wrong identityPublicKey size", () => {
233
+ const wrongSize: HandshakeAccept = {
234
+ type: "handshake.accept",
235
+ identityPublicKey: new Uint8Array(16), // should be 32
236
+ acceptPublicKey: new Uint8Array(32),
237
+ signature: new Uint8Array(64),
238
+ };
239
+ expect(() => encodeHandshakeAccept(1n, wrongSize)).toThrow(SbrpError);
240
+ expect(() => encodeHandshakeAccept(1n, wrongSize)).toThrow(
241
+ /identityPublicKey must be 32 bytes/,
242
+ );
243
+ });
244
+
225
245
  it("rejects wrong acceptPublicKey size", () => {
226
246
  const wrongSize: HandshakeAccept = {
227
247
  type: "handshake.accept",
248
+ identityPublicKey: new Uint8Array(32),
228
249
  acceptPublicKey: new Uint8Array(16), // should be 32
229
250
  signature: new Uint8Array(64),
230
251
  };
@@ -234,6 +255,7 @@ describe("frame codec", () => {
234
255
  it("rejects wrong signature size", () => {
235
256
  const wrongSize: HandshakeAccept = {
236
257
  type: "handshake.accept",
258
+ identityPublicKey: new Uint8Array(32),
237
259
  acceptPublicKey: new Uint8Array(32),
238
260
  signature: new Uint8Array(32), // should be 64
239
261
  };
@@ -313,10 +335,12 @@ describe("frame codec", () => {
313
335
 
314
336
  describe("HandshakeAccept", () => {
315
337
  it("encodes and decodes correctly", () => {
338
+ const identityPublicKey = new Uint8Array(32).fill(0xab);
316
339
  const acceptPublicKey = new Uint8Array(32).fill(0xcd);
317
340
  const signature = new Uint8Array(64).fill(0xef);
318
341
  const accept: HandshakeAccept = {
319
342
  type: "handshake.accept",
343
+ identityPublicKey,
320
344
  acceptPublicKey,
321
345
  signature,
322
346
  };
@@ -331,6 +355,7 @@ describe("frame codec", () => {
331
355
 
332
356
  const decoded = decodeHandshakeAccept(frame);
333
357
  expect(decoded.type).toBe("handshake.accept");
358
+ expect(decoded.identityPublicKey).toEqual(identityPublicKey);
334
359
  expect(decoded.acceptPublicKey).toEqual(acceptPublicKey);
335
360
  expect(decoded.signature).toEqual(signature);
336
361
  });
@@ -343,10 +368,10 @@ describe("frame codec", () => {
343
368
  });
344
369
 
345
370
  it("rejects zero sessionId on decode", () => {
346
- const payload = new Uint8Array(96);
347
- const frame = new Uint8Array(FRAME_HEADER_SIZE + 96);
371
+ const payload = new Uint8Array(128);
372
+ const frame = new Uint8Array(FRAME_HEADER_SIZE + 128);
348
373
  frame[0] = FrameType.HandshakeAccept;
349
- new DataView(frame.buffer).setUint32(1, 96, false);
374
+ new DataView(frame.buffer).setUint32(1, 128, false);
350
375
  frame.set(payload, FRAME_HEADER_SIZE);
351
376
 
352
377
  // Validation happens at decodeFrame level (via readFrameHeader)
@@ -434,7 +459,7 @@ describe("frame codec", () => {
434
459
 
435
460
  const signal = decodeSignal(frame);
436
461
  expect(signal.signal).toBe(SignalCode.Ready);
437
- expect(signal.reason).toBe(0);
462
+ expect(signal.reason).toBe(SignalReason.None);
438
463
  });
439
464
 
440
465
  it("encodes and decodes close signal with reason", () => {
@@ -472,6 +497,22 @@ describe("frame codec", () => {
472
497
  expect(signal.reason).toBe(SignalReason.None);
473
498
  });
474
499
 
500
+ it("rejects unknown signal code", () => {
501
+ const payload = new Uint8Array([0xff, 0x00]); // Unknown signal, valid reason
502
+ const encoded = encodeFrame(FrameType.Signal, 1n, payload);
503
+ const frame = decodeFrame(encoded);
504
+ expect(() => decodeSignal(frame)).toThrow(SbrpError);
505
+ expect(() => decodeSignal(frame)).toThrow(/Unknown signal code/);
506
+ });
507
+
508
+ it("rejects unknown signal reason", () => {
509
+ const payload = new Uint8Array([0x01, 0xff]); // Valid signal (Close), unknown reason
510
+ const encoded = encodeFrame(FrameType.Signal, 1n, payload);
511
+ const frame = decodeFrame(encoded);
512
+ expect(() => decodeSignal(frame)).toThrow(SbrpError);
513
+ expect(() => decodeSignal(frame)).toThrow(/Unknown signal reason/);
514
+ });
515
+
475
516
  it("rejects wrong payload size", () => {
476
517
  const wrongPayload = new Uint8Array(3);
477
518
  const encoded = encodeFrame(FrameType.Signal, 1n, wrongPayload);
@@ -531,6 +572,14 @@ describe("frame codec", () => {
531
572
  const frame = decodeFrame(encoded);
532
573
  expect(() => decodeControl(frame)).toThrow(SbrpError);
533
574
  });
575
+
576
+ it("rejects unknown control code", () => {
577
+ const payload = new Uint8Array([0x99, 0x99]); // Unknown code 0x9999
578
+ const encoded = encodeFrame(FrameType.Control, 0n, payload);
579
+ const frame = decodeFrame(encoded);
580
+ expect(() => decodeControl(frame)).toThrow(SbrpError);
581
+ expect(() => decodeControl(frame)).toThrow(/Unknown control code/);
582
+ });
534
583
  });
535
584
 
536
585
  describe("isTerminalCode", () => {
@@ -744,8 +793,8 @@ describe("frame codec", () => {
744
793
  const frame = encodePing();
745
794
  const frames = [...decoder.push(frame)];
746
795
  expect(frames.length).toBe(1);
747
- expect(frames[0].type).toBe(FrameType.Ping);
748
- expect(frames[0].sessionId).toBe(0n);
796
+ expect(frames[0]!.type).toBe(FrameType.Ping);
797
+ expect(frames[0]!.sessionId).toBe(0n);
749
798
  });
750
799
 
751
800
  it("decodes multiple frames in one push", () => {
@@ -758,8 +807,8 @@ describe("frame codec", () => {
758
807
 
759
808
  const frames = [...decoder.push(combined)];
760
809
  expect(frames.length).toBe(2);
761
- expect(frames[0].type).toBe(FrameType.Ping);
762
- expect(frames[1].type).toBe(FrameType.Pong);
810
+ expect(frames[0]!.type).toBe(FrameType.Ping);
811
+ expect(frames[1]!.type).toBe(FrameType.Pong);
763
812
  });
764
813
 
765
814
  it("buffers incomplete frames", () => {
@@ -774,7 +823,7 @@ describe("frame codec", () => {
774
823
  // Push rest
775
824
  frames = [...decoder.push(frame.subarray(FRAME_HEADER_SIZE))];
776
825
  expect(frames.length).toBe(1);
777
- expect(frames[0].type).toBe(FrameType.Control);
826
+ expect(frames[0]!.type).toBe(FrameType.Control);
778
827
  expect(decoder.bufferedBytes).toBe(0);
779
828
  });
780
829
 
@@ -791,7 +840,7 @@ describe("frame codec", () => {
791
840
  }
792
841
 
793
842
  expect(allFrames.length).toBe(1);
794
- expect(allFrames[0].type).toBe(FrameType.Ping);
843
+ expect(allFrames[0]!.type).toBe(FrameType.Ping);
795
844
  });
796
845
 
797
846
  it("resets state correctly", () => {