@open-e2ee/signal-protocol-sdk 0.3.0 → 0.4.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 +7 -0
- package/ARCHITECTURE.md +2 -0
- package/CHANGELOG.md +33 -0
- package/README.md +64 -102
- package/SECURITY.md +2 -2
- package/TROUBLESHOOTING.md +7 -0
- package/blocking/README.md +1 -0
- package/client/README.md +10 -0
- package/device/README.md +5 -0
- package/dist/client/groups.d.ts.map +1 -1
- package/dist/client/groups.js +14 -4
- package/dist/client/groups.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/sesame/types.d.ts +0 -2
- package/dist/internal/sesame/types.d.ts.map +1 -1
- package/dist/internal/sesame/types.js +0 -2
- package/dist/internal/sesame/types.js.map +1 -1
- package/dist/media/index.d.ts +0 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +0 -1
- package/dist/media/index.js.map +1 -1
- package/dist/remote/relay/convex/backend.d.ts +2 -2
- package/dist/remote/relay/convex/backend.d.ts.map +1 -1
- package/dist/remote/relay/convex/backend.js +1 -1
- package/dist/remote/relay/convex/backend.js.map +1 -1
- package/dist/remote/relay/convex/component/_generated/component.d.ts +2 -2
- package/dist/remote/relay/convex/component/_generated/component.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/messages.d.ts +2 -2
- package/dist/remote/relay/convex/component/messages.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/messages.js +1 -1
- package/dist/remote/relay/convex/component/messages.js.map +1 -1
- package/dist/remote/relay/convex/component/schema.d.ts +2 -2
- package/dist/remote/relay/convex/component/schema.js +1 -1
- package/dist/remote/relay/convex/component/schema.js.map +1 -1
- package/dist/utils/retry.d.ts +2 -1
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +2 -1
- package/dist/utils/retry.js.map +1 -1
- package/docs/ASSURANCE.md +11 -5
- package/docs/CLIENT_COMPOSITION.md +3 -0
- package/docs/DOCUMENTATION_STANDARDS.md +28 -0
- package/docs/ERROR_HANDLING.md +91 -60
- package/docs/GETTING_STARTED.md +20 -1
- package/docs/INTERFACES.md +5 -0
- package/docs/PACKAGE_SURFACE.md +1 -0
- package/docs/PROTOCOL_POLICY.md +6 -0
- package/docs/RECIPES.md +9 -0
- package/encoding/README.md +1 -0
- package/files/README.md +1 -0
- package/groups/README.md +1 -0
- package/keys/README.md +2 -0
- package/local/store/README.md +2 -0
- package/local/store/expo/README.md +2 -0
- package/local/store/memory/README.md +2 -0
- package/local/store/node/README.md +1 -0
- package/local/store/react-native/README.md +2 -0
- package/local/store/web/README.md +1 -0
- package/local/vault/README.md +1 -0
- package/media/README.md +2 -0
- package/package.json +4 -2
- package/profile/README.md +1 -0
- package/remote/README.md +6 -0
- package/remote/object-store/README.md +1 -0
- package/remote/object-store/convex-r2/README.md +2 -0
- package/remote/object-store/s3/README.md +1 -0
- package/remote/relay/README.md +2 -0
- package/remote/relay/convex/README.md +1 -0
- package/remote/relay/convex/component/README.md +9 -0
- package/remote/relay/memory/README.md +2 -0
- package/safety/README.md +1 -0
- package/sealed-sender/README.md +1 -0
- package/types/README.md +1 -0
- package/username/README.md +1 -0
- package/utils/README.md +1 -0
- package/zk/README.md +1 -0
package/ADAPTERS.md
CHANGED
|
@@ -67,7 +67,9 @@ functions retain authentication, authorization, and persistence.
|
|
|
67
67
|
|
|
68
68
|
### Minimal local client
|
|
69
69
|
|
|
70
|
+
<!-- doc-snippet:run adapters-local-client expect="" -->
|
|
70
71
|
```ts
|
|
72
|
+
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
71
73
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
72
74
|
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
73
75
|
|
|
@@ -79,6 +81,7 @@ const signal = await createSignalProtocolClient({
|
|
|
79
81
|
|
|
80
82
|
### Production client
|
|
81
83
|
|
|
84
|
+
<!-- doc-snippet:skip requires-production-adapters -->
|
|
82
85
|
```ts
|
|
83
86
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
84
87
|
import {
|
|
@@ -110,7 +113,9 @@ database and SQLCipher bootstrap.
|
|
|
110
113
|
|
|
111
114
|
### Local development with a shared relay
|
|
112
115
|
|
|
116
|
+
<!-- doc-snippet:run adapters-shared-relay expect="" -->
|
|
113
117
|
```ts
|
|
118
|
+
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
114
119
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
115
120
|
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
116
121
|
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
@@ -160,6 +165,7 @@ Prefer these composition patterns:
|
|
|
160
165
|
|
|
161
166
|
Use the public interfaces:
|
|
162
167
|
|
|
168
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
163
169
|
```ts
|
|
164
170
|
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
165
171
|
import type { ISignalProtocolRelayServer } from "@open-e2ee/signal-protocol-sdk/remote/relay";
|
|
@@ -169,6 +175,7 @@ import type { ISignalProtocolLocalStore } from "@open-e2ee/signal-protocol-sdk/l
|
|
|
169
175
|
|
|
170
176
|
Then compose them through `createSignalProtocolClient()`:
|
|
171
177
|
|
|
178
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
172
179
|
```ts
|
|
173
180
|
const signal = await createSignalProtocolClient({
|
|
174
181
|
identity: { userId },
|
package/ARCHITECTURE.md
CHANGED
|
@@ -56,6 +56,7 @@ modify the code.
|
|
|
56
56
|
|
|
57
57
|
The root package is core-only:
|
|
58
58
|
|
|
59
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
59
60
|
```ts
|
|
60
61
|
import {
|
|
61
62
|
SignalProtocolClient,
|
|
@@ -152,6 +153,7 @@ This boundary prevents lower protocol/session layers from depending on the clien
|
|
|
152
153
|
|
|
153
154
|
Application code should prefer:
|
|
154
155
|
|
|
156
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
155
157
|
```ts
|
|
156
158
|
await createSignalProtocolClient({
|
|
157
159
|
identity: { userId },
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
- **The README now provides a runnable encrypted round trip and a current demo.**
|
|
6
|
+
The quickstart exercises two SDK clients through the in-memory relay. The new
|
|
7
|
+
recording shows the same two-device and relay flow as the live desktop and
|
|
8
|
+
mobile demo.
|
|
9
|
+
|
|
10
|
+
- **Error-surface checks reject unresolved codes and cover media attachment
|
|
11
|
+
codes.** The analyser now reports forwarded code arguments in CI.
|
|
12
|
+
It also checks every `MediaAttachmentErrorCode` value.
|
|
13
|
+
This release removes `RemoteObjectStoreNotConfigured` because no media
|
|
14
|
+
operation could produce it.
|
|
15
|
+
|
|
16
|
+
- **The retry-request wire surface no longer includes
|
|
17
|
+
`RetryReason.INVALID_MESSAGE`.** No local failure produced it. The incoming
|
|
18
|
+
retry handler did not support it. Malformed ciphertext failures use the supported
|
|
19
|
+
`DECRYPTION_FAILED` recovery path.
|
|
20
|
+
|
|
21
|
+
- **Generated API pages and shipped documentation examples now have source
|
|
22
|
+
gates.** CI regenerates `docs/api` with pinned tool versions. It rejects a
|
|
23
|
+
diff. The snippet runner scans every packaged Markdown file and the internal
|
|
24
|
+
lifecycle docs. It executes every complete example and matches its output.
|
|
25
|
+
For an example that cannot run, it compiles every SDK name against the packed
|
|
26
|
+
package. A renamed or deleted export therefore fails the build in every
|
|
27
|
+
document that names it.
|
|
28
|
+
|
|
29
|
+
An example that previews an unreleased API declares the import paths that do
|
|
30
|
+
not exist yet. The build fails if one of them resolves. Only pseudocode is
|
|
31
|
+
exempt, and the build names each exempt block on its own line.
|
|
32
|
+
|
|
33
|
+
- **The error guide now documents all 33 `EncryptionErrorCode` values.** Its
|
|
34
|
+
session examples also use the current `ProtocolAddress` method signatures.
|
|
35
|
+
|
|
3
36
|
## 0.3.0
|
|
4
37
|
|
|
5
38
|
- **Breaking: seven error classes and sixteen `EncryptionErrorCode` members are
|
package/README.md
CHANGED
|
@@ -5,60 +5,46 @@
|
|
|
5
5
|
**End-to-end encrypted messaging for TypeScript apps. Signal Protocol, post-quantum by default, runs in Expo.**
|
|
6
6
|
|
|
7
7
|
[](https://github.com/open-e2ee/signal-protocol-js/blob/main/LICENSE)
|
|
8
|
-
[](https://www.typescriptlang.org/)
|
|
9
8
|
[](https://www.npmjs.com/package/@open-e2ee/signal-protocol-sdk)
|
|
10
|
-
[](./ARCHITECTURE.md)
|
|
11
10
|
[](https://www.npmjs.com/package/@open-e2ee/signal-protocol-sdk#provenance)
|
|
12
11
|
[](https://github.com/open-e2ee/signal-protocol-js/actions/workflows/ci.yml)
|
|
13
|
-
[](https://scorecard.dev/viewer/?uri=github.com/open-e2ee/signal-protocol-js)
|
|
14
|
-
[](https://www.bestpractices.dev/projects/14043)
|
|
15
12
|
|
|
16
13
|
[Website](https://open-e2ee.dev) ·
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[Security
|
|
21
|
-
[Protocol Policy](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/PROTOCOL_POLICY.md) ·
|
|
22
|
-
[Deviations](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/DEVIATIONS.md)
|
|
14
|
+
[Documentation](https://docs.open-e2ee.dev) ·
|
|
15
|
+
[Live demo](https://open-e2ee.dev/#demo) ·
|
|
16
|
+
[API reference](https://docs.open-e2ee.dev/reference/api) ·
|
|
17
|
+
[Security](./SECURITY.md)
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
- **One TypeScript package.** Run the same protocol code in Expo, React Native, modern browsers, and Node.
|
|
20
|
+
- **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.
|
|
21
|
+
- **Messaging primitives included.** Build multi-device messaging, groups, sealed sender, encrypted attachments, and safety-number verification.
|
|
22
|
+
- **Your infrastructure, behind explicit interfaces.** Your application owns device-local storage. The relay is an interface, not a hosted service. The relay never needs message plaintext or device private keys.
|
|
23
|
+
- **AGPLv3, or a commercial license.** Proprietary applications that cannot meet AGPLv3 obligations can use a [commercial license](./COMMERCIAL.md).
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
- **Runs where your app runs.** Expo, React Native, modern browsers, and Node from one package.
|
|
28
|
-
- **Post-quantum by default.** PQXDH and ML-KEM session establishment are on without configuration, and fail closed.
|
|
29
|
-
- **Real messaging features.** Multi-device, groups, sealed sender, encrypted attachments, safety numbers.
|
|
30
|
-
- **Pluggable storage and relay.** Your application owns the required device-local storage. The relay is an interface, not a hosted service.
|
|
31
|
-
- **AGPLv3, or a commercial license.** Building something closed-source? See [COMMERCIAL](https://github.com/open-e2ee/signal-protocol-js/blob/main/COMMERCIAL.md).
|
|
25
|
+
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.
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
Version `0.4.x`. Public APIs and persisted formats can change before `1.0`.
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
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).
|
|
36
30
|
|
|
37
|
-
## See
|
|
31
|
+
## See an encrypted round trip
|
|
38
32
|
|
|
39
|
-
[](https://open-e2ee.dev/#demo)
|
|
40
34
|
|
|
41
|
-
The demo
|
|
42
|
-
|
|
43
|
-
The recording comes from [open-e2ee.dev/demo](https://open-e2ee.dev/demo). That page runs this package in the browser against the in-memory store and the in-memory relay. The protocol and the cryptography are real, and the adapters simulate the infrastructure in memory. Every scenario there prints the receiving device's own log, unedited.
|
|
35
|
+
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.
|
|
44
36
|
|
|
45
37
|
## Install
|
|
46
38
|
|
|
47
|
-
|
|
48
|
-
npm install @open-e2ee/signal-protocol-sdk
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Installing straight from the repository also works. The package compiles itself during install, so TypeScript is the only build requirement:
|
|
39
|
+
Requires Node 18 or later for the local example.
|
|
52
40
|
|
|
53
41
|
```bash
|
|
54
|
-
npm install
|
|
42
|
+
npm install @open-e2ee/signal-protocol-sdk
|
|
55
43
|
```
|
|
56
44
|
|
|
57
|
-
|
|
45
|
+
## Run a local encrypted round trip
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Two clients, one process, no account and no server. The relay holds the envelope. Only Bob's device turns it back into text.
|
|
47
|
+
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.
|
|
62
48
|
|
|
63
49
|
<!-- doc-snippet:run readme-quick-start expect="alice: hello" -->
|
|
64
50
|
```ts
|
|
@@ -80,97 +66,73 @@ const bob = await createSignalProtocolClient({
|
|
|
80
66
|
adapters: { storage: inMemoryStore(), relay },
|
|
81
67
|
});
|
|
82
68
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
const delivered = new Promise((resolve) => {
|
|
70
|
+
bob.registerHook("onMessageDecrypted", async (message) => {
|
|
71
|
+
console.log(`${message.senderId}: ${message.content}`);
|
|
72
|
+
bob.stopRelaySubscription();
|
|
73
|
+
resolve(undefined);
|
|
74
|
+
});
|
|
89
75
|
});
|
|
90
76
|
|
|
91
|
-
await alice.send("bob", "hello");
|
|
92
|
-
bob.startRelaySubscription();
|
|
77
|
+
await alice.send("bob", "hello");
|
|
78
|
+
bob.startRelaySubscription();
|
|
79
|
+
await delivered;
|
|
93
80
|
```
|
|
94
81
|
|
|
95
|
-
|
|
82
|
+
Expected output:
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Measured on 2026-08-03, these figures come from the GitHub API, the npm registry API, and the published package tarballs. Every alternative is a real project that does a real job. The axes below are the ones this SDK sets out to change, not a general quality ranking.
|
|
102
|
-
|
|
103
|
-
| | Expo / React Native | Browser | Maintained | Post-quantum | TypeScript-native | Commercial license |
|
|
104
|
-
|---|---|---|---|---|---|---|
|
|
105
|
-
| **`@open-e2ee/signal-protocol-sdk`** | Yes | Yes | Yes — `0.3.x`, active | Key agreement yes — PQXDH + ML-KEM, default and fails closed. Signatures no — identities are classical Ed25519 | Yes | Yes |
|
|
106
|
-
| [`@signalapp/libsignal-client`](https://github.com/signalapp/libsignal) | No — Node native addon; the 0.99.3 tarball ships binaries for macOS, Linux, and Windows only | No | Yes — very active; repo push 2026-07-31 | Key agreement yes | No — Rust core with TypeScript bindings | No (AGPL-3.0 only) |
|
|
107
|
-
| [`libsignal-protocol-javascript`](https://github.com/signalapp/libsignal-protocol-javascript) | No | Yes | No — archived, last push 2021-08-04 | No | No — JavaScript | No (GPL-3.0) |
|
|
108
|
-
| [`@privacyresearch/libsignal-protocol-typescript`](https://github.com/privacyresearchgroup/libsignal-protocol-typescript) | No documented React Native path | Yes | No — last npm publish 2023-05-06, last repo push 2023-07-18 | No | Yes | No (GPL-3.0) |
|
|
109
|
-
| [`ts-mls`](https://github.com/LukaJCB/ts-mls) | Not stated — browsers, Node, and serverless are the documented targets | Yes | Yes — very active; repo push 2026-08-03 | Key agreement and signatures — ML-KEM and ML-DSA-87 ciphersuites | Yes | Not needed (MIT) |
|
|
110
|
-
|
|
111
|
-
`ts-mls` implements [MLS (RFC 9420)](https://www.rfc-editor.org/rfc/rfc9420.html). That is a different protocol with different properties. If MLS suits your product, `ts-mls` is a good library, and this table is not an argument against it. Its post-quantum coverage also reaches further than this SDK's.
|
|
112
|
-
|
|
113
|
-
`@signalapp/libsignal-client` is the implementation Signal Messenger itself uses. Its README states that it does not support use outside Signal Messenger. Reach for it first when you ship a desktop or server application on Node.
|
|
84
|
+
```text
|
|
85
|
+
alice: hello
|
|
86
|
+
```
|
|
114
87
|
|
|
115
|
-
The
|
|
88
|
+
The client factory creates or loads each device identity. When given a relay, it also publishes the public prekey bundle. `send()` fetches Bob's bundle and starts the required post-quantum session. It then gives ciphertext plus routing metadata to the relay. Bob's subscription retrieves and decrypts the envelope on his device.
|
|
116
89
|
|
|
117
|
-
|
|
90
|
+
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 [hosted Quickstart](https://docs.open-e2ee.dev/start/quickstart), which explains key custody, relay metadata, prekey replenishment, additional devices, and recovery policy.
|
|
118
91
|
|
|
119
|
-
|
|
92
|
+
## Move to production storage
|
|
120
93
|
|
|
121
|
-
|
|
94
|
+
Choose the device-local store for your runtime, then supply a relay that authenticates each device and implements your product's access policy.
|
|
122
95
|
|
|
123
|
-
|
|
96
|
+
| Runtime | Storage path | Deployment boundary |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| Expo | [`expoStore`](./local/store/expo/README.md) | Configure SQLCipher before schema access. Requires a development build; it does not run in Expo Go. |
|
|
99
|
+
| 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. |
|
|
100
|
+
| Bare React Native | [`reactNativeStore`](./local/store/react-native/README.md) | Provide an atomic, durable key-value backend and run the exported backend conformance kit. |
|
|
101
|
+
| Node | [`nodeStore`](./local/store/node/README.md) | Set an explicit private data directory on a trusted local filesystem. |
|
|
124
102
|
|
|
125
|
-
|
|
103
|
+
The [adapter guide](./ADAPTERS.md) defines every storage, relay, vault, and object-store boundary. The [client composition guide](./docs/CLIENT_COMPOSITION.md) shows an Expo and Convex integration.
|
|
126
104
|
|
|
127
|
-
|
|
128
|
-
|---|---|
|
|
129
|
-
| [X3DH](https://signal.org/docs/specifications/x3dh/) | Revision 1, 2016-11-04 |
|
|
130
|
-
| [PQXDH](https://signal.org/docs/specifications/pqxdh/) | Revision 3, 2023-05-24 (last updated 2024-01-23) |
|
|
131
|
-
| [Double Ratchet](https://signal.org/docs/specifications/doubleratchet/) | Revision 4, 2025-11-04 |
|
|
132
|
-
| [Sesame](https://signal.org/docs/specifications/sesame/) | Revision 2, 2017-04-14 |
|
|
133
|
-
| [ML-KEM Braid](https://signal.org/docs/specifications/mlkembraid/) | Revision 1, 2025-02-21 (last updated 2025-09-26) |
|
|
134
|
-
| [FIPS 203 (ML-KEM)](https://csrc.nist.gov/pubs/fips/203/final) | Final, 2024-08-13 |
|
|
135
|
-
| [RFC 8032 (Ed25519)](https://www.rfc-editor.org/rfc/rfc8032.html) | — |
|
|
105
|
+
## Security and assurance
|
|
136
106
|
|
|
137
|
-
|
|
107
|
+
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.
|
|
138
108
|
|
|
139
|
-
|
|
109
|
+
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.
|
|
140
110
|
|
|
141
|
-
|
|
111
|
+
Report a suspected vulnerability privately through the process in [SECURITY](./SECURITY.md). Do not open a public issue for it.
|
|
142
112
|
|
|
143
|
-
|
|
113
|
+
## Why developers choose this SDK
|
|
144
114
|
|
|
145
|
-
|
|
115
|
+
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 and leaves the relay implementation to the application.
|
|
146
116
|
|
|
147
|
-
|
|
148
|
-
- fixed work on both decapsulation candidates, then a masked choice between them
|
|
149
|
-
- equal-work rejection padding on selected replay and authentication paths
|
|
117
|
+
[Compare maintained alternatives and their limits.](https://open-e2ee.dev/product/#how-it-compares)
|
|
150
118
|
|
|
151
|
-
|
|
119
|
+
## Documentation
|
|
152
120
|
|
|
153
|
-
|
|
121
|
+
- [Getting started](./docs/GETTING_STARTED.md): the integration sequence and mental model.
|
|
122
|
+
- [Package surface](./docs/PACKAGE_SURFACE.md): root exports, subpaths, adapters, and core concepts.
|
|
123
|
+
- [Recipes](./docs/RECIPES.md): messaging, multi-device, attachments, and usernames.
|
|
124
|
+
- [Architecture](./ARCHITECTURE.md) and [adapters](./ADAPTERS.md): layer ownership and composition boundaries.
|
|
125
|
+
- [Integration interfaces](./docs/INTERFACES.md): contracts for custom stores, vaults, relays, and object stores.
|
|
126
|
+
- [Error handling](./docs/ERROR_HANDLING.md) and [troubleshooting](./TROUBLESHOOTING.md).
|
|
127
|
+
- [Deviations](./docs/DEVIATIONS.md): differences from the specifications and libsignal, with reasons and costs.
|
|
128
|
+
- [Hosted API reference](https://docs.open-e2ee.dev/reference/api): exported types and methods.
|
|
154
129
|
|
|
155
|
-
##
|
|
130
|
+
## Help and contributing
|
|
156
131
|
|
|
157
|
-
|
|
158
|
-
[docs.open-e2ee.dev](https://docs.open-e2ee.dev). The in-repo references below
|
|
159
|
-
carry the same version as the code:
|
|
160
|
-
|
|
161
|
-
- [Getting Started](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/GETTING_STARTED.md): installation, mental model, first working client.
|
|
162
|
-
- [Package Surface](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/PACKAGE_SURFACE.md): root exports, every subpath, adapter implementations, core concepts.
|
|
163
|
-
- [Recipes](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/RECIPES.md): message flow, protocol policy, multi-device, attachments, usernames.
|
|
164
|
-
- [Client Composition](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/CLIENT_COMPOSITION.md): production composition with Expo and Convex.
|
|
165
|
-
- [Architecture](https://github.com/open-e2ee/signal-protocol-js/blob/main/ARCHITECTURE.md) and [Adapters](https://github.com/open-e2ee/signal-protocol-js/blob/main/ADAPTERS.md): layer model and composition boundaries.
|
|
166
|
-
- [Integration Interfaces](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/INTERFACES.md): the interfaces to implement for custom storage, vaults, relays, and object stores.
|
|
167
|
-
- [Error Handling](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/ERROR_HANDLING.md) and [Troubleshooting](https://github.com/open-e2ee/signal-protocol-js/blob/main/TROUBLESHOOTING.md).
|
|
168
|
-
- [E2EE concepts](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/E2EE.md): what changes about your architecture when the relay cannot read.
|
|
169
|
-
- [Deviations](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/DEVIATIONS.md): every difference from the Signal Protocol specifications and from `libsignal`, with reasons and costs.
|
|
170
|
-
- [API Reference](https://github.com/open-e2ee/signal-protocol-js/blob/main/docs/api/README.md): generated from the exported declarations.
|
|
132
|
+
Open a [bug report](https://github.com/open-e2ee/signal-protocol-js/issues/new?template=bug_report.yml) or send [API and documentation feedback](https://github.com/open-e2ee/signal-protocol-js/issues/new?template=api_feedback.yml). Read [CONTRIBUTING](./CONTRIBUTING.md) before you propose code. Use the private process in [SECURITY](./SECURITY.md) for suspected vulnerabilities.
|
|
171
133
|
|
|
172
134
|
## License and warranty
|
|
173
135
|
|
|
174
|
-
Licensed under `AGPL-3.0-or-later
|
|
136
|
+
Licensed under AGPLv3 (`AGPL-3.0-or-later`). See [LICENSE](./LICENSE). A [commercial license](./COMMERCIAL.md) covers proprietary products that cannot meet AGPLv3 obligations.
|
|
175
137
|
|
|
176
|
-
The license provides the software **as is**, without warranties or conditions of any kind. To the extent that applicable law permits, copyright holders and contributors are not liable for damages that arise from its use. Your application must evaluate
|
|
138
|
+
The license provides the software **as is**, without warranties or conditions of any kind. To the extent that applicable law permits, copyright holders and contributors are not liable for damages that arise from its use. Your application must evaluate the SDK against its requirements and secure its deployment, storage, authentication, authorization, and operations. This summary does not modify the license.
|
package/SECURITY.md
CHANGED
package/TROUBLESHOOTING.md
CHANGED
|
@@ -49,6 +49,7 @@ Error occurred?
|
|
|
49
49
|
|
|
50
50
|
**"Identity key not found - client not initialized"**
|
|
51
51
|
|
|
52
|
+
<!-- doc-snippet:illustrative elided-call-arguments -->
|
|
52
53
|
```typescript
|
|
53
54
|
// ❌ Wrong: forgot to initialize
|
|
54
55
|
const signal = new SignalProtocolClient(); // Don't use constructor directly!
|
|
@@ -65,6 +66,7 @@ await signal.encryptMessage(...); // Works!
|
|
|
65
66
|
|
|
66
67
|
Make sure the prekey bundle is fresh and valid:
|
|
67
68
|
|
|
69
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
68
70
|
```typescript
|
|
69
71
|
// Fetch the latest prekey bundle from server
|
|
70
72
|
const bundle = await convex.mutation(api.signal.keys.fetchPreKeyBundle, {
|
|
@@ -87,6 +89,7 @@ await signal.establishSession(sessionId, bobId, bundle);
|
|
|
87
89
|
|
|
88
90
|
Session IDs must be in `userId:deviceId` format:
|
|
89
91
|
|
|
92
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
90
93
|
```typescript
|
|
91
94
|
// ❌ Wrong: missing device ID
|
|
92
95
|
await signal.encryptMessage('bob', 'Hello');
|
|
@@ -122,6 +125,7 @@ The protocol handles out-of-order messages automatically via MKSKIPPED. For fail
|
|
|
122
125
|
|
|
123
126
|
### Check Client State
|
|
124
127
|
|
|
128
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
125
129
|
```typescript
|
|
126
130
|
// Get encryption statistics
|
|
127
131
|
const stats = await signal.getStats();
|
|
@@ -132,6 +136,7 @@ console.log('OneTime prekeys remaining:', stats.oneTimePreKeysCount);
|
|
|
132
136
|
|
|
133
137
|
### Check Session Status
|
|
134
138
|
|
|
139
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
135
140
|
```typescript
|
|
136
141
|
// Check if session exists
|
|
137
142
|
const hasSession = await signal.hasSession('bob:1');
|
|
@@ -140,6 +145,7 @@ console.log('Has session with bob:1:', hasSession);
|
|
|
140
145
|
|
|
141
146
|
### Enable Debug Logging
|
|
142
147
|
|
|
148
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
143
149
|
```typescript
|
|
144
150
|
const signal = await SignalProtocolClient.create(userId, {
|
|
145
151
|
enableDebugLogging: true,
|
|
@@ -149,6 +155,7 @@ const signal = await SignalProtocolClient.create(userId, {
|
|
|
149
155
|
|
|
150
156
|
### Verify Identity Keys
|
|
151
157
|
|
|
158
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
152
159
|
```typescript
|
|
153
160
|
// Generate the composite safety number from the locally pinned identity.
|
|
154
161
|
const safetyNumber = await signal.verify(theirUserId);
|
package/blocking/README.md
CHANGED
package/client/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Every client needs `storage`. Local use can omit `relay`, and real messaging
|
|
|
15
15
|
needs it. `protocol.postQuantum` and `protocol.braid` both default to
|
|
16
16
|
`'required'`.
|
|
17
17
|
|
|
18
|
+
<!-- doc-snippet:skip requires-established-session -->
|
|
18
19
|
```ts
|
|
19
20
|
import { createSignalProtocolClient, ProtocolAddress } from '@open-e2ee/signal-protocol-sdk';
|
|
20
21
|
import { inMemoryStore } from '@open-e2ee/signal-protocol-sdk/local/store/memory';
|
|
@@ -32,6 +33,7 @@ await signal.encryptMessage(bob, 'hello');
|
|
|
32
33
|
|
|
33
34
|
### With relay
|
|
34
35
|
|
|
36
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
35
37
|
```ts
|
|
36
38
|
import { createSignalProtocolClient } from '@open-e2ee/signal-protocol-sdk';
|
|
37
39
|
import { convexRelay, type ConvexSignalProtocolRelayApi } from '@open-e2ee/signal-protocol-sdk/remote/relay/convex';
|
|
@@ -65,6 +67,7 @@ database-binding and SQLCipher bootstrap.
|
|
|
65
67
|
|
|
66
68
|
Use product/security terms at the client seam:
|
|
67
69
|
|
|
70
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
68
71
|
```ts
|
|
69
72
|
await createSignalProtocolClient({
|
|
70
73
|
identity: { userId },
|
|
@@ -77,6 +80,7 @@ await createSignalProtocolClient({
|
|
|
77
80
|
`compatible` only for an explicit product decision to support peers that
|
|
78
81
|
publish no post-quantum material:
|
|
79
82
|
|
|
83
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
80
84
|
```ts
|
|
81
85
|
await createSignalProtocolClient({
|
|
82
86
|
identity: { userId },
|
|
@@ -87,6 +91,7 @@ await createSignalProtocolClient({
|
|
|
87
91
|
|
|
88
92
|
Use direct SPQR only as an explicit product-reviewed escape hatch:
|
|
89
93
|
|
|
94
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
90
95
|
```ts
|
|
91
96
|
await createSignalProtocolClient({
|
|
92
97
|
identity: { userId },
|
|
@@ -99,6 +104,7 @@ await createSignalProtocolClient({
|
|
|
99
104
|
|
|
100
105
|
Use typed device addresses instead of string session ids:
|
|
101
106
|
|
|
107
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
102
108
|
```ts
|
|
103
109
|
import { ProtocolAddress } from '@open-e2ee/signal-protocol-sdk';
|
|
104
110
|
|
|
@@ -111,6 +117,7 @@ const asString = ProtocolAddress.toString(bob);
|
|
|
111
117
|
|
|
112
118
|
### Direct session control
|
|
113
119
|
|
|
120
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
114
121
|
```ts
|
|
115
122
|
const bob = ProtocolAddress.create('bob', 1);
|
|
116
123
|
|
|
@@ -122,6 +129,7 @@ const plaintext = await signal.decryptMessage(bob, ciphertext);
|
|
|
122
129
|
|
|
123
130
|
### Multi-device send
|
|
124
131
|
|
|
132
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
125
133
|
```ts
|
|
126
134
|
const result = await signal.send(recipientUserId, 'hello');
|
|
127
135
|
|
|
@@ -136,6 +144,7 @@ await appMessages.insertOutgoing({
|
|
|
136
144
|
|
|
137
145
|
### Server sync
|
|
138
146
|
|
|
147
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
139
148
|
```ts
|
|
140
149
|
// Publish fresh public prekeys and rotate long-lived prekeys on schedule.
|
|
141
150
|
await signal.syncToServer();
|
|
@@ -148,6 +157,7 @@ await signal.rotateKyberPreKey();
|
|
|
148
157
|
Use the dedicated headless entry point from a background task after restoring
|
|
149
158
|
the same application-owned storage and relay boundaries:
|
|
150
159
|
|
|
160
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
151
161
|
```ts
|
|
152
162
|
import { rotateKeysHeadless } from '@open-e2ee/signal-protocol-sdk/client/headless';
|
|
153
163
|
|
package/device/README.md
CHANGED
|
@@ -26,6 +26,7 @@ The top-level device module currently uses Expo and React Native platform APIs.
|
|
|
26
26
|
Install the optional peer dependencies required by the exports you use. The
|
|
27
27
|
framework-neutral lifecycle core is available from:
|
|
28
28
|
|
|
29
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
29
30
|
```ts
|
|
30
31
|
import {
|
|
31
32
|
DeviceLifecycleManager,
|
|
@@ -40,6 +41,7 @@ placing initialization in its own startup lifecycle.
|
|
|
40
41
|
|
|
41
42
|
## Device ID access
|
|
42
43
|
|
|
44
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
43
45
|
```ts
|
|
44
46
|
import {
|
|
45
47
|
getDeviceId,
|
|
@@ -57,6 +59,7 @@ it only after preload or in code that can safely tolerate that fallback.
|
|
|
57
59
|
|
|
58
60
|
The primary device creates a short-lived provisioning session:
|
|
59
61
|
|
|
62
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
60
63
|
```ts
|
|
61
64
|
import {
|
|
62
65
|
generateProvisioningQR,
|
|
@@ -88,6 +91,7 @@ await provisionDevice(
|
|
|
88
91
|
The new device parses the QR data, joins the session, and stores the encrypted
|
|
89
92
|
provisioning result:
|
|
90
93
|
|
|
94
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
91
95
|
```ts
|
|
92
96
|
import {
|
|
93
97
|
connectToProvisioningSession,
|
|
@@ -132,6 +136,7 @@ group/username state only when the host application enables and supplies them.
|
|
|
132
136
|
|
|
133
137
|
## Transfer cryptographic state
|
|
134
138
|
|
|
139
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
135
140
|
```ts
|
|
136
141
|
import {
|
|
137
142
|
prepareNewDeviceTransfer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../client/groups.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EACV,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAc,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC;AACV,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,2BAA2B,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,4BAA4B,CAAA;CAAE,CAAC,CAiBrF;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,2BAA2B,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,OA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AAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,2BAA2B,EAChC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,2BAA2B,EAChC,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,UAAU,EACnB,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,CAAA;CAAE,CAAC,CAOtE"}
|
package/dist/client/groups.js
CHANGED
|
@@ -244,7 +244,7 @@ export async function getGroupSenderKeyStats(ctx, groupId, senderId, senderDevic
|
|
|
244
244
|
* All group functions follow the same pattern: call manager, log success, throw
|
|
245
245
|
* EncryptionError on failure. This helper eliminates that boilerplate.
|
|
246
246
|
*/
|
|
247
|
-
async function
|
|
247
|
+
async function runGroupOp(label, logger, op, logData, wrapError) {
|
|
248
248
|
try {
|
|
249
249
|
const result = await op();
|
|
250
250
|
logger.debug(label, { category: 'E2EE', data: logData });
|
|
@@ -255,9 +255,19 @@ async function wrapGroupOp(label, logger, op, logData, errorCode = EncryptionErr
|
|
|
255
255
|
error.name === 'GroupSecurityReactionPendingError') {
|
|
256
256
|
throw error;
|
|
257
257
|
}
|
|
258
|
-
throw
|
|
258
|
+
throw wrapError(error);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
+
async function wrapGroupOp(label, logger, op, logData) {
|
|
262
|
+
return runGroupOp(label, logger, op, logData, (error) => new EncryptionError(label, EncryptionErrorCode.INVALID_STATE, {
|
|
263
|
+
originalError: error,
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
async function wrapGroupInitializationOp(label, logger, op, logData) {
|
|
267
|
+
return runGroupOp(label, logger, op, logData, (error) => new EncryptionError(label, EncryptionErrorCode.INITIALIZATION_FAILED, {
|
|
268
|
+
originalError: error,
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
261
271
|
/**
|
|
262
272
|
* Create a new group
|
|
263
273
|
*
|
|
@@ -265,7 +275,7 @@ async function wrapGroupOp(label, logger, op, logData, errorCode = EncryptionErr
|
|
|
265
275
|
* to the server. The creator is added as an administrator.
|
|
266
276
|
*/
|
|
267
277
|
export async function createGroup(ctx, manager, creatorAci, creatorProfileKey, members, title, options) {
|
|
268
|
-
return
|
|
278
|
+
return wrapGroupInitializationOp(`Created group "${title}"`, ctx.logger, () => manager.createGroup(creatorAci, creatorProfileKey, members, title, options), { memberCount: members.length + 1, title });
|
|
269
279
|
}
|
|
270
280
|
/**
|
|
271
281
|
* Get the decrypted state for a group
|
|
@@ -352,6 +362,6 @@ export async function createGroupInviteLink(ctx, manager, groupId, editorAci) {
|
|
|
352
362
|
* (if admin approval is required).
|
|
353
363
|
*/
|
|
354
364
|
export async function joinGroupViaInviteLink(ctx, manager, url, userAci, userProfileKey) {
|
|
355
|
-
return
|
|
365
|
+
return wrapGroupInitializationOp(`Joined group via invite link`, ctx.logger, () => manager.joinViaInviteLink(url, userAci, userProfileKey), {});
|
|
356
366
|
}
|
|
357
367
|
//# sourceMappingURL=groups.js.map
|