@open-e2ee/signal-protocol-sdk 13.0.0 → 13.2.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/CHANGELOG.md +63 -0
- package/LICENSE +1 -1
- package/LICENSE-MIT +1 -1
- package/NOTICE +1 -1
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/device/README.md +11 -1
- package/dist/client/config.d.ts +6 -2
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/hosted-device-link-transport.d.ts +11 -0
- package/dist/client/hosted-device-link-transport.d.ts.map +1 -0
- package/dist/client/hosted-device-link-transport.js +25 -0
- package/dist/client/hosted-device-link-transport.js.map +1 -0
- package/dist/client/hosted-mailbox-subscription.d.ts +36 -4
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +238 -69
- package/dist/client/hosted-mailbox-subscription.js.map +1 -1
- package/dist/client/hosted-push.d.ts +11 -0
- package/dist/client/hosted-push.d.ts.map +1 -1
- package/dist/client/hosted-push.js +12 -4
- package/dist/client/hosted-push.js.map +1 -1
- package/dist/client/hosted-transport.d.ts +16 -2
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +144 -6
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted.d.ts +4 -1
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +14 -4
- package/dist/client/hosted.js.map +1 -1
- package/docs/ASSURANCE.md +5 -5
- package/docs/GETTING_STARTED.md +11 -1
- package/docs/RECIPES.md +44 -0
- package/local/store/web-sqlite/README.md +28 -0
- package/package.json +1 -1
package/docs/RECIPES.md
CHANGED
|
@@ -15,6 +15,50 @@ and device-local storage. Use a Sandbox environment for development, where
|
|
|
15
15
|
`hostedRelaySandboxIdentity(storage)` supplies the callback. The
|
|
16
16
|
[getting-started guide](./GETTING_STARTED.md) describes these inputs.
|
|
17
17
|
|
|
18
|
+
## Application-bound identity callback
|
|
19
|
+
|
|
20
|
+
Your backend verifies the current application session and member eligibility.
|
|
21
|
+
It signs the Relay-specific ES256 assertion. The browser callback only requests
|
|
22
|
+
that assertion. Keep provider credentials and signing keys on the backend.
|
|
23
|
+
|
|
24
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
25
|
+
```ts
|
|
26
|
+
import type { GetIdentityAssertion } from "@open-e2ee/signal-protocol-sdk";
|
|
27
|
+
|
|
28
|
+
const getIdentityAssertion: GetIdentityAssertion = async (request) => {
|
|
29
|
+
const response = await fetch("https://application.example/api/relay-identity", {
|
|
30
|
+
method: "POST",
|
|
31
|
+
credentials: "include",
|
|
32
|
+
headers: { "content-type": "application/json" },
|
|
33
|
+
body: JSON.stringify(request),
|
|
34
|
+
cache: "no-store",
|
|
35
|
+
});
|
|
36
|
+
if (!response.ok) throw new Error("Application authentication is required.");
|
|
37
|
+
const result: unknown = await response.json();
|
|
38
|
+
if (!result || typeof result !== "object" || !("assertion" in result) ||
|
|
39
|
+
typeof result.assertion !== "string") {
|
|
40
|
+
throw new Error("Identity assertion missing.");
|
|
41
|
+
}
|
|
42
|
+
return result.assertion;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
void getIdentityAssertion;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Replace the example application origin with your authenticated backend.
|
|
49
|
+
Configure its CSRF controls and cookie policy. Do not send a member ID or
|
|
50
|
+
provider token from this callback as proof of membership.
|
|
51
|
+
|
|
52
|
+
The [Better Auth recipe](https://docs.open-e2ee.dev/relay/better-auth) uses a
|
|
53
|
+
real server session with the cookie cache disabled. The
|
|
54
|
+
[backend contract](https://docs.open-e2ee.dev/relay/backend-identity) lists
|
|
55
|
+
other provider paths and their evidence levels. Those paths issue custom-token
|
|
56
|
+
assertions. They are not native provider adapters in this package.
|
|
57
|
+
|
|
58
|
+
Application logout and assertion refusal do not revoke existing device proofs.
|
|
59
|
+
The customer suspension/resume recipe awaits the supported backend and CLI
|
|
60
|
+
surface. Anonymous capabilities retain their separate limits.
|
|
61
|
+
|
|
18
62
|
## Production composition with Expo on the Signal Protocol Relay
|
|
19
63
|
|
|
20
64
|
<!-- doc-snippet:skip requires-external-context -->
|
|
@@ -68,6 +68,34 @@ key cannot read the old file. Restore the vault entry, or call
|
|
|
68
68
|
`resetWebSqliteStore()`. The reset deletes the file, creates a new key, and
|
|
69
69
|
returns the open, empty store.
|
|
70
70
|
|
|
71
|
+
## Damaged database file
|
|
72
|
+
|
|
73
|
+
The store does not repair a damaged database file. This includes a file that
|
|
74
|
+
SDK 12.0.0 or earlier damaged when a tab closed inside a commit, or when an
|
|
75
|
+
open used the wrong key state. The open reads only some pages of the file. It
|
|
76
|
+
does not check every page. Thus the result depends on the damaged pages:
|
|
77
|
+
|
|
78
|
+
- When the open cannot read the file header with its key and setting, it
|
|
79
|
+
rejects with `SqliteKeyMismatchError` (`KEY_STORAGE_ERROR`). Its message
|
|
80
|
+
starts with `The sqlite3mc-wasm database exists but cannot be read with this
|
|
81
|
+
key and encryption setting`. The store cannot tell a damaged file from a
|
|
82
|
+
wrong key or from the other `encryptionAtRest` setting.
|
|
83
|
+
- When a read of the open fails with `database disk image is malformed`, the
|
|
84
|
+
open rejects with an `Error` whose message holds that SQLite text.
|
|
85
|
+
- When the open reads no damaged page, the open succeeds. A later call can
|
|
86
|
+
then fail on the damaged data.
|
|
87
|
+
|
|
88
|
+
To recover, delete the file and link the device again:
|
|
89
|
+
|
|
90
|
+
1. Close the store of the name in every tab and worker of the origin.
|
|
91
|
+
2. Call `resetWebSqliteStore()` with the same options. The reset deletes the
|
|
92
|
+
file, creates a new key, and returns the open, empty store. The identity
|
|
93
|
+
and the sessions of the device go with the file.
|
|
94
|
+
3. Put the account identity into the new store, then call
|
|
95
|
+
`linkHostedRelayDevice()` with it. This needs another device that holds the
|
|
96
|
+
account identity. See
|
|
97
|
+
[Link a device](../../../device/README.md#link-a-device).
|
|
98
|
+
|
|
71
99
|
## Convert a plaintext store
|
|
72
100
|
|
|
73
101
|
An encrypted open with `convertPlaintext: true` converts a database that was
|
package/package.json
CHANGED