@open-e2ee/signal-protocol-sdk 1.0.0 → 2.0.1

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 (137) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/COMMERCIAL.md +1 -1
  3. package/README.md +38 -34
  4. package/SECURITY.md +2 -2
  5. package/dist/client/constants.d.ts +4 -2
  6. package/dist/client/constants.d.ts.map +1 -1
  7. package/dist/client/constants.js +4 -2
  8. package/dist/client/constants.js.map +1 -1
  9. package/dist/client/group-outbox.d.ts.map +1 -1
  10. package/dist/client/group-outbox.js +4 -1
  11. package/dist/client/group-outbox.js.map +1 -1
  12. package/dist/client/hosted-connection.d.ts +16 -0
  13. package/dist/client/hosted-connection.d.ts.map +1 -0
  14. package/dist/client/hosted-connection.js +255 -0
  15. package/dist/client/hosted-connection.js.map +1 -0
  16. package/dist/client/hosted-push.d.ts +17 -37
  17. package/dist/client/hosted-push.d.ts.map +1 -1
  18. package/dist/client/hosted-push.js +46 -21
  19. package/dist/client/hosted-push.js.map +1 -1
  20. package/dist/client/hosted-transport.d.ts +158 -0
  21. package/dist/client/hosted-transport.d.ts.map +1 -0
  22. package/dist/client/hosted-transport.js +926 -0
  23. package/dist/client/hosted-transport.js.map +1 -0
  24. package/dist/client/hosted.d.ts +30 -14
  25. package/dist/client/hosted.d.ts.map +1 -1
  26. package/dist/client/hosted.js +65 -29
  27. package/dist/client/hosted.js.map +1 -1
  28. package/dist/client/index.d.ts +2 -2
  29. package/dist/client/index.d.ts.map +1 -1
  30. package/dist/client/index.js.map +1 -1
  31. package/dist/client/messages.d.ts.map +1 -1
  32. package/dist/client/messages.js +4 -5
  33. package/dist/client/messages.js.map +1 -1
  34. package/dist/client/relay-subscription.js +3 -0
  35. package/dist/client/relay-subscription.js.map +1 -1
  36. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  37. package/dist/client/signal-service-cipher.js +4 -1
  38. package/dist/client/signal-service-cipher.js.map +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/internal/crypto/pq/kyber.d.ts.map +1 -1
  43. package/dist/internal/crypto/pq/kyber.js +5 -7
  44. package/dist/internal/crypto/pq/kyber.js.map +1 -1
  45. package/dist/internal/crypto/random-host.d.ts +2 -0
  46. package/dist/internal/crypto/random-host.d.ts.map +1 -0
  47. package/dist/internal/crypto/random-host.js +12 -0
  48. package/dist/internal/crypto/random-host.js.map +1 -0
  49. package/dist/internal/crypto/random-host.native.d.ts +2 -0
  50. package/dist/internal/crypto/random-host.native.d.ts.map +1 -0
  51. package/dist/internal/crypto/random-host.native.js +16 -0
  52. package/dist/internal/crypto/random-host.native.js.map +1 -0
  53. package/dist/internal/crypto/random-host.node.d.ts +2 -0
  54. package/dist/internal/crypto/random-host.node.d.ts.map +1 -0
  55. package/dist/internal/crypto/random-host.node.js +9 -0
  56. package/dist/internal/crypto/random-host.node.js.map +1 -0
  57. package/dist/internal/crypto/random.d.ts +1 -20
  58. package/dist/internal/crypto/random.d.ts.map +1 -1
  59. package/dist/internal/crypto/random.js +5 -41
  60. package/dist/internal/crypto/random.js.map +1 -1
  61. package/dist/internal/crypto/symmetric/aes-provider.d.ts +5 -0
  62. package/dist/internal/crypto/symmetric/aes-provider.d.ts.map +1 -0
  63. package/dist/internal/crypto/symmetric/aes-provider.js +26 -0
  64. package/dist/internal/crypto/symmetric/aes-provider.js.map +1 -0
  65. package/dist/internal/crypto/symmetric/aes.d.ts +0 -8
  66. package/dist/internal/crypto/symmetric/aes.d.ts.map +1 -1
  67. package/dist/internal/crypto/symmetric/aes.js +12 -81
  68. package/dist/internal/crypto/symmetric/aes.js.map +1 -1
  69. package/dist/layers.d.ts +5 -1
  70. package/dist/layers.d.ts.map +1 -1
  71. package/dist/layers.js +5 -1
  72. package/dist/layers.js.map +1 -1
  73. package/dist/local/store/expo/models/recipient-identity.js +2 -2
  74. package/dist/local/store/expo/models/recipient-identity.js.map +1 -1
  75. package/dist/local/store/expo/schema.d.ts +62 -0
  76. package/dist/local/store/expo/schema.d.ts.map +1 -1
  77. package/dist/local/store/expo/schema.js +5 -0
  78. package/dist/local/store/expo/schema.js.map +1 -1
  79. package/dist/logger.d.ts.map +1 -1
  80. package/dist/logger.js +0 -7
  81. package/dist/logger.js.map +1 -1
  82. package/dist/media/index.d.ts.map +1 -1
  83. package/dist/media/index.js +7 -4
  84. package/dist/media/index.js.map +1 -1
  85. package/dist/remote/object-store/convex-r2/server.d.ts +4 -2
  86. package/dist/remote/object-store/convex-r2/server.d.ts.map +1 -1
  87. package/dist/remote/object-store/convex-r2/server.js +8 -0
  88. package/dist/remote/object-store/convex-r2/server.js.map +1 -1
  89. package/dist/remote/object-store/convex-r2/storage.d.ts +5 -1
  90. package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -1
  91. package/dist/remote/object-store/convex-r2/storage.js +1 -0
  92. package/dist/remote/object-store/convex-r2/storage.js.map +1 -1
  93. package/dist/remote/object-store/types.d.ts +2 -0
  94. package/dist/remote/object-store/types.d.ts.map +1 -1
  95. package/dist/remote/object-store/validation.d.ts.map +1 -1
  96. package/dist/remote/object-store/validation.js +3 -0
  97. package/dist/remote/object-store/validation.js.map +1 -1
  98. package/dist/remote/relay/convex/backend.d.ts +3 -4
  99. package/dist/remote/relay/convex/backend.d.ts.map +1 -1
  100. package/dist/remote/relay/convex/backend.js +4 -4
  101. package/dist/remote/relay/convex/backend.js.map +1 -1
  102. package/dist/remote/relay/convex/component/_generated/component.d.ts +3 -4
  103. package/dist/remote/relay/convex/component/_generated/component.d.ts.map +1 -1
  104. package/dist/remote/relay/convex/component/messages.d.ts +3 -4
  105. package/dist/remote/relay/convex/component/messages.d.ts.map +1 -1
  106. package/dist/remote/relay/convex/component/messages.js +15 -9
  107. package/dist/remote/relay/convex/component/messages.js.map +1 -1
  108. package/dist/remote/relay/convex/component/schema.d.ts +3 -5
  109. package/dist/remote/relay/convex/component/schema.js +1 -2
  110. package/dist/remote/relay/convex/component/schema.js.map +1 -1
  111. package/dist/remote/relay/convex/relay.d.ts +1 -1
  112. package/dist/remote/relay/convex/relay.d.ts.map +1 -1
  113. package/dist/remote/relay/convex/relay.js +6 -3
  114. package/dist/remote/relay/convex/relay.js.map +1 -1
  115. package/dist/remote/relay/index.d.ts +1 -1
  116. package/dist/remote/relay/index.d.ts.map +1 -1
  117. package/dist/remote/relay/index.js.map +1 -1
  118. package/dist/remote/relay/memory/adapter.d.ts +1 -2
  119. package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
  120. package/dist/remote/relay/memory/adapter.js +13 -4
  121. package/dist/remote/relay/memory/adapter.js.map +1 -1
  122. package/dist/remote/relay/types.d.ts +13 -10
  123. package/dist/remote/relay/types.d.ts.map +1 -1
  124. package/dist/types/errors.d.ts +6 -1
  125. package/dist/types/errors.d.ts.map +1 -1
  126. package/dist/types/errors.js +6 -1
  127. package/dist/types/errors.js.map +1 -1
  128. package/docs/ASSURANCE.md +81 -141
  129. package/examples/browser/README.md +35 -0
  130. package/examples/browser/index.html +27 -0
  131. package/examples/browser/src/exchange.ts +69 -0
  132. package/examples/browser/src/main.ts +63 -0
  133. package/examples/browser/src/style.css +9 -0
  134. package/examples/browser/src/worker.ts +10 -0
  135. package/examples/browser/vite.config.ts +9 -0
  136. package/package.json +18 -3
  137. package/remote/relay/convex/component/README.md +8 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,81 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.1
