@sideband/secure-relay 0.2.2 → 0.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.
Files changed (46) hide show
  1. package/README.md +6 -4
  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 +219 -0
  12. package/dist/frame.d.ts.map +1 -0
  13. package/dist/frame.js +554 -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 +120 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/types.js +81 -0
  34. package/dist/types.js.map +1 -0
  35. package/package.json +1 -1
  36. package/src/constants.ts +3 -3
  37. package/src/crypto.test.ts +5 -5
  38. package/src/frame.test.ts +113 -47
  39. package/src/frame.ts +119 -86
  40. package/src/handshake.test.ts +29 -41
  41. package/src/handshake.ts +25 -27
  42. package/src/index.ts +4 -10
  43. package/src/integration.test.ts +97 -138
  44. package/src/session.test.ts +12 -10
  45. package/src/types.ts +4 -14
  46. /package/{dist/LICENSE → LICENSE} +0 -0
package/src/types.ts CHANGED
@@ -29,18 +29,6 @@ export interface EphemeralKeyPair {
29
29
  privateKey: Uint8Array; // 32 bytes
30
30
  }
31
31
 
32
- /**
33
- * TOFU trust record for daemon identity.
34
- * Pinned on first connect, verified on reconnect to detect MITM.
35
- * Per-client; not synced via relay.
36
- */
37
- export interface PinnedIdentity {
38
- daemonId: DaemonId;
39
- identityPublicKey: Uint8Array; // 32 bytes Ed25519 public key
40
- firstSeen: Date;
41
- lastSeen: Date;
42
- }
43
-
44
32
  /** Session keys derived from handshake (directional symmetric keys) */
45
33
  export interface SessionKeys {
46
34
  /** Key for encrypting client→daemon messages */
@@ -58,6 +46,7 @@ export interface HandshakeInit {
58
46
  /** Handshake accept message (daemon → client) */
59
47
  export interface HandshakeAccept {
60
48
  type: "handshake.accept";
49
+ identityPublicKey: Uint8Array; // Ed25519 identity public key (for TOFU)
61
50
  acceptPublicKey: Uint8Array; // X25519 ephemeral public key
62
51
  signature: Uint8Array; // Ed25519 signature
63
52
  }
@@ -88,7 +77,7 @@ export const SbrpErrorCode = {
88
77
  Unauthorized: "unauthorized",
89
78
  Forbidden: "forbidden",
90
79
 
91
- // Routing (0x02xx) - Varies
80
+ // Routing (0x02xx) - Terminal
92
81
  DaemonNotFound: "daemon_not_found",
93
82
  DaemonOffline: "daemon_offline",
94
83
 
@@ -106,8 +95,9 @@ export const SbrpErrorCode = {
106
95
  // Internal (0x06xx) - Terminal
107
96
  InternalError: "internal_error",
108
97
 
109
- // Rate Limiting (0x09xx) - Non-terminal
98
+ // Throttling (0x09xx) - Varies (rate_limited=N, backpressure=T)
110
99
  RateLimited: "rate_limited",
100
+ Backpressure: "backpressure",
111
101
 
112
102
  // Session State (0x10xx) - Non-terminal
113
103
  SessionPaused: "session_paused",
File without changes