@open-e2ee/signal-protocol-sdk 0.1.0-alpha.8 → 0.1.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/ADAPTERS.md +12 -12
- package/ARCHITECTURE.md +3 -3
- package/CHANGELOG.md +461 -0
- package/README.md +25 -15
- package/SECURITY.md +1 -1
- package/client/README.md +2 -2
- package/device/README.md +3 -1
- package/dist/client/client.d.ts +6 -6
- package/dist/client/client.js +6 -6
- package/dist/client/compose.d.ts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/device/expo-metadata.d.ts +26 -0
- package/dist/device/expo-metadata.d.ts.map +1 -0
- package/dist/device/expo-metadata.js +33 -0
- package/dist/device/expo-metadata.js.map +1 -0
- package/dist/device/index.d.ts +1 -1
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +5 -1
- package/dist/device/index.js.map +1 -1
- package/dist/device/provisioning.d.ts +4 -12
- package/dist/device/provisioning.d.ts.map +1 -1
- package/dist/device/provisioning.js +4 -21
- package/dist/device/provisioning.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/internal/crypto/symmetric/aes.d.ts.map +1 -1
- package/dist/internal/crypto/symmetric/aes.js +27 -30
- package/dist/internal/crypto/symmetric/aes.js.map +1 -1
- package/dist/internal/encoding/proto/primitives.d.ts +261 -6
- package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
- package/dist/internal/encoding/proto/primitives.js +468 -6
- package/dist/internal/encoding/proto/primitives.js.map +1 -1
- package/dist/internal/encoding/proto/sender-key-message.d.ts +4 -3
- package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -1
- package/dist/internal/encoding/proto/sender-key-message.js +97 -76
- package/dist/internal/encoding/proto/sender-key-message.js.map +1 -1
- package/dist/internal/encoding/proto/signal-message.d.ts +7 -2
- package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
- package/dist/internal/encoding/proto/signal-message.js +194 -110
- package/dist/internal/encoding/proto/signal-message.js.map +1 -1
- package/dist/internal/groups/manager.d.ts +24 -5
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +33 -11
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/server-engine.d.ts +29 -14
- package/dist/internal/groups/server-engine.d.ts.map +1 -1
- package/dist/internal/groups/server-engine.js +63 -14
- package/dist/internal/groups/server-engine.js.map +1 -1
- package/dist/internal/manager/manager.d.ts +2 -2
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +50 -4
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +273 -151
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts +7 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js +334 -151
- package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js.map +1 -1
- package/dist/layers.d.ts +2 -2
- package/dist/layers.d.ts.map +1 -1
- package/dist/layers.js +2 -2
- package/dist/layers.js.map +1 -1
- package/dist/local/store/index.d.ts +3 -3
- package/dist/local/store/index.d.ts.map +1 -1
- package/dist/local/store/index.js +4 -4
- package/dist/local/store/index.js.map +1 -1
- package/dist/local/store/{mock → memory}/adapter.d.ts +10 -10
- package/dist/local/store/memory/adapter.d.ts.map +1 -0
- package/dist/local/store/{mock → memory}/adapter.js +5 -5
- package/dist/local/store/memory/adapter.js.map +1 -0
- package/dist/local/store/{mock → memory}/failures.d.ts +6 -6
- package/dist/local/store/memory/failures.d.ts.map +1 -0
- package/dist/local/store/{mock → memory}/failures.js +6 -6
- package/dist/local/store/memory/failures.js.map +1 -0
- package/dist/local/store/memory/index.d.ts +11 -0
- package/dist/local/store/memory/index.d.ts.map +1 -0
- package/dist/local/store/memory/index.js +7 -0
- package/dist/local/store/memory/index.js.map +1 -0
- package/dist/local/store/node/adapter.d.ts +53 -4
- package/dist/local/store/node/adapter.d.ts.map +1 -1
- package/dist/local/store/node/adapter.js +456 -9
- package/dist/local/store/node/adapter.js.map +1 -1
- package/dist/local/store/node/database.d.ts +68 -0
- package/dist/local/store/node/database.d.ts.map +1 -1
- package/dist/local/store/node/database.js +201 -18
- package/dist/local/store/node/database.js.map +1 -1
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +69 -1
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/react-native/backend-conformance.d.ts +66 -0
- package/dist/local/store/react-native/backend-conformance.d.ts.map +1 -0
- package/dist/local/store/react-native/backend-conformance.js +326 -0
- package/dist/local/store/react-native/backend-conformance.js.map +1 -0
- package/dist/local/store/react-native/index.d.ts +9 -4
- package/dist/local/store/react-native/index.d.ts.map +1 -1
- package/dist/local/store/react-native/index.js +2 -0
- package/dist/local/store/react-native/index.js.map +1 -1
- package/dist/local/store/react-native/reference-backend.d.ts +42 -0
- package/dist/local/store/react-native/reference-backend.d.ts.map +1 -0
- package/dist/local/store/react-native/reference-backend.js +177 -0
- package/dist/local/store/react-native/reference-backend.js.map +1 -0
- package/dist/local/store/react-native/storage.d.ts +9 -0
- package/dist/local/store/react-native/storage.d.ts.map +1 -1
- package/dist/local/store/web/adapter.d.ts +11 -1
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +196 -33
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/local/store/web/index.d.ts +3 -2
- package/dist/local/store/web/index.d.ts.map +1 -1
- package/dist/local/store/web/index.js.map +1 -1
- package/dist/local/vault/index.d.ts +5 -1
- package/dist/local/vault/index.d.ts.map +1 -1
- package/dist/local/vault/index.js +1 -1
- package/dist/local/vault/index.js.map +1 -1
- package/dist/remote/relay/convex/backend.d.ts +9 -6
- package/dist/remote/relay/convex/backend.d.ts.map +1 -1
- package/dist/remote/relay/convex/backend.js +4 -1
- package/dist/remote/relay/convex/backend.js.map +1 -1
- package/dist/remote/relay/convex/component/_generated/component.d.ts +10 -7
- package/dist/remote/relay/convex/component/_generated/component.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/certificates.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/certificates.js +26 -31
- package/dist/remote/relay/convex/component/certificates.js.map +1 -1
- package/dist/remote/relay/convex/component/cleanup.d.ts +6 -0
- package/dist/remote/relay/convex/component/cleanup.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/cleanup.js +19 -0
- package/dist/remote/relay/convex/component/cleanup.js.map +1 -1
- package/dist/remote/relay/convex/component/crons.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/crons.js +1 -0
- package/dist/remote/relay/convex/component/crons.js.map +1 -1
- package/dist/remote/relay/convex/component/groups.d.ts +9 -6
- package/dist/remote/relay/convex/component/groups.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/groups.js +21 -11
- package/dist/remote/relay/convex/component/groups.js.map +1 -1
- package/dist/remote/relay/convex/component/messages.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/messages.js +90 -16
- package/dist/remote/relay/convex/component/messages.js.map +1 -1
- package/dist/remote/relay/convex/component/schema.d.ts +15 -1
- package/dist/remote/relay/convex/component/schema.js +21 -0
- package/dist/remote/relay/convex/component/schema.js.map +1 -1
- package/dist/remote/relay/convex/group-server.d.ts +6 -5
- package/dist/remote/relay/convex/group-server.d.ts.map +1 -1
- package/dist/remote/relay/convex/group-server.js +14 -10
- package/dist/remote/relay/convex/group-server.js.map +1 -1
- package/dist/remote/relay/convex/relay.d.ts +2 -2
- package/dist/remote/relay/convex/relay.d.ts.map +1 -1
- package/dist/remote/relay/convex/relay.js +10 -7
- package/dist/remote/relay/convex/relay.js.map +1 -1
- package/dist/remote/relay/index.d.ts +1 -1
- package/dist/remote/relay/index.d.ts.map +1 -1
- package/dist/remote/relay/index.js +2 -2
- package/dist/remote/relay/index.js.map +1 -1
- package/dist/remote/relay/{mock → memory}/adapter.d.ts +19 -19
- package/dist/remote/relay/memory/adapter.d.ts.map +1 -0
- package/dist/remote/relay/{mock → memory}/adapter.js +24 -19
- package/dist/remote/relay/memory/adapter.js.map +1 -0
- package/dist/remote/relay/{mock → memory}/failures.d.ts +5 -5
- package/dist/remote/relay/memory/failures.d.ts.map +1 -0
- package/dist/remote/relay/{mock → memory}/failures.js +1 -1
- package/dist/remote/relay/memory/failures.js.map +1 -0
- package/dist/remote/relay/{mock → memory}/group-server.d.ts +1 -1
- package/dist/remote/relay/memory/group-server.d.ts.map +1 -0
- package/dist/remote/relay/{mock → memory}/group-server.js +1 -1
- package/dist/remote/relay/memory/group-server.js.map +1 -0
- package/dist/remote/relay/memory/index.d.ts +11 -0
- package/dist/remote/relay/memory/index.d.ts.map +1 -0
- package/dist/remote/relay/memory/index.js +7 -0
- package/dist/remote/relay/memory/index.js.map +1 -0
- package/dist/remote/relay/types.d.ts +25 -6
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/types/errors.d.ts +33 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +36 -0
- package/dist/types/errors.js.map +1 -1
- package/docs/ASSURANCE.md +50 -15
- package/docs/CLIENT_COMPOSITION.md +3 -3
- package/docs/GETTING_STARTED.md +11 -11
- package/docs/PACKAGE_SURFACE.md +10 -8
- package/docs/RECIPES.md +12 -12
- package/local/store/README.md +98 -9
- package/local/store/{mock → memory}/README.md +8 -8
- package/local/store/node/README.md +6 -8
- package/local/store/react-native/README.md +34 -2
- package/local/store/web/README.md +30 -3
- package/package.json +13 -10
- package/remote/README.md +7 -7
- package/remote/relay/README.md +5 -5
- package/remote/relay/{mock → memory}/README.md +8 -8
- package/dist/local/store/mock/adapter.d.ts.map +0 -1
- package/dist/local/store/mock/adapter.js.map +0 -1
- package/dist/local/store/mock/failures.d.ts.map +0 -1
- package/dist/local/store/mock/failures.js.map +0 -1
- package/dist/local/store/mock/index.d.ts +0 -11
- package/dist/local/store/mock/index.d.ts.map +0 -1
- package/dist/local/store/mock/index.js +0 -7
- package/dist/local/store/mock/index.js.map +0 -1
- package/dist/remote/relay/mock/adapter.d.ts.map +0 -1
- package/dist/remote/relay/mock/adapter.js.map +0 -1
- package/dist/remote/relay/mock/failures.d.ts.map +0 -1
- package/dist/remote/relay/mock/failures.js.map +0 -1
- package/dist/remote/relay/mock/group-server.d.ts.map +0 -1
- package/dist/remote/relay/mock/group-server.js.map +0 -1
- package/dist/remote/relay/mock/index.d.ts +0 -11
- package/dist/remote/relay/mock/index.d.ts.map +0 -1
- package/dist/remote/relay/mock/index.js +0 -7
- package/dist/remote/relay/mock/index.js.map +0 -1
|
@@ -13,17 +13,17 @@ explicit object-store adapter. The current API passes protocol storage as
|
|
|
13
13
|
|
|
14
14
|
## Local Client
|
|
15
15
|
|
|
16
|
-
<!--
|
|
16
|
+
<!-- doc-snippet:run client-composition-local-client expect="" -->
|
|
17
17
|
```ts
|
|
18
18
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
19
19
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
20
|
-
import {
|
|
20
|
+
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
21
21
|
|
|
22
22
|
const signal = await createSignalProtocolClient({
|
|
23
23
|
// One Signal Protocol client represents one app account/device.
|
|
24
24
|
identity: { userId: "alice" },
|
|
25
25
|
// Local-only clients can omit a relay, but still need device-local storage.
|
|
26
|
-
adapters: { storage:
|
|
26
|
+
adapters: { storage: inMemoryStore() },
|
|
27
27
|
});
|
|
28
28
|
```
|
|
29
29
|
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -107,14 +107,14 @@ This is the target DX the package is moving toward. It is shown here so app
|
|
|
107
107
|
developers can understand the intended mental model while the current stable API
|
|
108
108
|
still uses `storage`, `remoteObjectStore`, hooks, and transition-only media helpers.
|
|
109
109
|
|
|
110
|
-
<!--
|
|
110
|
+
<!-- doc-snippet:skip target-message-api-not-yet-shipped -->
|
|
111
111
|
```ts
|
|
112
112
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
113
113
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
114
114
|
import { createInMemoryDeviceStorage } from "@open-e2ee/signal-protocol-sdk/device/storage/memory";
|
|
115
|
-
import {
|
|
115
|
+
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
116
116
|
|
|
117
|
-
const relay =
|
|
117
|
+
const relay = inMemoryRelay();
|
|
118
118
|
|
|
119
119
|
const alice = await createSignalProtocolClient({
|
|
120
120
|
identity: { userId: "alice", deviceId: 1 },
|
|
@@ -224,18 +224,18 @@ current `signal.media.*` examples into lower-level transition or migration docs.
|
|
|
224
224
|
|
|
225
225
|
## Current Stable Local Clients
|
|
226
226
|
|
|
227
|
-
Use
|
|
227
|
+
Use the in-memory adapters for local examples and development:
|
|
228
228
|
the demo sends while Bob is offline, inspects the relay-visible ciphertext, and
|
|
229
229
|
then starts Bob's subscription to show the decrypted plaintext entering the app.
|
|
230
230
|
|
|
231
|
-
<!--
|
|
231
|
+
<!-- doc-snippet:run getting-started-stable-local-clients expect="bob decrypted: alice: hello" -->
|
|
232
232
|
```ts
|
|
233
233
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
234
234
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
235
|
-
import {
|
|
236
|
-
import {
|
|
235
|
+
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
236
|
+
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
237
237
|
|
|
238
|
-
const relay =
|
|
238
|
+
const relay = inMemoryRelay();
|
|
239
239
|
|
|
240
240
|
// The relay knows which devices exist, but it does not get plaintext.
|
|
241
241
|
await relay.registerDevice("alice", {
|
|
@@ -246,12 +246,12 @@ await relay.registerDevice("bob", { encryptedDeviceName: new ArrayBuffer(0) });
|
|
|
246
246
|
// Each client represents one device. Its protocol storage is local to that device.
|
|
247
247
|
const alice = await createSignalProtocolClient({
|
|
248
248
|
identity: { userId: "alice" },
|
|
249
|
-
adapters: { storage:
|
|
249
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
250
250
|
});
|
|
251
251
|
|
|
252
252
|
const bob = await createSignalProtocolClient({
|
|
253
253
|
identity: { userId: "bob" },
|
|
254
|
-
adapters: { storage:
|
|
254
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
await alice.syncToServer();
|
|
@@ -303,7 +303,7 @@ relay sees encrypted envelope: {
|
|
|
303
303
|
bob decrypted: alice: hello
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
-
The
|
|
306
|
+
The in-memory relay lets the example inspect what a server can see. The relay sees
|
|
307
307
|
metadata plus encrypted envelope bytes; it does not receive Bob's decrypted
|
|
308
308
|
message content. The first message often uses `prekey_bundle` to establish a
|
|
309
309
|
session, and later messages use `ciphertext`.
|
package/docs/PACKAGE_SURFACE.md
CHANGED
|
@@ -65,7 +65,7 @@ Expo storage or Convex helpers.
|
|
|
65
65
|
- `@open-e2ee/signal-protocol-sdk/remote/relay/convex`
|
|
66
66
|
- `@open-e2ee/signal-protocol-sdk/remote/relay/convex/relay`
|
|
67
67
|
- `@open-e2ee/signal-protocol-sdk/convex.config`
|
|
68
|
-
- `@open-e2ee/signal-protocol-sdk/remote/relay/
|
|
68
|
+
- `@open-e2ee/signal-protocol-sdk/remote/relay/memory`
|
|
69
69
|
- `@open-e2ee/signal-protocol-sdk/remote/relay/types`
|
|
70
70
|
- `@open-e2ee/signal-protocol-sdk/remote/object-store`
|
|
71
71
|
- `@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2`
|
|
@@ -81,6 +81,7 @@ Expo storage or Convex helpers.
|
|
|
81
81
|
- `@open-e2ee/signal-protocol-sdk/device`
|
|
82
82
|
- `@open-e2ee/signal-protocol-sdk/device/constants`
|
|
83
83
|
- `@open-e2ee/signal-protocol-sdk/device/device-id`
|
|
84
|
+
- `@open-e2ee/signal-protocol-sdk/device/expo-metadata`
|
|
84
85
|
- `@open-e2ee/signal-protocol-sdk/device/lifecycle`
|
|
85
86
|
- `@open-e2ee/signal-protocol-sdk/device/provisioning`
|
|
86
87
|
- `@open-e2ee/signal-protocol-sdk/encoding`
|
|
@@ -103,7 +104,7 @@ Expo storage or Convex helpers.
|
|
|
103
104
|
- `@open-e2ee/signal-protocol-sdk/local/store/expo`
|
|
104
105
|
- `@open-e2ee/signal-protocol-sdk/local/store/expo/db`
|
|
105
106
|
- `@open-e2ee/signal-protocol-sdk/local/store/expo/schema`
|
|
106
|
-
- `@open-e2ee/signal-protocol-sdk/local/store/
|
|
107
|
+
- `@open-e2ee/signal-protocol-sdk/local/store/memory`
|
|
107
108
|
- `@open-e2ee/signal-protocol-sdk/local/store/node`
|
|
108
109
|
- `@open-e2ee/signal-protocol-sdk/local/store/react-native`
|
|
109
110
|
- `@open-e2ee/signal-protocol-sdk/local/store/web`
|
|
@@ -121,8 +122,8 @@ Expo storage or Convex helpers.
|
|
|
121
122
|
|
|
122
123
|
### Development adapters
|
|
123
124
|
|
|
124
|
-
- `@open-e2ee/signal-protocol-sdk/remote/relay/
|
|
125
|
-
- `@open-e2ee/signal-protocol-sdk/local/store/
|
|
125
|
+
- `@open-e2ee/signal-protocol-sdk/remote/relay/memory`
|
|
126
|
+
- `@open-e2ee/signal-protocol-sdk/local/store/memory`
|
|
126
127
|
|
|
127
128
|
`internal/**` is implementation-only and not part of the supported external API.
|
|
128
129
|
|
|
@@ -150,7 +151,7 @@ Expo storage or Convex helpers.
|
|
|
150
151
|
`defineConvexSignalProtocolBackend()` and the `oe-groups` CLI
|
|
151
152
|
(`npx oe-groups trust-root`) for secret initialization and trust-root
|
|
152
153
|
export
|
|
153
|
-
- `
|
|
154
|
+
- `InMemorySignalProtocolRelayServer` / `inMemoryRelay()` for local development
|
|
154
155
|
- custom implementations via `ISignalProtocolRelayServer`
|
|
155
156
|
|
|
156
157
|
### Storage implementations
|
|
@@ -160,11 +161,12 @@ Expo storage or Convex helpers.
|
|
|
160
161
|
- `@open-e2ee/signal-protocol-sdk/local/store/expo` also exports the Expo helpers
|
|
161
162
|
Signal Protocol composes directly: `getKeyStorage`, `getDatabaseKeyManager`,
|
|
162
163
|
`clearDatabaseKeyCache`, and `createPreKeyMaintenanceStore`
|
|
163
|
-
- `IndexedDbSignalProtocolStore` / `indexedDbStore()` for browsers
|
|
164
|
+
- `IndexedDbSignalProtocolStore` / `indexedDbStore()` for browsers
|
|
164
165
|
- `ReactNativeSignalProtocolStore` / `reactNativeStore()` for bare React Native
|
|
165
|
-
(
|
|
166
|
+
(provide your own key-value backend and verify it with the exported
|
|
167
|
+
backend-conformance kit)
|
|
166
168
|
- `NodeSignalProtocolStore` / `nodeStore()` for Node environments
|
|
167
|
-
- `
|
|
169
|
+
- `InMemorySignalProtocolStore` / `inMemoryStore()` for local development
|
|
168
170
|
- custom implementations via `ISignalProtocolLocalStore`
|
|
169
171
|
|
|
170
172
|
### Remote object storage
|
package/docs/RECIPES.md
CHANGED
|
@@ -13,14 +13,14 @@ uses public exports only.
|
|
|
13
13
|
This local demo sends while Bob is offline so you can see the relay's encrypted
|
|
14
14
|
envelope and Bob's decrypted plaintext in the same workflow.
|
|
15
15
|
|
|
16
|
-
<!--
|
|
16
|
+
<!-- doc-snippet:run recipes-two-local-clients expect="bob decrypted: alice: hello" -->
|
|
17
17
|
```ts
|
|
18
18
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
19
19
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
21
|
+
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
22
22
|
|
|
23
|
-
const relay =
|
|
23
|
+
const relay = inMemoryRelay();
|
|
24
24
|
|
|
25
25
|
// The relay knows which devices exist, but it does not get plaintext.
|
|
26
26
|
await relay.registerDevice("alice", {
|
|
@@ -31,12 +31,12 @@ await relay.registerDevice("bob", { encryptedDeviceName: new ArrayBuffer(0) });
|
|
|
31
31
|
// Each client represents one device. Its storage is local to that device.
|
|
32
32
|
const alice = await createSignalProtocolClient({
|
|
33
33
|
identity: { userId: "alice" },
|
|
34
|
-
adapters: { storage:
|
|
34
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const bob = await createSignalProtocolClient({
|
|
38
38
|
identity: { userId: "bob" },
|
|
39
|
-
adapters: { storage:
|
|
39
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
await alice.syncToServer();
|
|
@@ -135,25 +135,25 @@ before creating the client.
|
|
|
135
135
|
|
|
136
136
|
## Local development
|
|
137
137
|
|
|
138
|
-
<!--
|
|
138
|
+
<!-- doc-snippet:run recipes-local-development expect="" -->
|
|
139
139
|
```ts
|
|
140
140
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
141
141
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
142
|
-
import {
|
|
143
|
-
import {
|
|
142
|
+
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
143
|
+
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
144
144
|
|
|
145
|
-
const relay =
|
|
145
|
+
const relay = inMemoryRelay();
|
|
146
146
|
|
|
147
147
|
const alice = await createSignalProtocolClient({
|
|
148
148
|
// `identity` is the app account/device being represented.
|
|
149
149
|
identity: { userId: "alice" },
|
|
150
150
|
// `adapters` are the concrete storage/relay implementation for this run.
|
|
151
|
-
adapters: { storage:
|
|
151
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
const bob = await createSignalProtocolClient({
|
|
155
155
|
identity: { userId: "bob" },
|
|
156
|
-
adapters: { storage:
|
|
156
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
157
157
|
});
|
|
158
158
|
```
|
|
159
159
|
|
package/local/store/README.md
CHANGED
|
@@ -22,23 +22,110 @@ without coupling the client to a database or platform.
|
|
|
22
22
|
|
|
23
23
|
### Local development
|
|
24
24
|
|
|
25
|
-
- `
|
|
25
|
+
- `InMemorySignalProtocolStore` from `@open-e2ee/signal-protocol-sdk/local/store/memory`
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Web
|
|
28
28
|
|
|
29
29
|
- `IndexedDbSignalProtocolStore` from `@open-e2ee/signal-protocol-sdk/local/store/web`
|
|
30
|
+
|
|
31
|
+
Use this for browser applications. It implements the full core store
|
|
32
|
+
contract, including SESAME records, sender-key state, retry message records,
|
|
33
|
+
and recovery helpers, and it graduated from experimental by completing every
|
|
34
|
+
gate on the checklist below. Deployment still requires the origin-security
|
|
35
|
+
review described in the [web adapter guide](./web/README.md).
|
|
36
|
+
|
|
37
|
+
### Bare React Native
|
|
38
|
+
|
|
30
39
|
- `ReactNativeSignalProtocolStore` from `@open-e2ee/signal-protocol-sdk/local/store/react-native` (create it with `await ReactNativeSignalProtocolStore.create({ storage })` and provide your own key-value backend)
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
Use this for bare React Native applications that supply their own key-value
|
|
42
|
+
backend. It implements the full core store contract, including SESAME records,
|
|
43
|
+
sender-key state, retry message records, and recovery helpers, and it
|
|
44
|
+
graduated from experimental by completing every gate on the checklist below.
|
|
45
|
+
The supplied backend is the application's responsibility: verify it with the
|
|
46
|
+
exported backend-conformance kit described in the
|
|
47
|
+
[React Native adapter guide](./react-native/README.md).
|
|
48
|
+
|
|
49
|
+
#### Graduation checklist
|
|
50
|
+
|
|
51
|
+
The experimental label comes off an adapter when every item below is a named,
|
|
52
|
+
continuously running CI gate. Each gate tests the adapter's own contract —
|
|
53
|
+
the promises `ISignalProtocolLocalStore` makes — never the platform under it:
|
|
54
|
+
browsers, IndexedDB, and React Native are the environment an adapter must
|
|
55
|
+
honor its promises in, not the subject of a test.
|
|
56
|
+
|
|
57
|
+
`IndexedDbSignalProtocolStore` (graduated; the gates keep running):
|
|
58
|
+
|
|
59
|
+
- [x] Storage contract suites pass in real Chromium, Firefox, and WebKit on
|
|
60
|
+
every change to the source repository. The suites are the same modules
|
|
61
|
+
the jest gate runs, so a matcher means the same thing in both gates.
|
|
62
|
+
- [x] Interruption tests: a real tab is destroyed while a write is in
|
|
63
|
+
flight — atomic session/trust commit, identity rotation, fresh-database
|
|
64
|
+
bootstrap, and a prekey batch — and the store reopened from a fresh tab
|
|
65
|
+
is readable on the next `initialize()`, with each atomic security
|
|
66
|
+
commit observed either fully applied or fully absent, never partial.
|
|
67
|
+
Runs in all three engines on every change to the source repository.
|
|
68
|
+
- [x] Multi-tab tests: concurrent revision-checked writes from two real
|
|
69
|
+
tabs — two live IndexedDB connections — resolve per the contract's
|
|
70
|
+
compare-and-set promise: one winner per create race, losers told
|
|
71
|
+
instead of silently overwritten, rejected commits leave no partial
|
|
72
|
+
state. Runs in all three engines on every change to the source
|
|
73
|
+
repository.
|
|
74
|
+
- [x] Storage-pressure tests: quota exhaustion surfaces as the typed
|
|
75
|
+
`StorageQuotaExceededError` (`STORAGE_QUOTA_EXCEEDED`), never a silent
|
|
76
|
+
partial write. A jest suite drives quota-shaped backend failures
|
|
77
|
+
through every write path in the adapter, and a real Chromium run
|
|
78
|
+
exhausts a clamped origin quota and observes the typed rejection, no
|
|
79
|
+
partial state, and a clean retry once space frees. Runs on every
|
|
80
|
+
change to the source repository.
|
|
81
|
+
- [x] Soak evidence: a long-run open/write/close cycle holds memory and
|
|
82
|
+
latency flat. A soak runner drives 2,000 full
|
|
83
|
+
construct/initialize/write/read/close cycles through the adapter in
|
|
84
|
+
one real Chromium page, samples renderer memory - including
|
|
85
|
+
ArrayBuffer backing stores - after forced garbage collection, and
|
|
86
|
+
fails if the late-run median of memory or per-cycle latency grows
|
|
87
|
+
beyond a small tolerance over the early-run median. Runs on every
|
|
88
|
+
change to the source repository, and `npm run soak:web-store` runs
|
|
89
|
+
longer sessions on demand.
|
|
90
|
+
|
|
91
|
+
`ReactNativeSignalProtocolStore` (graduated; the gates keep running):
|
|
92
|
+
|
|
93
|
+
- [x] Exported backend-conformance kit: the SDK cannot test an
|
|
94
|
+
application-supplied `storage` backend, so it ships the contract suite
|
|
95
|
+
the application runs against its own backend. `runBackendConformance`
|
|
96
|
+
and `assertBackendConformance` execute thirteen cases against any
|
|
97
|
+
`ReactNativeKeyValueStorage`: round-trips, key listing, batch removal,
|
|
98
|
+
in-order atomic application, checks evaluated against pre-batch state,
|
|
99
|
+
null-guarded creation, all-or-nothing failure, exact-userId session
|
|
100
|
+
removal with in-batch visibility, one winner between concurrent
|
|
101
|
+
guarded batches, and durability across reopen. A jest gate proves the
|
|
102
|
+
kit catches a non-atomic backend, a prefix-matching session removal,
|
|
103
|
+
and an unserialized backend, on every change to the source repository.
|
|
104
|
+
- [x] Reference backend passes that kit on Hermes in CI.
|
|
105
|
+
`createReferenceReactNativeBackend` is the executable specification of
|
|
106
|
+
the backend contract, and a named gate bundles the kit with esbuild
|
|
107
|
+
and runs it against the reference backend on the sha256-pinned Hermes
|
|
108
|
+
CLI — the engine React Native ships with — on every change to the
|
|
109
|
+
source repository. The runner requires an explicit pass sentinel
|
|
110
|
+
because Hermes exits 0 on an unhandled async rejection.
|
|
111
|
+
- [x] Interruption and storage-pressure tests against the reference
|
|
112
|
+
backend. A simulated process kill before commit leaves each atomic
|
|
113
|
+
security write — session/trust commit, identity rotation, trust
|
|
114
|
+
verification — fully absent after reopen, and an identical retry lands
|
|
115
|
+
it fully applied. Quota exhaustion surfaces as the typed
|
|
116
|
+
`StorageQuotaExceededError` (`STORAGE_QUOTA_EXCEEDED`), never a silent
|
|
117
|
+
partial write: a jest suite drives quota-shaped backend failures
|
|
118
|
+
through every write path, and a real-quota run over the reference
|
|
119
|
+
backend observes the typed rejection, no partial state, and a clean
|
|
120
|
+
retry once space frees. Runs on every change to the source repository.
|
|
36
121
|
|
|
37
122
|
### Node
|
|
38
123
|
|
|
39
124
|
- `NodeSignalProtocolStore` from `@open-e2ee/signal-protocol-sdk/local/store/node`
|
|
40
125
|
|
|
41
|
-
Use this for non-mobile environments that need a filesystem-backed store.
|
|
126
|
+
Use this for non-mobile environments that need a filesystem-backed store. It
|
|
127
|
+
implements the full core store contract, including SESAME records, sender-key
|
|
128
|
+
state, retry message records, and recovery helpers.
|
|
42
129
|
|
|
43
130
|
## Composition
|
|
44
131
|
|
|
@@ -105,7 +192,9 @@ can leave a concurrently-created session trusted under a rotated identity.
|
|
|
105
192
|
still requires review of key custody, backups, and host security.
|
|
106
193
|
- `@open-e2ee/signal-protocol-sdk/local/store/expo` is also the package home for Expo-specific
|
|
107
194
|
integration helpers that a real app composes directly.
|
|
108
|
-
-
|
|
195
|
+
- An adapter carries the experimental label until every item on its
|
|
196
|
+
graduation checklist is a named, continuously running CI gate. Both the web
|
|
197
|
+
and bare React Native adapters have completed theirs.
|
|
109
198
|
- Storage adapters should expose the real package contract instead of app-specific wrappers.
|
|
110
199
|
|
|
111
200
|
## Related Docs
|
|
@@ -117,4 +206,4 @@ can leave a concurrently-created session trusted under a rotated identity.
|
|
|
117
206
|
- [Node adapter](./node/README.md)
|
|
118
207
|
- [Bare React Native adapter](./react-native/README.md)
|
|
119
208
|
- [Web adapter](./web/README.md)
|
|
120
|
-
- [
|
|
209
|
+
- [In-memory adapter](./memory/README.md)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# In-Memory Store
|
|
2
2
|
|
|
3
|
-
`
|
|
3
|
+
`InMemorySignalProtocolStore` implements `ISignalProtocolLocalStore` in memory for examples, local
|
|
4
4
|
development, and deterministic application prototypes.
|
|
5
5
|
|
|
6
6
|
Real protocol and cryptography; simulated in-memory infrastructure.
|
|
@@ -16,11 +16,11 @@ security or persistence boundary.
|
|
|
16
16
|
```ts
|
|
17
17
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
18
18
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
19
|
-
import {
|
|
19
|
+
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
20
20
|
|
|
21
21
|
const client = await createSignalProtocolClient({
|
|
22
22
|
identity: { userId: "alice" },
|
|
23
|
-
adapters: { storage:
|
|
23
|
+
adapters: { storage: inMemoryStore() },
|
|
24
24
|
});
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -35,17 +35,17 @@ you can target the next named store operation:
|
|
|
35
35
|
```ts
|
|
36
36
|
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
37
37
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} from "@open-e2ee/signal-protocol-sdk/local/store/
|
|
38
|
+
inMemoryStore,
|
|
39
|
+
InjectedStorageWriteError,
|
|
40
|
+
} from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
41
41
|
|
|
42
|
-
const storage =
|
|
42
|
+
const storage = inMemoryStore({ failures: { seed: 7 } });
|
|
43
43
|
storage.failures.failNextWrite("setMetadata");
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
await storage.setMetadata("draft", "encrypted-pointer");
|
|
47
47
|
} catch (error) {
|
|
48
|
-
if (error instanceof
|
|
48
|
+
if (error instanceof InjectedStorageWriteError) {
|
|
49
49
|
// The explicitly injected failure is consumed, so this retry succeeds.
|
|
50
50
|
await storage.setMetadata("draft", "encrypted-pointer");
|
|
51
51
|
}
|
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
`NodeSignalProtocolStore` provides Node.js protocol storage using encrypted,
|
|
4
4
|
crash-durable filesystem state.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
use `mockStore` for development or implement the full interface against your
|
|
13
|
-
own database (see [Integration Interfaces](../../../docs/INTERFACES.md)).
|
|
6
|
+
It implements all of `ISignalProtocolLocalStore` — identity, prekeys, sessions,
|
|
7
|
+
Kyber prekeys, Sesame device records, sender keys, and message records — so
|
|
8
|
+
multi-device and group flows work in Node without a custom adapter. The class
|
|
9
|
+
declares `implements ISignalProtocolLocalStore`, so the compiler rejects any
|
|
10
|
+
build in which a member is missing or its signature drifts; that check is the
|
|
11
|
+
guarantee behind this paragraph, not a manual audit.
|
|
14
12
|
|
|
15
13
|
## Why it exists
|
|
16
14
|
|
|
@@ -32,8 +32,40 @@ compare-and-swap checks and commit all writes, removals, and exact per-user
|
|
|
32
32
|
session deletion atomically and durably, including across process termination.
|
|
33
33
|
A batched sequence of independent writes is not sufficient.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
## Verifying your backend
|
|
36
|
+
|
|
37
|
+
The adapter's guarantees hold only over a backend that honors the
|
|
38
|
+
`ReactNativeKeyValueStorage` contract, and the SDK cannot test the backend
|
|
39
|
+
your application supplies. The package therefore exports a
|
|
40
|
+
backend-conformance kit — run it against your backend from your
|
|
41
|
+
application's own tests:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import {
|
|
45
|
+
assertBackendConformance,
|
|
46
|
+
createReferenceReactNativeBackend,
|
|
47
|
+
} from "@open-e2ee/signal-protocol-sdk/local/store/react-native";
|
|
48
|
+
|
|
49
|
+
await assertBackendConformance({
|
|
50
|
+
createBackend: () => createMyBackend(),
|
|
51
|
+
// Optional: return a new instance over the same persistence medium to
|
|
52
|
+
// verify committed writes survive reopen. Reported as skipped when absent.
|
|
53
|
+
reopen: (previous) => reopenMyBackend(previous),
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`assertBackendConformance` throws one error naming every failing case;
|
|
58
|
+
`runBackendConformance` returns the structured result instead.
|
|
59
|
+
`createReferenceReactNativeBackend` is the executable specification of the
|
|
60
|
+
contract: an in-memory backend that passes the kit, useful as a comparison
|
|
61
|
+
point and as a test double. Continuous integration runs the kit against the
|
|
62
|
+
reference backend on the Hermes engine, and drives the adapter over it
|
|
63
|
+
through interruption and storage-pressure suites; the checklist that
|
|
64
|
+
graduated this adapter is in the parent [storage guide](../README.md).
|
|
65
|
+
|
|
66
|
+
Key custody, crash durability, and backup behavior remain properties of your
|
|
67
|
+
chosen native storage engine — the kit verifies contract semantics, and your
|
|
68
|
+
deployment review must still cover the engine itself.
|
|
37
69
|
|
|
38
70
|
See the parent [storage guide](../README.md), [adapter guide](../../../ADAPTERS.md),
|
|
39
71
|
and [security model](../../../docs/SECURITY.md).
|
|
@@ -57,9 +57,36 @@ and [MDN Content Security Policy guide](https://developer.mozilla.org/docs/Web/H
|
|
|
57
57
|
## Operational status
|
|
58
58
|
|
|
59
59
|
The adapter covers the core store contract, including atomic security commits,
|
|
60
|
-
SESAME state, sender-key state, and retry records.
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
SESAME state, sender-key state, and retry records. Every gate on its
|
|
61
|
+
graduation checklist in the parent [storage guide](../README.md) runs
|
|
62
|
+
continuously, and the experimental label has come off: this is a supported
|
|
63
|
+
adapter. Deployment still requires review of the origin-security controls
|
|
64
|
+
above.
|
|
65
|
+
|
|
66
|
+
When a write exhausts the origin's storage quota, it rejects with the typed
|
|
67
|
+
`StorageQuotaExceededError` (code `STORAGE_QUOTA_EXCEEDED`). Every write
|
|
68
|
+
commits in one atomic transaction, so the error always means the write did
|
|
69
|
+
not persist — never a partial record. The application should free space or
|
|
70
|
+
request more from the platform, then retry.
|
|
71
|
+
|
|
72
|
+
The storage contract suites run against this adapter in real Chromium,
|
|
73
|
+
Firefox, and WebKit on every change to the source repository. A multi-tab
|
|
74
|
+
suite drives concurrent revision-checked writes through two live
|
|
75
|
+
connections on one origin — the state a deployed application enters when a
|
|
76
|
+
user opens a second tab — an interruption suite destroys a tab while a
|
|
77
|
+
write is in flight, then asserts the reopened store is readable and every
|
|
78
|
+
atomic security commit landed all-or-nothing, and a storage-pressure suite
|
|
79
|
+
clamps the origin's quota in Chromium, exhausts it, and asserts the typed
|
|
80
|
+
rejection, intact prior state, and a clean retry once space frees, while a
|
|
81
|
+
jest suite drives quota-shaped backend failures through every write path
|
|
82
|
+
in the adapter. A soak runner drives thousands of full
|
|
83
|
+
open/write/read/close cycles through the adapter in one Chromium page and
|
|
84
|
+
fails if memory — including ArrayBuffer backing stores, sampled after
|
|
85
|
+
forced garbage collection — or per-cycle latency drifts upward across the
|
|
86
|
+
run. The contract suites are the same modules the jest gate runs, and
|
|
87
|
+
every assertion targets this adapter's contract — the engines are the
|
|
88
|
+
environment the adapter must honor its promises in, not the subject of
|
|
89
|
+
the tests.
|
|
63
90
|
|
|
64
91
|
See the parent [storage guide](../README.md), [adapter guide](../../../ADAPTERS.md),
|
|
65
92
|
and [security model](../../../docs/SECURITY.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-e2ee/signal-protocol-sdk",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Signal Protocol E2EE SDK for TypeScript — Expo, React Native, browser, and Node. Post-quantum PQXDH and Double Ratchet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"open-e2ee",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"types": "./dist/remote/relay/convex/component/convex.config.d.ts",
|
|
68
68
|
"default": "./dist/remote/relay/convex/component/convex.config.js"
|
|
69
69
|
},
|
|
70
|
-
"./remote/relay/
|
|
71
|
-
"types": "./dist/remote/relay/
|
|
72
|
-
"default": "./dist/remote/relay/
|
|
70
|
+
"./remote/relay/memory": {
|
|
71
|
+
"types": "./dist/remote/relay/memory/index.d.ts",
|
|
72
|
+
"default": "./dist/remote/relay/memory/index.js"
|
|
73
73
|
},
|
|
74
74
|
"./remote/relay/types": {
|
|
75
75
|
"types": "./dist/remote/relay/types.d.ts",
|
|
@@ -115,6 +115,10 @@
|
|
|
115
115
|
"types": "./dist/device/device-id.d.ts",
|
|
116
116
|
"default": "./dist/device/device-id.js"
|
|
117
117
|
},
|
|
118
|
+
"./device/expo-metadata": {
|
|
119
|
+
"types": "./dist/device/expo-metadata.d.ts",
|
|
120
|
+
"default": "./dist/device/expo-metadata.js"
|
|
121
|
+
},
|
|
118
122
|
"./device/lifecycle": {
|
|
119
123
|
"types": "./dist/device/lifecycle/index.d.ts",
|
|
120
124
|
"default": "./dist/device/lifecycle/index.js"
|
|
@@ -203,9 +207,9 @@
|
|
|
203
207
|
"types": "./dist/local/store/expo/schema.d.ts",
|
|
204
208
|
"default": "./dist/local/store/expo/schema.js"
|
|
205
209
|
},
|
|
206
|
-
"./local/store/
|
|
207
|
-
"types": "./dist/local/store/
|
|
208
|
-
"default": "./dist/local/store/
|
|
210
|
+
"./local/store/memory": {
|
|
211
|
+
"types": "./dist/local/store/memory/index.d.ts",
|
|
212
|
+
"default": "./dist/local/store/memory/index.js"
|
|
209
213
|
},
|
|
210
214
|
"./local/store/node": {
|
|
211
215
|
"types": "./dist/local/store/node/index.d.ts",
|
|
@@ -315,7 +319,7 @@
|
|
|
315
319
|
"keys/README.md",
|
|
316
320
|
"local/store/README.md",
|
|
317
321
|
"local/store/expo/README.md",
|
|
318
|
-
"local/store/
|
|
322
|
+
"local/store/memory/README.md",
|
|
319
323
|
"local/store/node/README.md",
|
|
320
324
|
"local/store/react-native/README.md",
|
|
321
325
|
"local/store/web/README.md",
|
|
@@ -329,7 +333,7 @@
|
|
|
329
333
|
"remote/relay/README.md",
|
|
330
334
|
"remote/relay/convex/README.md",
|
|
331
335
|
"remote/relay/convex/component/README.md",
|
|
332
|
-
"remote/relay/
|
|
336
|
+
"remote/relay/memory/README.md",
|
|
333
337
|
"safety/README.md",
|
|
334
338
|
"scripts/oe-groups.mjs",
|
|
335
339
|
"sealed-sender/README.md",
|
|
@@ -419,7 +423,6 @@
|
|
|
419
423
|
"@noble/hashes": "2.2.0",
|
|
420
424
|
"@noble/post-quantum": "^0.6.1",
|
|
421
425
|
"async-lock": "^1.4.0",
|
|
422
|
-
"protobufjs": "^8.6.5",
|
|
423
426
|
"unique-names-generator": "^4.7.1"
|
|
424
427
|
},
|
|
425
428
|
"overrides": {
|
package/remote/README.md
CHANGED
|
@@ -18,7 +18,7 @@ replaceable and prevent them from owning private keys or plaintext.
|
|
|
18
18
|
### Relay
|
|
19
19
|
|
|
20
20
|
- `ConvexSignalProtocolRelayServer` from `@open-e2ee/signal-protocol-sdk/remote/relay/convex`
|
|
21
|
-
- `
|
|
21
|
+
- `InMemorySignalProtocolRelayServer` from `@open-e2ee/signal-protocol-sdk/remote/relay/memory`
|
|
22
22
|
- custom implementations via `ISignalProtocolRelayServer`
|
|
23
23
|
|
|
24
24
|
### Remote object storage
|
|
@@ -190,22 +190,22 @@ needed to authorize and construct short-lived operations.
|
|
|
190
190
|
|
|
191
191
|
## Local development
|
|
192
192
|
|
|
193
|
-
Use `
|
|
193
|
+
Use `InMemorySignalProtocolRelayServer` when multiple clients need a shared in-memory relay:
|
|
194
194
|
|
|
195
195
|
```ts
|
|
196
196
|
import { SignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
197
|
-
import {
|
|
198
|
-
import {
|
|
197
|
+
import { InMemorySignalProtocolRelayServer } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
198
|
+
import { InMemorySignalProtocolStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
199
199
|
|
|
200
|
-
const relay = new
|
|
200
|
+
const relay = new InMemorySignalProtocolRelayServer();
|
|
201
201
|
|
|
202
202
|
const alice = await SignalProtocolClient.create("alice", {
|
|
203
|
-
storage: new
|
|
203
|
+
storage: new InMemorySignalProtocolStore(),
|
|
204
204
|
relay,
|
|
205
205
|
});
|
|
206
206
|
|
|
207
207
|
const bob = await SignalProtocolClient.create("bob", {
|
|
208
|
-
storage: new
|
|
208
|
+
storage: new InMemorySignalProtocolStore(),
|
|
209
209
|
relay,
|
|
210
210
|
});
|
|
211
211
|
```
|
package/remote/relay/README.md
CHANGED
|
@@ -15,14 +15,14 @@ plaintext ownership to the backend.
|
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
17
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
19
|
+
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
20
20
|
|
|
21
|
-
const relay =
|
|
21
|
+
const relay = inMemoryRelay();
|
|
22
22
|
|
|
23
23
|
const client = await createSignalProtocolClient({
|
|
24
24
|
identity: { userId: "alice" },
|
|
25
|
-
adapters: { storage:
|
|
25
|
+
adapters: { storage: inMemoryStore(), relay },
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
await client.syncToServer();
|
|
@@ -35,4 +35,4 @@ enforce access policy, and store only encrypted envelopes plus required routing
|
|
|
35
35
|
metadata.
|
|
36
36
|
|
|
37
37
|
See the [remote guide](../README.md), [interface guide](../../docs/INTERFACES.md),
|
|
38
|
-
[
|
|
38
|
+
[in-memory relay guide](./memory/README.md), and [API reference](../../docs/api/README.md).
|