4
+
5
+ - Select secure randomness for browsers, Node, and Expo through package imports.
6
+ ML-KEM receives explicit random input on Hermes.
7
+ React Native uses the application's Web Crypto provider before loading Expo crypto.
8
+ - Use Noble AES when the runtime has no Web Crypto implementation.
9
+ - Export the metadata table required by Expo storage. Read recipient identities
10
+ with the column names returned by SQLite.
11
+ - Keep in-memory relay message identifiers unique across resets and restarts.
12
+ Persistent clients no longer discard new replies as duplicate deliveries.
13
+ - Add runnable browser and Expo examples, including encrypted replies and
14
+ SQLCipher persistence. Explain private testing and public verification.
15
+
16
+ ## 2.0.0
17
+
18
+ - Six Jazzer.js targets run for 150 seconds each on Ubuntu 24.04.
19
+ The previous runner selected coverage reporting instead of fuzzing.
20
+
21
+ - **Hosted control messages accept an omitted send identifier.**
22
+ One generated UUID survives token retries.
23
+
24
+ - **Explicit account recovery bypasses stored sessions.**
25
+ The SDK requests a recovery assertion.
26
+
27
+ - **Update the Noble dependencies.** Ciphers, curves, and hashes use 2.4.0.
28
+ Post-quantum uses 0.7.1.
29
+
30
+ - **Breaking: Hosted Relay setup now uses one environment-scoped public
31
+ connection URL.** The SDK resolves the exact protocol endpoint and
32
+ publishable key from that URL, rejects project or environment mismatches
33
+ before it creates identity state, and supports the non-streaming Fetch
34
+ responses used by React Native and Expo. Applications no longer select a
35
+ Relay hostname or pair it with a second public value.
36
+
37
+ - **Hosted encrypted attachment uploads preserve broker-signed headers.** The
38
+ default Fetch adapter no longer adds a second case-variant `Content-Type`
39
+ header that can invalidate a presigned upload request.
40
+
41
+ - **Breaking: the hosted client now owns its authenticated Relay transport.**
42
+ Applications supply one environment-scoped Relay URL, local storage, and an
43
+ identity-assertion callback. The SDK registers or resumes the device, renews
44
+ short-lived tokens with device-key proof, maintains prekeys, and performs
45
+ direct delivery, mailbox, push, and encrypted-object operations without
46
+ application-supplied hosted adapters. Encrypted-object upload requests now
47
+ require the SHA-256 digest of the exact bytes.
48
+
49
+ - **Breaking: Managed Relay adapters no longer accept certificate roots.** The
50
+ SDK compiles separate customer Development, customer Production, and internal
51
+ Staging fixture roots. It selects one profile from the exact
52
+ environment-scoped connection origin. Bootstrap data and application adapters
53
+ cannot replace hosted trust. Self-hosted Relay trust remains explicit and
54
+ separate.
55
+
56
+ - **Hosted Relay push registration now declares the device platform and one
57
+ authorized notification profile.** Android and Web registrations accept
58
+ background wakes or generic visible alerts. iOS also accepts the
59
+ Notification Service Extension profile. The SDK rejects invalid
60
+ provider-platform pairs before transport. Apple notification filtering stays
61
+ unavailable until signed physical-device verification passes. Push remains a
62
+ best-effort wake; authenticated Relay mailbox pull remains delivery.
63
+
64
+ - **Breaking: Relay envelopes use one required delivery class.**
65
+ `user-visible` persists and can request a generic alert, `background-sync`
66
+ persists without a visible alert, and `ephemeral` is online-only and never
67
+ enters an offline mailbox. The SDK infers the class for standard chat work.
68
+ The independent `urgent` and `ephemeral` booleans no longer exist. Relay
69
+ adapters that cannot prove live transient acceptance reject ephemeral work
70
+ instead of reporting false delivery or retaining typing state.
71
+
72
+ Convex validates stored component documents before it deploys the new
73
+ schema. Every 1.x `messages` row lacks the required class, so a 2.0 deploy
74
+ requires an empty component mailbox. Stop sends and let retention drain the
75
+ table, or clear it before deployment. This is a deliberate clean prelaunch
76
+ replacement; 2.0 does not parse or backfill the obsolete envelope shape.
77
+ See "Upgrading" in the Convex component README.
78
+
3
79
  ## 1.0.0
4
80
 
5
81
  - **Hosted Relay supports data-only push wake hints across Expo, APNs, FCM,
package/COMMERCIAL.md CHANGED
@@ -43,7 +43,7 @@ Growth and Enterprise start with an email.
43
43
 
44
44
  ## How buying works
45
45
 
46
- 1. Read the terms at [open-e2ee.dev/licensing](https://open-e2ee.dev/licensing).
46
+ 1. Read the [Commercial Terms](https://open-e2ee.dev/legal/terms).
47
47
  2. Startup tier: purchase directly in the [console](https://console.open-e2ee.dev)
48
48
  and download your signed license record immediately.
49
49
  3. Growth, Enterprise, or anything unusual (OEM, source escrow, security
package/README.md CHANGED
@@ -1,50 +1,58 @@
1
- <img src="https://raw.githubusercontent.com/open-e2ee/design/v0.9.1/brand/generated/open-e2ee-mark-adaptive.svg" alt="OpenE2EE" width="72" height="72">
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/open-e2ee/design/v0.21.2/brand/generated/hosted/open-e2ee-logo-dark.svg">
3
+ <img src="https://raw.githubusercontent.com/open-e2ee/design/v0.21.2/brand/generated/hosted/open-e2ee-logo-light.svg" alt="OpenE2EE" width="340">
4
+ </picture>
2
5
 
3
6
  # OpenE2EE Signal Protocol SDK
4
7
 
5
- **End-to-end encrypted messaging for TypeScript apps. Signal Protocol, post-quantum by default, runs in Expo.**
8
+ **Pure TypeScript for end-to-end encrypted chat.**
6
9
 
7
- [![License: AGPL-3.0-or-later](https://img.shields.io/badge/license-AGPL--3.0--or--later-2f6f5e)](https://github.com/open-e2ee/signal-protocol-js/blob/main/LICENSE)
10
+ Add encrypted messaging to Expo, React Native, browser, and Node applications. The SDK manages device identities, session establishment, and message encryption. Your application supplies storage, user authentication, and a relay for delivery.
11
+
12
+ The default policy requires post-quantum session establishment and ratcheting. The protocol implementation is open source under AGPLv3, with a [commercial license](./COMMERCIAL.md) available.
13
+
14
+ [**Run an encrypted exchange in your browser**](https://open-e2ee.dev/playground) · [Edit on StackBlitz](https://stackblitz.com/fork/github/open-e2ee/signal-protocol-js/tree/v2.0.1/examples/browser) · [Run on Expo / Hermes](./examples/expo/README.md)
15
+
16
+ [![License: AGPL-3.0-or-later](https://img.shields.io/badge/license-AGPL--3.0--or--later-2f6f5e)](./LICENSE)
8
17
  [![npm version](https://img.shields.io/npm/v/@open-e2ee/signal-protocol-sdk)](https://www.npmjs.com/package/@open-e2ee/signal-protocol-sdk)
9
- [![native crypto: 0](https://img.shields.io/badge/native_crypto-0-2f6f5e)](./ARCHITECTURE.md)
10
18
  [![npm provenance](https://img.shields.io/badge/npm-provenance-2f6f5e)](https://www.npmjs.com/package/@open-e2ee/signal-protocol-sdk#provenance)
11
19
  [![Checks](https://github.com/open-e2ee/signal-protocol-js/actions/workflows/ci.yml/badge.svg)](https://github.com/open-e2ee/signal-protocol-js/actions/workflows/ci.yml)
12
20
 
13
- [Website](https://open-e2ee.dev) ·
14
- [Documentation](https://docs.open-e2ee.dev) ·
15
- [Live demo](https://open-e2ee.dev/#demo) ·
16
- [OpenE2EE Relay](https://open-e2ee.dev/relay) ·
17
- [API reference](https://docs.open-e2ee.dev/reference/api) ·
18
- [Security](./SECURITY.md)
21
+ [Documentation](https://docs.open-e2ee.dev) · [API reference](https://docs.open-e2ee.dev/reference/api) · [OpenE2EE Relay](https://open-e2ee.dev/relay) · [Security](./SECURITY.md)
19
22
 
20
- - **One TypeScript package.** Run the same protocol code in Expo, React Native, modern browsers, and Node.
21
- - **Post-quantum by default.** The default policy requires PQXDH session establishment and the ML-KEM Braid post-quantum ratchet. Required post-quantum operations fail closed.
22
- - **Messaging primitives included.** Build multi-device messaging, groups, sealed sender, encrypted attachments, and safety-number verification.
23
- - **Explicit infrastructure boundaries.** Your application owns device-local storage. Supply your own relay adapter or use [OpenE2EE Relay](https://open-e2ee.dev/relay) for managed encrypted delivery. The relay never needs message plaintext or device private keys.
24
- - **AGPLv3, or a commercial license.** Proprietary applications that cannot meet AGPLv3 obligations can use a [commercial license](./COMMERCIAL.md).
23
+ ## See an encrypted round trip
25
24
 
26
- The protocol code ships without a native crypto module or platform crypto binary. The Expo SQLCipher store requires a development build and native project configuration.
25
+ Press play for device setup, session establishment, encrypted delivery, and decryption on each device.
27
26
 
28
- Version `1.0.x`. Public APIs and persisted formats follow semantic versioning.
27
+ https://github.com/user-attachments/assets/d8002bc3-c037-41b6-8f48-4008f2d49e6c
29
28
 
30
- OpenE2EE implements a versioned profile of the published Signal Protocol specifications. It is not affiliated with Signal Messenger and is **not wire-compatible with Signal Messenger or libsignal**. Messages, identities, and safety numbers do not interoperate. Read the [full notice](./NOTICE) and [documented deviations](./docs/DEVIATIONS.md).
29
+ The [visual demo](https://open-e2ee.dev/#demo) shows the envelope, ratchets, relay mailbox, and decrypted result. On desktop, type a message and inspect each step. On mobile, a recorded protocol run replays at reading pace. Displayed timings exclude network time.
31
30
 
32
- ## See an encrypted round trip
31
+ The [console example](https://open-e2ee.dev/playground) executes in your browser on desktop or mobile. It creates Alice and Bob, sends your message, and decrypts a reply. The page and developer console show the actual output. [Read the complete source](./examples/browser/src/exchange.ts) or [run it locally](./examples/browser/README.md).
33
32
 
34
- Press play for the complete four-message run: device setup, session establishment, encrypted relay delivery, and on-device decryption.
33
+ Both examples use real protocol code and cryptography. An in-memory relay holds their envelopes. They need no account or backend project.
35
34
 
36
- https://github.com/user-attachments/assets/d8002bc3-c037-41b6-8f48-4008f2d49e6c
35
+ ## What the SDK handles
37
36
 
38
- The [live demo](https://open-e2ee.dev/#demo) runs two SDK clients against an in-memory relay. On desktop, type a message and inspect the envelope, ratchets, relay mailbox, and decrypted result. On mobile, the same protocol run replays at reading pace. The protocol and cryptography are real. The example simulates infrastructure in memory. Displayed timings exclude network time.
37
+ - **Session establishment and ratcheting.** PQXDH establishes sessions. The ML-KEM Braid ratchet adds post-quantum key updates. Required post-quantum operations fail closed.
38
+ - **Chat features.** Multi-device messaging, groups, sealed sender, encrypted attachments, and safety-number verification use the same package.
39
+ - **Device-local state.** Storage adapters keep identities, sessions, and message state on the device.
40
+ - **Delivery through an adapter.** Operate your own relay or use [OpenE2EE Relay](https://open-e2ee.dev/relay).
39
41
 
40
- ## Install
42
+ The relay never needs message plaintext or device private keys.
41
43
 
42
- Requires Node 18 or later for the local example.
44
+ OpenE2EE implements a versioned profile of the published Signal Protocol specifications. It is not affiliated with Signal Messenger and is **not wire-compatible with Signal Messenger or libsignal**. Messages, identities, and safety numbers do not interoperate. See the [notice](./NOTICE) and [documented deviations](./docs/DEVIATIONS.md).
45
+
46
+ Version `2.0.x`. Public APIs and persisted formats follow semantic versioning.
47
+
48
+ ## Install
43
49
 
44
50
  ```bash
45
51
  npm install @open-e2ee/signal-protocol-sdk
46
52
  ```
47
53
 
54
+ Use a current Node LTS release for local development. Each runtime example lists its build requirements.
55
+
48
56
  ## Run a local encrypted round trip
49
57
 
50
58
  Save this as `quickstart.mjs`, then run `node quickstart.mjs`. It uses development-only in-memory adapters so that you can prove the message flow without a backend project.
@@ -92,14 +100,14 @@ The client factory creates or loads each device identity. When given a relay, it
92
100
 
93
101
  The in-memory store loses identities, sessions, and ratchet state on restart. The in-memory relay has no authentication, authorization, or durable storage. Do not ship either adapter. Continue with the [documentation quickstart](https://docs.open-e2ee.dev/start/quickstart), which explains key custody, relay metadata, prekey replenishment, additional devices, and recovery policy.
94
102
 
95
- ## Move to production storage
103
+ ## Use your app’s storage and relay
96
104
 
97
105
  Choose the device-local store for your runtime. Then supply a relay that authenticates each device and implements your product's access policy, or use [OpenE2EE Relay](https://open-e2ee.dev/relay) as the managed delivery path. The SDK does not require the managed service. [Review Relay plans and exact meter definitions.](https://open-e2ee.dev/relay/pricing)
98
106
 
99
107
  | Runtime | Storage path | Deployment boundary |
100
108
  |---|---|---|
101
- | Expo | [`expoStore`](./local/store/expo/README.md) | Configure SQLCipher before schema access. Requires a development build; it does not run in Expo Go. |
102
- | Browser | [`indexedDbStore`](./local/store/web/README.md) | IndexedDB persists encrypted records, but same-origin JavaScript can access the records and their key. Review CSP, XSS, dependencies, and service workers. |
109
+ | Expo | [`expoStore`](./local/store/expo/README.md) | Configure SQLCipher before schema access. Requires a native development or release build. [Run the Hermes example](./examples/expo/README.md); Expo Go does not include SQLCipher. |
110
+ | Browser | [`indexedDbStore`](./local/store/web/README.md) | Use a secure context and a restrictive CSP. Same-origin JavaScript can access stored records and their key. [Browser setup](https://docs.open-e2ee.dev/start/browser). |
103
111
  | Bare React Native | [`reactNativeStore`](./local/store/react-native/README.md) | Provide an atomic, durable key-value backend and run the exported backend conformance kit. |
104
112
  | Node | [`nodeStore`](./local/store/node/README.md) | Set an explicit private data directory on a trusted local filesystem. |
105
113
 
@@ -107,18 +115,14 @@ The [adapter guide](./ADAPTERS.md) defines every storage, relay, vault, and obje
107
115
 
108
116
  ## Security and assurance
109
117
 
110
- The [assurance summary](./docs/ASSURANCE.md) states what the automated checks cover and what the public export does not contain. Public CI rebuilds, type-checks, audits, and runs this README example against the packed package.
118
+ The SDK is open source. Our engineering tests remain private. We publish the [testing methodology and dated results](./docs/ASSURANCE.md), including what readers can and cannot verify from this repository. Public CI rebuilds the package, checks types and dependencies, and runs the documented examples.
119
+
120
+ > Reviewed continuously by adversarial AI agents; not audited by any independent firm.
111
121
 
112
122
  JavaScript engines do not provide a machine-level constant-time contract or guaranteed zeroization. The [security model](./docs/SECURITY.md) defines the timing, same-process, storage, and metadata boundaries. The [protocol policy](./docs/PROTOCOL_POLICY.md) defines supported modes and fail-closed behavior.
113
123
 
114
124
  Report a suspected vulnerability privately through the process in [SECURITY](./SECURITY.md). Do not open a public issue for it.
115
125
 
116
- ## Why developers choose this SDK
117
-
118
- The SDK gives TypeScript applications one maintained package for required post-quantum session establishment and ratcheting, multi-device messaging, groups, sealed sender, attachments, and safety numbers. It keeps protocol state on the device. Applications can operate a relay adapter or use OpenE2EE Relay for managed delivery.
119
-
120
- [Compare maintained alternatives and their limits.](https://open-e2ee.dev/product/#how-it-compares)
121
-
122
126
  ## Documentation
123
127
 
124
128
  - [Getting started](./docs/GETTING_STARTED.md): the integration sequence and mental model.
package/SECURITY.md CHANGED
@@ -7,8 +7,8 @@ backports.
7
7
 
8
8
  | Version | Supported |
9
9
  | ------- | ------------------ |
10
- | 1.0.x | :white_check_mark: |
11
- | < 1.0.0 | :x: |
10
+ | 2.0.x | :white_check_mark: |
11
+ | < 2.0.0 | :x: |
12
12
 
13
13
  ## Reporting a Vulnerability
14
14
 
@@ -32,8 +32,10 @@ export declare const IMPLICIT_ENVELOPE_TYPES: readonly ['server_delivery_receipt
32
32
  /**
33
33
  * Check if a message takes ContentHint.Implicit behavior.
34
34
  *
35
- * Implicit messages are ephemeral (typing indicators, receipts) and should be
36
- * silently discarded on decryption failure - no ERROR logs, no retry requests.
35
+ * Implicit messages have disposable content semantics (for example typing
36
+ * indicators and receipts) and should be silently discarded on decryption
37
+ * failure - no ERROR logs, no retry requests. Their Relay delivery class is a
38
+ * separate persistence and wake decision.
37
39
  *
38
40
  * The primary mechanism is ContentHint.Implicit (set by the sender on the envelope).
39
41
  * Server-generated delivery receipts are also implicit by envelope type.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../client/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC;AACV,eAAO,MAAM,qBAAqB,QAA2B,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,YAAI,yBAAyB,CAAU,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE;IAC9C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAQV"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../client/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC;AACV,eAAO,MAAM,qBAAqB,QAA2B,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,YAAI,yBAAyB,CAAU,CAAC;AAE5E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE;IAC9C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAQV"}
@@ -23,8 +23,10 @@ export const IMPLICIT_ENVELOPE_TYPES = ['server_delivery_receipt'];
23
23
  /**
24
24
  * Check if a message takes ContentHint.Implicit behavior.
25
25
  *
26
- * Implicit messages are ephemeral (typing indicators, receipts) and should be
27
- * silently discarded on decryption failure - no ERROR logs, no retry requests.
26
+ * Implicit messages have disposable content semantics (for example typing
27
+ * indicators and receipts) and should be silently discarded on decryption
28
+ * failure - no ERROR logs, no retry requests. Their Relay delivery class is a
29
+ * separate persistence and wake decision.
28
30
  *
29
31
  * The primary mechanism is ContentHint.Implicit (set by the sender on the envelope).
30
32
  * Server-generated delivery receipts are also implicit by envelope type.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../client/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAEzE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,yBAAyB,CAAU,CAAC;AAE5E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAGrC;IACC,OAAO,CACL,QAAQ,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ;QAC7C,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS;YACjC,uBAAuB,CAAC,QAAQ,CAC9B,QAAQ,CAAC,WAAuD,CACjE,CAAC,CACL,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../client/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAEzE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,yBAAyB,CAAU,CAAC;AAE5E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UA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E,MAAM,GACjB,OAAO,CAAC,2BAA2B,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC9D,oBAAoB,CAClB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,mBAAmB,CACjB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,UAAU,EAC1B,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAAC;IAC1C,yBAAyB,CACvB,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,gBAAgB,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACzE,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,wBAAwB,CACtB,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,2BAA2B,EACpC,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5D;AAyND,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,UAAU,EAC1B,OAAO,EAAE,WAAW,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,GACjD,OAAO,CAAC,UAAU,CAAC,CA2ErB"}
@@ -20,6 +20,7 @@ async function sendStoredDeviceMessage(context, intent, message, forceIdentified
20
20
  senderDeviceId: context.senderDeviceId,
21
21
  ciphertext: message.ciphertext,
22
22
  messageType: message.messageType,
23
+ deliveryClass: 'user-visible',
23
24
  timestamp: message.timestamp,
24
25
  clientMessageId: intent.clientMessageId,
25
26
  });
@@ -70,6 +71,7 @@ async function sendStoredGroupIntent(context, initialIntent) {
70
71
  senderDeviceId: context.senderDeviceId,
71
72
  ciphertext: message.ciphertext,
72
73
  messageType: message.messageType,
74
+ deliveryClass: 'background-sync',
73
75
  timestamp: message.timestamp,
74
76
  clientMessageId: message.clientMessageId,
75
77
  recipientRegistrationId: message.recipientRegistrationId,
@@ -91,7 +93,7 @@ async function sendStoredGroupIntent(context, initialIntent) {
91
93
  }
92
94
  else {
93
95
  try {
94
- const result = await relay.sendMultiRecipientUnidentified(intent.groupSharedMessage.sentMessageBase64, auth, intent.clientTimestamp, intent.groupSharedMessage.recipientUserIds, intent.clientMessageId);
96
+ const result = await relay.sendMultiRecipientUnidentified(intent.groupSharedMessage.sentMessageBase64, auth, intent.clientTimestamp, 'user-visible', intent.groupSharedMessage.recipientUserIds, intent.clientMessageId);
95
97
  messageId = result.messageId;
96
98
  timestamp = result.serverTimestamp;
97
99
  skippedUsers = result.uuids404;
@@ -145,6 +147,7 @@ async function sendStoredGroupIntent(context, initialIntent) {
145
147
  senderDeviceId: context.senderDeviceId,
146
148
  ciphertext: message.ciphertext,
147
149
  messageType: message.messageType,
150
+ deliveryClass: 'background-sync',
148
151
  timestamp: message.timestamp,
149
152
  clientMessageId: message.clientMessageId,
150
153
  });
@@ -1 +1 @@
1
- {"version":3,"file":"group-outbox.js","sourceRoot":"","sources":["../../client/group-outbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAMlD,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,GAG9B,MAAM,4BAA4B,CAAC;AAoDpC,KAAK,UAAU,uBAAuB,CACpC,OAA2B,EAC3B,MAAmC,EACnC,O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;YACF,GAAG,CAAC,kBAAkB,IAAI,EAAE,kBAAkB,EAAE,CAAC;SAClD,CAAC;QACF,MAAM,0BAA0B,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface HostedRelayCertificateTrust {
2
+ readonly revokedIssuerKeyIds: readonly number[];
3
+ readonly trustRoots: readonly Uint8Array[];
4
+ }
5
+ export interface HostedRelayConnection {
6
+ readonly certificateTrust: HostedRelayCertificateTrust;
7
+ readonly configurationVersion: number;
8
+ readonly environment: 'development' | 'production';
9
+ readonly protocolEndpoint: string;
10
+ readonly publishableKey: string;
11
+ readonly relayScopeId: Uint8Array;
12
+ readonly relayUrl: string;
13
+ }
14
+ /** Resolve one public environment-scoped Managed Relay connection. */
15
+ export declare function resolveHostedRelayConnection(value: string): Promise<HostedRelayConnection>;
16
+ //# sourceMappingURL=hosted-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-connection.d.ts","sourceRoot":"","sources":["../../client/hosted-connection.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;IACvD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,aAAa,GAAG,YAAY,CAAC;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AA0ND,sEAAsE;AACtE,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,qBAAqB,CAAC,CAoEhC"}
@@ -0,0 +1,255 @@
1
+ import { base64ToBytes, bytesToUrlSafeBase64, urlSafeToBase64, } from '../internal/crypto/index.js';
2
+ const MANAGED_RELAY_PROFILES = {
3
+ 'customer-development': {
4
+ environment: 'development',
5
+ origin: 'https://development.relay.open-e2ee.dev',
6
+ revokedIssuerKeyIds: [],
7
+ trustRoots: [
8
+ 'KggSCjrGjvI+qs4FXJmg2Zy9G/1LMM4MBF5ddm1E/40=',
9
+ ],
10
+ },
11
+ production: {
12
+ environment: 'production',
13
+ origin: 'https://relay.open-e2ee.dev',
14
+ revokedIssuerKeyIds: [],
15
+ trustRoots: [
16
+ 'c/YUIFyVI2CexJmHTBj0ofqqOH9yiPewipMrTGGBCMc=',
17
+ ],
18
+ },
19
+ staging: {
20
+ environment: 'production',
21
+ origin: 'https://staging.relay.open-e2ee.dev',
22
+ revokedIssuerKeyIds: [],
23
+ trustRoots: [
24
+ 'dl4g+m9cCgjbaUqOK9XlrWf8dmH/zhNxluXImiM24i4=',
25
+ ],
26
+ },
27
+ 'staging-customer-development': {
28
+ environment: 'development',
29
+ origin: 'https://staging-customer-development.relay.open-e2ee.dev',
30
+ revokedIssuerKeyIds: [],
31
+ trustRoots: [
32
+ 'M5x6m4m8bu1cntLDKaPmYcFwb6Vcgv+no+qGCre+r8w=',
33
+ ],
34
+ },
35
+ };
36
+ const CONNECTION_PATH = /^\/v1\/connection\/([A-Za-z0-9_-]{1,255})$/u;
37
+ const CONNECTION_FRESH_MILLISECONDS = 5 * 60 * 1_000;
38
+ const CONNECTION_STALE_MILLISECONDS = 60 * 60 * 1_000;
39
+ const CONNECTION_DOCUMENT_MAXIMUM_BYTES = 8 * 1_024;
40
+ const connectionCache = new Map();
41
+ const CONNECTION_DOCUMENT_KEYS = [
42
+ 'configurationVersion',
43
+ 'environment',
44
+ 'protocolEndpoint',
45
+ 'publishableKey',
46
+ 'relayScopeId',
47
+ 'schemaVersion',
48
+ ];
49
+ function record(value) {
50
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
51
+ }
52
+ function parseRelayUrl(value) {
53
+ let url;
54
+ try {
55
+ url = new URL(value);
56
+ }
57
+ catch {
58
+ throw new Error('Managed Relay connection URL is invalid');
59
+ }
60
+ const profile = Object.entries(MANAGED_RELAY_PROFILES).find(([, candidate]) => url.origin === candidate.origin)?.[0];
61
+ const locator = CONNECTION_PATH.exec(url.pathname)?.[1];
62
+ if (profile === undefined ||
63
+ locator === undefined ||
64
+ url.username !== '' ||
65
+ url.password !== '' ||
66
+ url.search !== '' ||
67
+ url.hash !== '' ||
68
+ url.href !== value) {
69
+ throw new Error('Managed Relay connection URL is invalid');
70
+ }
71
+ return {
72
+ environment: MANAGED_RELAY_PROFILES[profile].environment,
73
+ locator,
74
+ profile,
75
+ relayUrl: url.href,
76
+ };
77
+ }
78
+ function compiledCertificateTrust(profile) {
79
+ const trust = MANAGED_RELAY_PROFILES[profile];
80
+ return {
81
+ revokedIssuerKeyIds: [...trust.revokedIssuerKeyIds],
82
+ trustRoots: trust.trustRoots.map((root) => base64ToBytes(root)),
83
+ };
84
+ }
85
+ function parseRelayScopeId(value) {
86
+ if (typeof value !== 'string' ||
87
+ !/^[A-Za-z0-9_-]{22}$/u.test(value)) {
88
+ return undefined;
89
+ }
90
+ try {
91
+ const decoded = base64ToBytes(urlSafeToBase64(value));
92
+ return decoded.length === 16 && bytesToUrlSafeBase64(decoded) === value
93
+ ? decoded
94
+ : undefined;
95
+ }
96
+ catch {
97
+ return undefined;
98
+ }
99
+ }
100
+ function cloneConnection(connection) {
101
+ return {
102
+ ...connection,
103
+ certificateTrust: {
104
+ revokedIssuerKeyIds: [
105
+ ...connection.certificateTrust.revokedIssuerKeyIds,
106
+ ],
107
+ trustRoots: connection.certificateTrust.trustRoots.map((root) => root.slice()),
108
+ },
109
+ relayScopeId: connection.relayScopeId.slice(),
110
+ };
111
+ }
112
+ async function connectionError(response) {
113
+ let code;
114
+ try {
115
+ const body = await boundedJson(response);
116
+ code =
117
+ record(body) && record(body.error) && typeof body.error.code === 'string'
118
+ ? body.error.code
119
+ : undefined;
120
+ }
121
+ catch {
122
+ code = undefined;
123
+ }
124
+ if (code === 'DEPLOYMENT_SUSPENDED') {
125
+ return new Error('Managed Relay deployment is suspended');
126
+ }
127
+ if (code === 'PRODUCTION_INACTIVE') {
128
+ return new Error('Managed Relay production deployment is not active');
129
+ }
130
+ if (response.status === 404) {
131
+ return new Error('Managed Relay connection does not exist or is stale');
132
+ }
133
+ if (response.status === 403) {
134
+ return new Error('Managed Relay connection belongs to another environment');
135
+ }
136
+ if (response.status === 410) {
137
+ return new Error('Managed Relay connection is no longer active');
138
+ }
139
+ return new Error('Managed Relay connection could not be resolved');
140
+ }
141
+ async function boundedJson(response) {
142
+ const declaredLength = response.headers.get('content-length');
143
+ if (declaredLength !== null &&
144
+ (!/^\d+$/.test(declaredLength) ||
145
+ Number(declaredLength) > CONNECTION_DOCUMENT_MAXIMUM_BYTES)) {
146
+ throw new Error('Managed Relay returned an invalid connection');
147
+ }
148
+ try {
149
+ const body = response.body;
150
+ if (typeof body?.getReader === 'function') {
151
+ const reader = body.getReader();
152
+ const decoder = new TextDecoder();
153
+ let size = 0;
154
+ let text = '';
155
+ for (;;) {
156
+ const result = await reader.read();
157
+ if (result.done)
158
+ break;
159
+ size += result.value.byteLength;
160
+ if (size > CONNECTION_DOCUMENT_MAXIMUM_BYTES) {
161
+ await reader.cancel();
162
+ throw new Error('Managed Relay returned an invalid connection');
163
+ }
164
+ text += decoder.decode(result.value, { stream: true });
165
+ }
166
+ text += decoder.decode();
167
+ return JSON.parse(text);
168
+ }
169
+ // React Native and Expo use a fetch implementation without response body
170
+ // streams. Preserve their standard text() path and enforce the same UTF-8
171
+ // byte limit after decoding.
172
+ const text = await response.text();
173
+ if (new TextEncoder().encode(text).byteLength >
174
+ CONNECTION_DOCUMENT_MAXIMUM_BYTES) {
175
+ throw new Error('Managed Relay returned an invalid connection');
176
+ }
177
+ return JSON.parse(text);
178
+ }
179
+ catch (error) {
180
+ if (error instanceof Error &&
181
+ error.message === 'Managed Relay returned an invalid connection') {
182
+ throw error;
183
+ }
184
+ throw new Error('Managed Relay returned an invalid connection');
185
+ }
186
+ }
187
+ /** Resolve one public environment-scoped Managed Relay connection. */
188
+ export async function resolveHostedRelayConnection(value) {
189
+ const input = parseRelayUrl(value);
190
+ const cached = connectionCache.get(input.relayUrl);
191
+ if (cached !== undefined &&
192
+ Date.now() - cached.resolvedAt <= CONNECTION_FRESH_MILLISECONDS) {
193
+ return cloneConnection(cached.connection);
194
+ }
195
+ let response;
196
+ try {
197
+ response = await fetch(input.relayUrl, {
198
+ credentials: 'omit',
199
+ headers: { accept: 'application/json' },
200
+ method: 'GET',
201
+ });
202
+ }
203
+ catch {
204
+ if (cached !== undefined &&
205
+ Date.now() - cached.resolvedAt <= CONNECTION_STALE_MILLISECONDS) {
206
+ return cloneConnection(cached.connection);
207
+ }
208
+ throw new Error('Managed Relay connection could not be resolved');
209
+ }
210
+ if (!response.ok)
211
+ throw await connectionError(response);
212
+ let valueFromRelay;
213
+ try {
214
+ valueFromRelay = await boundedJson(response);
215
+ }
216
+ catch {
217
+ throw new Error('Managed Relay returned an invalid connection');
218
+ }
219
+ const expectedOrigin = MANAGED_RELAY_PROFILES[input.profile].origin;
220
+ const relayScopeId = record(valueFromRelay)
221
+ ? parseRelayScopeId(valueFromRelay.relayScopeId)
222
+ : undefined;
223
+ if (!record(valueFromRelay) ||
224
+ Object.keys(valueFromRelay).sort().join(',') !==
225
+ [...CONNECTION_DOCUMENT_KEYS].sort().join(',') ||
226
+ valueFromRelay.schemaVersion !== 1 ||
227
+ !Number.isSafeInteger(valueFromRelay.configurationVersion) ||
228
+ valueFromRelay.configurationVersion < 1 ||
229
+ valueFromRelay.environment !== input.environment ||
230
+ valueFromRelay.protocolEndpoint !== `${expectedOrigin}/v1/signal` ||
231
+ valueFromRelay.publishableKey !== input.locator ||
232
+ relayScopeId === undefined) {
233
+ throw new Error('Managed Relay returned an invalid connection');
234
+ }
235
+ const connection = {
236
+ certificateTrust: compiledCertificateTrust(input.profile),
237
+ configurationVersion: valueFromRelay.configurationVersion,
238
+ environment: input.environment,
239
+ protocolEndpoint: valueFromRelay.protocolEndpoint,
240
+ publishableKey: valueFromRelay.publishableKey,
241
+ relayScopeId,
242
+ relayUrl: input.relayUrl,
243
+ };
244
+ connectionCache.set(input.relayUrl, {
245
+ connection,
246
+ resolvedAt: Date.now(),
247
+ });
248
+ if (connectionCache.size > 64) {
249
+ const oldest = connectionCache.keys().next().value;
250
+ if (oldest !== undefined)
251
+ connectionCache.delete(oldest);
252
+ }
253
+ return cloneConnection(connection);
254
+ }
255
+ //# sourceMappingURL=hosted-connection.js.map