@open-e2ee/signal-protocol-sdk 8.2.0 → 9.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 +15 -31
- package/ARCHITECTURE.md +5 -7
- package/CHANGELOG.md +128 -0
- package/README.md +52 -49
- package/SECURITY.md +2 -2
- package/client/README.md +11 -0
- package/dist/client/client.d.ts +21 -14
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +93 -78
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +10 -17
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/event-hooks.js +27 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/group-receive-authorization.d.ts +5 -0
- package/dist/client/group-receive-authorization.d.ts.map +1 -0
- package/dist/client/group-receive-authorization.js +32 -0
- package/dist/client/group-receive-authorization.js.map +1 -0
- package/dist/client/group-sender-key-operations.d.ts +15 -0
- package/dist/client/group-sender-key-operations.d.ts.map +1 -0
- package/dist/client/group-sender-key-operations.js +31 -0
- package/dist/client/group-sender-key-operations.js.map +1 -0
- package/dist/client/groups.d.ts +3 -1
- package/dist/client/groups.d.ts.map +1 -1
- package/dist/client/groups.js +5 -2
- package/dist/client/groups.js.map +1 -1
- package/dist/client/hosted-sandbox-identity.d.ts +32 -0
- package/dist/client/hosted-sandbox-identity.d.ts.map +1 -0
- package/dist/client/hosted-sandbox-identity.js +157 -0
- package/dist/client/hosted-sandbox-identity.js.map +1 -0
- package/dist/client/hosted.d.ts +12 -2
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +12 -2
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/relay-subscription.d.ts +2 -0
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +3 -1
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/sender-key-distribution.d.ts.map +1 -1
- package/dist/client/sender-key-distribution.js +4 -1
- package/dist/client/sender-key-distribution.js.map +1 -1
- package/dist/client/signal-service-cipher.d.ts +4 -2
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +61 -51
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/types.d.ts +0 -3
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/index.d.ts +28 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -18
- package/dist/index.js.map +1 -1
- package/dist/internal/crypto/pq/kyber.d.ts +1 -1
- package/dist/internal/crypto/pq/kyber.js +1 -1
- package/dist/internal/encoding/proto/sender-key-message.d.ts +2 -2
- package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -1
- package/dist/internal/encoding/proto/sender-key-message.js +5 -2
- package/dist/internal/encoding/proto/sender-key-message.js.map +1 -1
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +5 -2
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/groups/wire.d.ts +0 -2
- package/dist/internal/groups/wire.d.ts.map +1 -1
- package/dist/internal/groups/wire.js +0 -6
- package/dist/internal/groups/wire.js.map +1 -1
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +0 -1
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts +0 -17
- package/dist/internal/protocol/double-ratchet/ratchet.d.ts.map +1 -1
- package/dist/internal/protocol/double-ratchet/ratchet.js +0 -4
- package/dist/internal/protocol/double-ratchet/ratchet.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.d.ts +2 -32
- package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.js +4 -85
- package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/index.d.ts +2 -2
- package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/index.js +2 -6
- package/dist/internal/protocol/sealed-sender/index.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +0 -19
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +1 -48
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts +9 -13
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +90 -95
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts +0 -2
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js +4 -12
- package/dist/internal/protocol/spqr/ml-kem-braid/incremental-kem.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts +1 -0
- package/dist/internal/protocol/spqr/ml-kem-braid/types.d.ts.map +1 -1
- package/dist/internal/protocol/spqr/spqr.d.ts +1 -1
- package/dist/internal/protocol/spqr/spqr.js +1 -1
- package/dist/internal/protocol/x3dh/x3dh.d.ts.map +1 -1
- package/dist/internal/protocol/x3dh/x3dh.js +1 -1
- package/dist/internal/protocol/x3dh/x3dh.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.d.ts +3 -54
- package/dist/internal/protocol/zk/credentials/credentials.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/credentials.js +4 -91
- package/dist/internal/protocol/zk/credentials/credentials.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts +3 -64
- package/dist/internal/protocol/zk/credentials/endorsements.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/endorsements.js +4 -134
- package/dist/internal/protocol/zk/credentials/endorsements.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/index.d.ts +3 -3
- package/dist/internal/protocol/zk/credentials/index.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/index.js +3 -3
- package/dist/internal/protocol/zk/credentials/index.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/issuance.d.ts +3 -26
- package/dist/internal/protocol/zk/credentials/issuance.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/issuance.js +3 -80
- package/dist/internal/protocol/zk/credentials/issuance.js.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.d.ts +4 -73
- package/dist/internal/protocol/zk/credentials/presentation.d.ts.map +1 -1
- package/dist/internal/protocol/zk/credentials/presentation.js +4 -152
- package/dist/internal/protocol/zk/credentials/presentation.js.map +1 -1
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts +1 -61
- package/dist/internal/protocol/zk/groups/auth-credential.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/auth-credential.js +2 -196
- package/dist/internal/protocol/zk/groups/auth-credential.js.map +1 -1
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts +1 -86
- package/dist/internal/protocol/zk/groups/group-send-endorsement.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js +1 -152
- package/dist/internal/protocol/zk/groups/group-send-endorsement.js.map +1 -1
- package/dist/internal/protocol/zk/groups/index.d.ts +4 -4
- package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/index.js +4 -4
- package/dist/internal/protocol/zk/groups/index.js.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +2 -57
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-credential.js +2 -174
- package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -1
- package/dist/internal/protocol/zk/groups/server-params.d.ts +8 -72
- package/dist/internal/protocol/zk/groups/server-params.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/server-params.js +8 -108
- package/dist/internal/protocol/zk/groups/server-params.js.map +1 -1
- package/dist/internal/protocol/zk/proofs/sign.d.ts +1 -2
- package/dist/internal/protocol/zk/proofs/sign.d.ts.map +1 -1
- package/dist/internal/protocol/zk/proofs/sign.js +2 -11
- package/dist/internal/protocol/zk/proofs/sign.js.map +1 -1
- package/dist/internal/session/ratchet.d.ts.map +1 -1
- package/dist/internal/session/ratchet.js +0 -2
- package/dist/internal/session/ratchet.js.map +1 -1
- package/dist/local/store/key-value/adapter.d.ts +3 -3
- package/dist/local/store/key-value/adapter.d.ts.map +1 -1
- package/dist/local/store/key-value/adapter.js +30 -15
- package/dist/local/store/key-value/adapter.js.map +1 -1
- package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -1
- package/dist/local/store/key-value/backend-conformance.js +25 -0
- package/dist/local/store/key-value/backend-conformance.js.map +1 -1
- package/dist/local/store/key-value/batch.d.ts +3 -1
- package/dist/local/store/key-value/batch.d.ts.map +1 -1
- package/dist/local/store/key-value/batch.js +9 -1
- package/dist/local/store/key-value/batch.js.map +1 -1
- package/dist/local/store/key-value/storage.d.ts +6 -0
- package/dist/local/store/key-value/storage.d.ts.map +1 -1
- package/dist/local/store/key-value/transactional-backend.d.ts +1 -1
- package/dist/local/store/key-value/transactional-backend.js +1 -1
- package/dist/local/store/memory/adapter.d.ts +3 -3
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +43 -18
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/sqlite/errors.d.ts +6 -0
- package/dist/local/store/sqlite/errors.d.ts.map +1 -1
- package/dist/local/store/sqlite/errors.js +6 -6
- package/dist/local/store/sqlite/errors.js.map +1 -1
- package/dist/local/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/local/store/sqlite/migrations.js +18 -0
- package/dist/local/store/sqlite/migrations.js.map +1 -1
- package/dist/local/store/sqlite/models/skipped-sender-key.d.ts +3 -3
- package/dist/local/store/sqlite/models/skipped-sender-key.d.ts.map +1 -1
- package/dist/local/store/sqlite/models/skipped-sender-key.js +13 -17
- package/dist/local/store/sqlite/models/skipped-sender-key.js.map +1 -1
- package/dist/local/store/sqlite/store.d.ts +3 -3
- package/dist/local/store/sqlite/store.d.ts.map +1 -1
- package/dist/local/store/sqlite/store.js +17 -9
- package/dist/local/store/sqlite/store.js.map +1 -1
- package/dist/local/store/web/adapter.d.ts +3 -3
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +59 -20
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/profile/contact-state.d.ts +0 -3
- package/dist/profile/contact-state.d.ts.map +1 -1
- package/dist/profile/contact-state.js +1 -32
- package/dist/profile/contact-state.js.map +1 -1
- package/dist/profile/index.d.ts +2 -1
- package/dist/profile/index.d.ts.map +1 -1
- package/dist/profile/index.js +2 -1
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/unidentified-access.d.ts +12 -0
- package/dist/profile/unidentified-access.d.ts.map +1 -0
- package/dist/profile/unidentified-access.js +42 -0
- package/dist/profile/unidentified-access.js.map +1 -0
- package/dist/remote/relay/index.d.ts +4 -7
- package/dist/remote/relay/index.d.ts.map +1 -1
- package/dist/remote/relay/index.js +5 -7
- package/dist/remote/relay/index.js.map +1 -1
- package/dist/remote/relay/types.d.ts +3 -3
- package/dist/types/api.d.ts +29 -8
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +6 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +6 -6
- package/dist/types/errors.js.map +1 -1
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +3 -3
- package/dist/zk/credentials.d.ts +2 -2
- package/dist/zk/credentials.js +2 -2
- package/dist/zk/groups.d.ts +3 -3
- package/dist/zk/groups.d.ts.map +1 -1
- package/dist/zk/groups.js +3 -3
- package/dist/zk/groups.js.map +1 -1
- package/docs/ASSURANCE.md +12 -14
- package/docs/CLIENT_COMPOSITION.md +11 -3
- package/docs/DEVIATIONS.md +24 -25
- package/docs/GETTING_STARTED.md +61 -323
- package/docs/INTERFACES.md +7 -7
- package/docs/PACKAGE_SURFACE.md +14 -16
- package/docs/RECIPES.md +7 -112
- package/groups/README.md +9 -1
- package/local/store/README.md +26 -6
- package/package.json +2 -31
- package/remote/README.md +14 -78
- package/remote/object-store/convex-r2/README.md +17 -49
- package/remote/relay/README.md +24 -18
- package/zk/README.md +6 -7
- package/dist/client/dual-store.d.ts +0 -70
- package/dist/client/dual-store.d.ts.map +0 -1
- package/dist/client/dual-store.js +0 -123
- package/dist/client/dual-store.js.map +0 -1
- package/dist/client/multi-device.d.ts +0 -74
- package/dist/client/multi-device.d.ts.map +0 -1
- package/dist/client/multi-device.js +0 -105
- package/dist/client/multi-device.js.map +0 -1
- package/dist/groups/server.d.ts +0 -10
- package/dist/groups/server.d.ts.map +0 -1
- package/dist/groups/server.js +0 -6
- package/dist/groups/server.js.map +0 -1
- package/dist/internal/encoding/index.d.ts +0 -2
- package/dist/internal/encoding/index.d.ts.map +0 -1
- package/dist/internal/encoding/index.js +0 -2
- package/dist/internal/encoding/index.js.map +0 -1
- package/dist/internal/groups/server-engine.d.ts +0 -118
- package/dist/internal/groups/server-engine.d.ts.map +0 -1
- package/dist/internal/groups/server-engine.js +0 -1268
- package/dist/internal/groups/server-engine.js.map +0 -1
- package/dist/internal/protocol/index.d.ts +0 -24
- package/dist/internal/protocol/index.d.ts.map +0 -1
- package/dist/internal/protocol/index.js +0 -9
- package/dist/internal/protocol/index.js.map +0 -1
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts +0 -56
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +0 -1
- package/dist/internal/protocol/sealed-sender/trust-root.js +0 -90
- package/dist/internal/protocol/sealed-sender/trust-root.js.map +0 -1
- package/dist/internal/protocol/triple-ratchet/index.d.ts +0 -21
- package/dist/internal/protocol/triple-ratchet/index.d.ts.map +0 -1
- package/dist/internal/protocol/triple-ratchet/index.js +0 -19
- package/dist/internal/protocol/triple-ratchet/index.js.map +0 -1
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts +0 -233
- package/dist/internal/protocol/triple-ratchet/ratchet.d.ts.map +0 -1
- package/dist/internal/protocol/triple-ratchet/ratchet.js +0 -254
- package/dist/internal/protocol/triple-ratchet/ratchet.js.map +0 -1
- package/dist/internal/protocol/zk/proofs/index.d.ts +0 -13
- package/dist/internal/protocol/zk/proofs/index.d.ts.map +0 -1
- package/dist/internal/protocol/zk/proofs/index.js +0 -7
- package/dist/internal/protocol/zk/proofs/index.js.map +0 -1
- package/dist/local/store/sqlite/index.d.ts +0 -20
- package/dist/local/store/sqlite/index.d.ts.map +0 -1
- package/dist/local/store/sqlite/index.js +0 -18
- package/dist/local/store/sqlite/index.js.map +0 -1
- package/dist/remote/object-store/convex-r2/server/index.d.ts +0 -2
- package/dist/remote/object-store/convex-r2/server/index.d.ts.map +0 -1
- package/dist/remote/object-store/convex-r2/server/index.js +0 -2
- package/dist/remote/object-store/convex-r2/server/index.js.map +0 -1
- package/dist/remote/object-store/convex-r2/server.d.ts +0 -129
- package/dist/remote/object-store/convex-r2/server.d.ts.map +0 -1
- package/dist/remote/object-store/convex-r2/server.js +0 -244
- package/dist/remote/object-store/convex-r2/server.js.map +0 -1
- package/dist/remote/relay/memory/adapter.d.ts +0 -252
- package/dist/remote/relay/memory/adapter.d.ts.map +0 -1
- package/dist/remote/relay/memory/adapter.js +0 -1057
- package/dist/remote/relay/memory/adapter.js.map +0 -1
- package/dist/remote/relay/memory/failures.d.ts +0 -58
- package/dist/remote/relay/memory/failures.d.ts.map +0 -1
- package/dist/remote/relay/memory/failures.js +0 -124
- package/dist/remote/relay/memory/failures.js.map +0 -1
- package/dist/remote/relay/memory/group-server.d.ts +0 -13
- package/dist/remote/relay/memory/group-server.d.ts.map +0 -1
- package/dist/remote/relay/memory/group-server.js +0 -19
- package/dist/remote/relay/memory/group-server.js.map +0 -1
- package/dist/remote/relay/memory/index.d.ts +0 -11
- package/dist/remote/relay/memory/index.d.ts.map +0 -1
- package/dist/remote/relay/memory/index.js +0 -7
- package/dist/remote/relay/memory/index.js.map +0 -1
- package/examples/browser/README.md +0 -35
- package/examples/browser/index.html +0 -27
- package/examples/browser/src/exchange.ts +0 -69
- package/examples/browser/src/main.ts +0 -63
- package/examples/browser/src/style.css +0 -9
- package/examples/browser/src/worker.ts +0 -10
- package/examples/browser/vite.config.ts +0 -9
- package/remote/relay/memory/README.md +0 -72
- package/scripts/oe-groups.mjs +0 -166
package/docs/RECIPES.md
CHANGED
|
@@ -8,90 +8,12 @@
|
|
|
8
8
|
Working shapes for the tasks applications do most often. Each example
|
|
9
9
|
uses public exports only.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Hosted Client Setup
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
19
|
-
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
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
|
-
|
|
23
|
-
const relay = inMemoryRelay();
|
|
24
|
-
|
|
25
|
-
// The relay knows which devices exist, but it does not get plaintext.
|
|
26
|
-
await relay.registerDevice("alice", {
|
|
27
|
-
encryptedDeviceName: new ArrayBuffer(0),
|
|
28
|
-
});
|
|
29
|
-
await relay.registerDevice("bob", { encryptedDeviceName: new ArrayBuffer(0) });
|
|
30
|
-
|
|
31
|
-
// Each client represents one device. Its storage is local to that device.
|
|
32
|
-
const alice = await createSignalProtocolClient({
|
|
33
|
-
identity: { userId: "alice" },
|
|
34
|
-
adapters: { storage: inMemoryStore(), relay },
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const bob = await createSignalProtocolClient({
|
|
38
|
-
identity: { userId: "bob" },
|
|
39
|
-
adapters: { storage: inMemoryStore(), relay },
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
await alice.syncToServer();
|
|
43
|
-
await bob.syncToServer();
|
|
44
|
-
|
|
45
|
-
// Send while Bob is offline so we can inspect what the relay stores.
|
|
46
|
-
const sent = await alice.send("bob", "hello");
|
|
47
|
-
console.log("alice sent:", sent.messageId);
|
|
48
|
-
|
|
49
|
-
// The relay-visible envelope contains metadata plus ciphertext, not plaintext.
|
|
50
|
-
const [queuedEnvelope] = relay.getPendingMessages("bob", 1);
|
|
51
|
-
const ciphertextLength =
|
|
52
|
-
typeof queuedEnvelope.ciphertext === "string"
|
|
53
|
-
? queuedEnvelope.ciphertext.length
|
|
54
|
-
: queuedEnvelope.ciphertext.byteLength;
|
|
55
|
-
const ciphertextPreview =
|
|
56
|
-
typeof queuedEnvelope.ciphertext === "string"
|
|
57
|
-
? `${queuedEnvelope.ciphertext.slice(0, 32)}...`
|
|
58
|
-
: `${queuedEnvelope.ciphertext.byteLength} encrypted bytes`;
|
|
59
|
-
|
|
60
|
-
console.log("relay sees encrypted envelope:", {
|
|
61
|
-
messageType: queuedEnvelope.messageType,
|
|
62
|
-
ciphertextLength,
|
|
63
|
-
ciphertextPreview,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const decrypted = new Promise<void>((resolve) => {
|
|
67
|
-
// Plaintext enters your app only after Bob's Signal Protocol client decrypts it.
|
|
68
|
-
bob.registerHook("onMessageDecrypted", async (message) => {
|
|
69
|
-
console.log("bob decrypted:", `${message.senderId}: ${message.content}`);
|
|
70
|
-
resolve();
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Starting the subscription delivers Bob's queued encrypted envelope.
|
|
75
|
-
bob.startRelaySubscription();
|
|
76
|
-
await decrypted;
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Example output:
|
|
80
|
-
|
|
81
|
-
```text
|
|
82
|
-
alice sent: msg-1
|
|
83
|
-
relay sees encrypted envelope: {
|
|
84
|
-
messageType: 'prekey_bundle',
|
|
85
|
-
ciphertextLength: 3464,
|
|
86
|
-
ciphertextPreview: '<base64 ciphertext preview>...'
|
|
87
|
-
}
|
|
88
|
-
bob decrypted: alice: hello
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
The first message usually uses a `prekey_bundle` envelope because it establishes
|
|
92
|
-
the session. Later messages on the same session use `ciphertext`. In both cases
|
|
93
|
-
the relay sees encrypted envelope bytes. Bob receives decrypted content only
|
|
94
|
-
through the `onMessageDecrypted` hook.
|
|
13
|
+
The recipes require a configured Relay project, an identity-assertion callback,
|
|
14
|
+
and device-local storage. Use a Sandbox environment for development, where
|
|
15
|
+
`hostedRelaySandboxIdentity(storage)` supplies the callback. The
|
|
16
|
+
[getting-started guide](./GETTING_STARTED.md) describes these inputs.
|
|
95
17
|
|
|
96
18
|
## Production composition with Expo on the Signal Protocol Relay
|
|
97
19
|
|
|
@@ -114,35 +36,8 @@ const signal = await createHostedSignalProtocolClient({
|
|
|
114
36
|
});
|
|
115
37
|
```
|
|
116
38
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
that belongs in the device lifecycle and authentication bootstrap. Expo apps
|
|
120
|
-
must also complete the [database bootstrap](../local/store/expo/README.md)
|
|
121
|
-
before creating the client.
|
|
122
|
-
|
|
123
|
-
## Local development
|
|
124
|
-
|
|
125
|
-
<!-- doc-snippet:run recipes-local-development expect="" -->
|
|
126
|
-
```ts
|
|
127
|
-
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
128
|
-
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
129
|
-
import { inMemoryRelay } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
130
|
-
import { inMemoryStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
131
|
-
|
|
132
|
-
const relay = inMemoryRelay();
|
|
133
|
-
|
|
134
|
-
const alice = await createSignalProtocolClient({
|
|
135
|
-
// `identity` is the app account/device being represented.
|
|
136
|
-
identity: { userId: "alice" },
|
|
137
|
-
// `adapters` are the concrete storage/relay implementation for this run.
|
|
138
|
-
adapters: { storage: inMemoryStore(), relay },
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const bob = await createSignalProtocolClient({
|
|
142
|
-
identity: { userId: "bob" },
|
|
143
|
-
adapters: { storage: inMemoryStore(), relay },
|
|
144
|
-
});
|
|
145
|
-
```
|
|
39
|
+
The hosted factory authenticates and registers the current device. Expo apps
|
|
40
|
+
must complete the [database setup](../local/store/expo/README.md) first.
|
|
146
41
|
|
|
147
42
|
## App message flow
|
|
148
43
|
|
package/groups/README.md
CHANGED
|
@@ -11,7 +11,15 @@ backend stores opaque encrypted group state and sequences changes, while each
|
|
|
11
11
|
member device owns group secrets, decrypted state, authorization credentials,
|
|
12
12
|
and sender-key rotation.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Client usage
|
|
15
|
+
|
|
16
|
+
The OpenE2EE Signal Protocol Relay supplies group authorization and encrypted
|
|
17
|
+
state storage. The SDK contains the group client, local cryptography, and public
|
|
18
|
+
transport types. Server authorization engines and credential issuers are outside
|
|
19
|
+
the published package.
|
|
20
|
+
|
|
21
|
+
The following advanced example composes an application-owned group transport.
|
|
22
|
+
Its credential callbacks request credentials from the authenticated service.
|
|
15
23
|
|
|
16
24
|
<!-- doc-snippet:skip requires-external-context -->
|
|
17
25
|
```ts
|
package/local/store/README.md
CHANGED
|
@@ -287,20 +287,40 @@ security transition. The shared adapter contract verifies
|
|
|
287
287
|
failure rollback, compare-and-swap behavior, one-time-prekey replay rejection,
|
|
288
288
|
and exact per-user session deletion.
|
|
289
289
|
|
|
290
|
-
For the key-value store, the supplied backend's `atomicWrite` is a security boundary
|
|
291
|
-
|
|
292
|
-
`
|
|
293
|
-
operation must enumerate exact plaintext session
|
|
294
|
-
transaction. An adapter that matches a prefix or enumerates before the
|
|
290
|
+
For the key-value store, the supplied backend's `atomicWrite` is a security boundary.
|
|
291
|
+
It must commit `check`, `set`, `remove`, `removeSessionsForUser`, and
|
|
292
|
+
`pruneSkippedSenderKeys` operations in one crash-durable transaction.
|
|
293
|
+
The `removeSessionsForUser` operation must enumerate exact plaintext session
|
|
294
|
+
metadata inside that transaction. An adapter that matches a prefix or enumerates before the
|
|
295
295
|
transaction can leave a concurrently-created session trusted under a rotated
|
|
296
296
|
identity.
|
|
297
297
|
|
|
298
|
+
The `pruneSkippedSenderKeys` operation enumerates keys under its exact `keyPrefix`
|
|
299
|
+
inside the transaction. It removes the lowest numeric chain indexes until
|
|
300
|
+
`maxCount` keys remain. The chain index is the last colon-separated key component.
|
|
301
|
+
The operation observes earlier writes in the same batch. Equal indexes belong
|
|
302
|
+
to distinct generations and remain separate entries.
|
|
303
|
+
|
|
304
|
+
For eviction ties, the store may remove either generation.
|
|
305
|
+
Use `createTransactionalKeyValueBackend` to apply
|
|
306
|
+
these operations through the shared interpreter, and verify custom backends
|
|
307
|
+
with `assertBackendConformance`.
|
|
308
|
+
|
|
298
309
|
## Design Notes
|
|
299
310
|
|
|
300
311
|
Received content uses the same encryption and transaction boundary as protocol state.
|
|
301
312
|
|
|
302
313
|
The `commitSessionTrust` method commits received content, ratchet state, contact trust, and consumed prekeys together.
|
|
303
|
-
The `storeSenderKeyRecord` method commits
|
|
314
|
+
The `storeSenderKeyRecord` method commits the full sender-key record and every
|
|
315
|
+
`SenderKeyReceiveCommit` effect together. These effects include skipped-key
|
|
316
|
+
additions, capacity eviction, skipped-key consumption, and optional received
|
|
317
|
+
content. The manager stages additions until authentication and decryption
|
|
318
|
+
succeed.
|
|
319
|
+
|
|
320
|
+
The store applies additions in order, with capacity eviction before
|
|
321
|
+
each addition. A rejected commit preserves the prior record, skipped keys,
|
|
322
|
+
and received content. This applies to current and archived generations and
|
|
323
|
+
to receives without a durable ID. A retry uses that preserved state.
|
|
304
324
|
|
|
305
325
|
An adapter must reject the complete transaction if any write fails.
|
|
306
326
|
When the database file of a SQLite store cannot grow because the disk or the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-e2ee/signal-protocol-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Pure TypeScript Signal Protocol SDK for encrypted chat in Expo, React Native, browsers, and Node. Post-quantum by default.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"open-e2ee",
|
|
@@ -51,9 +51,6 @@
|
|
|
51
51
|
"main": "./dist/index.js",
|
|
52
52
|
"module": "./dist/index.js",
|
|
53
53
|
"types": "./dist/index.d.ts",
|
|
54
|
-
"bin": {
|
|
55
|
-
"oe-groups": "./scripts/oe-groups.mjs"
|
|
56
|
-
},
|
|
57
54
|
"exports": {
|
|
58
55
|
".": {
|
|
59
56
|
"types": "./dist/index.d.ts",
|
|
@@ -63,10 +60,6 @@
|
|
|
63
60
|
"types": "./dist/remote/relay/index.d.ts",
|
|
64
61
|
"default": "./dist/remote/relay/index.js"
|
|
65
62
|
},
|
|
66
|
-
"./remote/relay/memory": {
|
|
67
|
-
"types": "./dist/remote/relay/memory/index.d.ts",
|
|
68
|
-
"default": "./dist/remote/relay/memory/index.js"
|
|
69
|
-
},
|
|
70
63
|
"./remote/relay/types": {
|
|
71
64
|
"types": "./dist/remote/relay/types.d.ts",
|
|
72
65
|
"default": "./dist/remote/relay/types.js"
|
|
@@ -143,10 +136,6 @@
|
|
|
143
136
|
"types": "./dist/groups/index.d.ts",
|
|
144
137
|
"default": "./dist/groups/index.js"
|
|
145
138
|
},
|
|
146
|
-
"./groups/server": {
|
|
147
|
-
"types": "./dist/groups/server.d.ts",
|
|
148
|
-
"default": "./dist/groups/server.js"
|
|
149
|
-
},
|
|
150
139
|
"./hooks": {
|
|
151
140
|
"types": "./dist/hooks/index.d.ts",
|
|
152
141
|
"default": "./dist/hooks/index.js"
|
|
@@ -251,10 +240,6 @@
|
|
|
251
240
|
"types": "./dist/remote/object-store/convex-r2/index.d.ts",
|
|
252
241
|
"default": "./dist/remote/object-store/convex-r2/index.js"
|
|
253
242
|
},
|
|
254
|
-
"./remote/object-store/convex-r2/server": {
|
|
255
|
-
"types": "./dist/remote/object-store/convex-r2/server/index.d.ts",
|
|
256
|
-
"default": "./dist/remote/object-store/convex-r2/server/index.js"
|
|
257
|
-
},
|
|
258
243
|
"./remote/object-store/s3": {
|
|
259
244
|
"types": "./dist/remote/object-store/s3/index.d.ts",
|
|
260
245
|
"default": "./dist/remote/object-store/s3/index.js"
|
|
@@ -326,13 +311,6 @@
|
|
|
326
311
|
"docs/RECIPES.md",
|
|
327
312
|
"docs/SECURITY.md",
|
|
328
313
|
"encoding/README.md",
|
|
329
|
-
"examples/browser/README.md",
|
|
330
|
-
"examples/browser/index.html",
|
|
331
|
-
"examples/browser/src/exchange.ts",
|
|
332
|
-
"examples/browser/src/main.ts",
|
|
333
|
-
"examples/browser/src/style.css",
|
|
334
|
-
"examples/browser/src/worker.ts",
|
|
335
|
-
"examples/browser/vite.config.ts",
|
|
336
314
|
"files/README.md",
|
|
337
315
|
"groups/README.md",
|
|
338
316
|
"hooks/README.md",
|
|
@@ -353,9 +331,7 @@
|
|
|
353
331
|
"remote/object-store/convex-r2/README.md",
|
|
354
332
|
"remote/object-store/s3/README.md",
|
|
355
333
|
"remote/relay/README.md",
|
|
356
|
-
"remote/relay/memory/README.md",
|
|
357
334
|
"safety/README.md",
|
|
358
|
-
"scripts/oe-groups.mjs",
|
|
359
335
|
"sealed-sender/README.md",
|
|
360
336
|
"types/README.md",
|
|
361
337
|
"username/README.md",
|
|
@@ -380,7 +356,6 @@
|
|
|
380
356
|
"prepublishOnly": "npm run build"
|
|
381
357
|
},
|
|
382
358
|
"peerDependencies": {
|
|
383
|
-
"@convex-dev/r2": ">=0.10.2",
|
|
384
359
|
"@op-engineering/op-sqlite": ">=18.2.5",
|
|
385
360
|
"better-sqlite3-multiple-ciphers": ">=13.0.3",
|
|
386
361
|
"convex": ">=1.42.1",
|
|
@@ -396,9 +371,6 @@
|
|
|
396
371
|
"react-native-keychain": ">=10.0.0"
|
|
397
372
|
},
|
|
398
373
|
"peerDependenciesMeta": {
|
|
399
|
-
"@convex-dev/r2": {
|
|
400
|
-
"optional": true
|
|
401
|
-
},
|
|
402
374
|
"@op-engineering/op-sqlite": {
|
|
403
375
|
"optional": true
|
|
404
376
|
},
|
|
@@ -451,11 +423,10 @@
|
|
|
451
423
|
"xcode": {
|
|
452
424
|
"uuid": "11.1.1"
|
|
453
425
|
},
|
|
454
|
-
"brace-expansion": "^5.0.
|
|
426
|
+
"brace-expansion": "^5.0.12",
|
|
455
427
|
"image-size": "file:./vendor/image-size-disabled"
|
|
456
428
|
},
|
|
457
429
|
"devDependencies": {
|
|
458
|
-
"@convex-dev/r2": "^0.10.2",
|
|
459
430
|
"@op-engineering/op-sqlite": "^18.2.5",
|
|
460
431
|
"@swc/core": "^1.15.43",
|
|
461
432
|
"@types/async-lock": "^1.4.0",
|
package/remote/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
> Infrastructure | Implements `SignalProtocolRelayServer` and `SignalProtocolRemoteObjectStore` | [Architecture](../ARCHITECTURE.md)
|
|
4
4
|
|
|
5
|
-
The
|
|
6
|
-
prekeys, device registration, encrypted
|
|
7
|
-
|
|
5
|
+
The remote modules contain client adapters and transport contracts for public
|
|
6
|
+
prekeys, device registration, encrypted envelopes, and encrypted objects.
|
|
7
|
+
The published package excludes relay and object-store server implementations.
|
|
8
8
|
|
|
9
9
|
## Why it exists
|
|
10
10
|
|
|
@@ -18,8 +18,7 @@ replaceable and prevent them from owning private keys or plaintext.
|
|
|
18
18
|
### Relay
|
|
19
19
|
|
|
20
20
|
- the OpenE2EE Signal Protocol Relay through `createHostedSignalProtocolClient()` from the package root
|
|
21
|
-
-
|
|
22
|
-
- custom implementations via `SignalProtocolRelayServer`
|
|
21
|
+
- custom client transports via `SignalProtocolRelayServer`
|
|
23
22
|
|
|
24
23
|
### Remote object store
|
|
25
24
|
|
|
@@ -116,57 +115,10 @@ The adapter accepts the generated module directly. The functions
|
|
|
116
115
|
time-sensitive credentials or await provider metadata. The functions
|
|
117
116
|
`createUpload` and `deleteObject` are mutations.
|
|
118
117
|
|
|
119
|
-
The
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
// convex/signalObjectStore.ts
|
|
125
|
-
import { R2 } from "@convex-dev/r2";
|
|
126
|
-
import {
|
|
127
|
-
defineConvexR2ObjectStore,
|
|
128
|
-
type ConvexR2ObjectCallbacks,
|
|
129
|
-
} from "@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2/server";
|
|
130
|
-
import { components, internal } from "./_generated/api";
|
|
131
|
-
|
|
132
|
-
const objects =
|
|
133
|
-
internal.signalObjectStoreModel satisfies ConvexR2ObjectCallbacks;
|
|
134
|
-
|
|
135
|
-
export const {
|
|
136
|
-
createUpload,
|
|
137
|
-
createDownload,
|
|
138
|
-
completeUpload,
|
|
139
|
-
deleteObject,
|
|
140
|
-
} = defineConvexR2ObjectStore({
|
|
141
|
-
r2: new R2(components.r2),
|
|
142
|
-
limits: {
|
|
143
|
-
maxContentLength: 50 * 1024 * 1024,
|
|
144
|
-
allowedContentTypes: ["application/octet-stream"],
|
|
145
|
-
downloadExpiresInSeconds: 15 * 60,
|
|
146
|
-
},
|
|
147
|
-
objects,
|
|
148
|
-
});
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
The application defines the referenced internal functions in
|
|
152
|
-
`convex/signalObjectStoreModel.ts`:
|
|
153
|
-
|
|
154
|
-
- `reserve` authenticates the caller and idempotently persists
|
|
155
|
-
`requestId -> objectId -> providerKey`.
|
|
156
|
-
- `resolve` authorizes `download` or `complete` and returns the provider key
|
|
157
|
-
plus the reserved content type and length.
|
|
158
|
-
- `complete` re-authorizes the caller and idempotently marks an upload complete
|
|
159
|
-
after the helper verifies synchronized R2 metadata. The action needs this
|
|
160
|
-
second authorization because its query and mutation are separate
|
|
161
|
-
transactions.
|
|
162
|
-
- `remove` authorizes deletion and records the logical removal. It returns the
|
|
163
|
-
stable provider key, so the caller can schedule component deletion
|
|
164
|
-
transactionally.
|
|
165
|
-
|
|
166
|
-
The helper supplies public validators and extracts expiry from the actual
|
|
167
|
-
Signature Version 4 URLs. It verifies uploaded size and content type, and it
|
|
168
|
-
calls the R2 component with the correct Convex contexts. It has no runtime
|
|
169
|
-
import of `@convex-dev/r2`. S3-only consumers do not load the component.
|
|
118
|
+
The application supplies these broker functions. Each function authenticates
|
|
119
|
+
and authorizes its caller. The broker owns idempotent reservations, object
|
|
120
|
+
metadata, provider keys, and completion checks. See the
|
|
121
|
+
[Convex R2 client contract](./object-store/convex-r2/README.md).
|
|
170
122
|
|
|
171
123
|
### Amazon S3 and S3-compatible storage
|
|
172
124
|
|
|
@@ -193,29 +145,13 @@ const remoteObjectStore = s3ObjectStore({
|
|
|
193
145
|
Every remote object store should receive only ciphertext plus the metadata
|
|
194
146
|
needed to authorize and construct short-lived operations.
|
|
195
147
|
|
|
196
|
-
##
|
|
197
|
-
|
|
198
|
-
Use `InMemorySignalProtocolRelayServer` when multiple clients need a shared in-memory relay:
|
|
199
|
-
|
|
200
|
-
<!-- doc-snippet:run remote-shared-memory-relay expect="" -->
|
|
201
|
-
```ts
|
|
202
|
-
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
203
|
-
import { DefaultSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
204
|
-
import { InMemorySignalProtocolRelayServer } from "@open-e2ee/signal-protocol-sdk/remote/relay/memory";
|
|
205
|
-
import { InMemorySignalProtocolStore } from "@open-e2ee/signal-protocol-sdk/local/store/memory";
|
|
206
|
-
|
|
207
|
-
const relay = new InMemorySignalProtocolRelayServer();
|
|
148
|
+
## Sandbox development
|
|
208
149
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const bob = await DefaultSignalProtocolClient.create("bob", {
|
|
215
|
-
storage: new InMemorySignalProtocolStore(),
|
|
216
|
-
relay,
|
|
217
|
-
});
|
|
218
|
-
```
|
|
150
|
+
`oe new` writes a Sandbox connection URL to `.env.local`. Pass it to
|
|
151
|
+
`createHostedSignalProtocolClient()` with the device-local store that your
|
|
152
|
+
application uses for production. A Sandbox environment uses device-owned
|
|
153
|
+
identity, so pass `hostedRelaySandboxIdentity(storage)` as
|
|
154
|
+
`hosted.getIdentityAssertion`.
|
|
219
155
|
|
|
220
156
|
## Related Docs
|
|
221
157
|
|
|
@@ -13,13 +13,9 @@ component ownership into the SDK.
|
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
npm install convex
|
|
22
|
-
```
|
|
16
|
+
The application supplies a Convex client and generated function references.
|
|
17
|
+
The adapter loads no Convex runtime dependency. The application installs and
|
|
18
|
+
mounts the `@convex-dev/r2` component in its own backend.
|
|
23
19
|
|
|
24
20
|
## Client usage
|
|
25
21
|
|
|
@@ -46,52 +42,24 @@ const client = await createSignalProtocolClient({
|
|
|
46
42
|
`completeUpload`, and `deleteObject` with the function kinds and values defined
|
|
47
43
|
by `ConvexR2ObjectStoreApi`.
|
|
48
44
|
|
|
49
|
-
##
|
|
50
|
-
|
|
51
|
-
The server-only subpath supplies validators and broker mechanics while keeping
|
|
52
|
-
authorization and persistence in application callbacks:
|
|
53
|
-
|
|
54
|
-
<!-- doc-snippet:skip requires-external-context -->
|
|
55
|
-
```ts
|
|
56
|
-
import { R2 } from "@convex-dev/r2";
|
|
57
|
-
import {
|
|
58
|
-
defineConvexR2ObjectStore,
|
|
59
|
-
type ConvexR2ObjectCallbacks,
|
|
60
|
-
} from "@open-e2ee/signal-protocol-sdk/remote/object-store/convex-r2/server";
|
|
61
|
-
import { components, internal } from "./_generated/api";
|
|
62
|
-
|
|
63
|
-
const objects =
|
|
64
|
-
internal.signalObjectStoreModel satisfies ConvexR2ObjectCallbacks;
|
|
45
|
+
## Broker contract
|
|
65
46
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
createDownload,
|
|
69
|
-
completeUpload,
|
|
70
|
-
deleteObject,
|
|
71
|
-
} = defineConvexR2ObjectStore({
|
|
72
|
-
r2: new R2(components.r2),
|
|
73
|
-
limits: {
|
|
74
|
-
maxContentLength: 50 * 1024 * 1024,
|
|
75
|
-
allowedContentTypes: ["application/octet-stream"],
|
|
76
|
-
downloadExpiresInSeconds: 15 * 60,
|
|
77
|
-
},
|
|
78
|
-
objects,
|
|
79
|
-
});
|
|
80
|
-
```
|
|
47
|
+
The application supplies the four Convex functions. Their types follow
|
|
48
|
+
`ConvexR2ObjectStoreApi`:
|
|
81
49
|
|
|
82
|
-
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
|
|
50
|
+
- `createUpload` is a mutation that reserves an upload for the authenticated caller.
|
|
51
|
+
- `createDownload` is an action that returns a short-lived download operation.
|
|
52
|
+
- `completeUpload` is an action that validates provider metadata before completion.
|
|
53
|
+
- `deleteObject` is a mutation that authorizes and records deletion.
|
|
86
54
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
55
|
+
The broker owns the `requestId -> objectId -> providerKey` mapping. It scopes
|
|
56
|
+
retry identifiers to the authenticated caller and returns stable object IDs for
|
|
57
|
+
retries. It checks the reserved ciphertext size and content type before marking
|
|
58
|
+
an upload complete. Provider credentials and keys stay on the backend.
|
|
91
59
|
|
|
92
|
-
The
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
The published SDK supplies the client adapter and its types. The application
|
|
61
|
+
supplies the broker implementation. If the application must confirm physical
|
|
62
|
+
removal, it tracks provider deletion.
|
|
95
63
|
|
|
96
64
|
See the [object-store guide](../README.md) and
|
|
97
65
|
[remote guide](../../README.md).
|
package/remote/relay/README.md
CHANGED
|
@@ -11,31 +11,37 @@ authenticated service to publish public key material and deliver ciphertext.
|
|
|
11
11
|
The relay boundary keeps that service replaceable without moving private-key or
|
|
12
12
|
plaintext ownership to the backend.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Hosted usage
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
// Real protocol and cryptography; simulated in-memory infrastructure.
|
|
19
|
-
import { createSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
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
|
-
|
|
23
|
-
const relay = inMemoryRelay();
|
|
16
|
+
Use the OpenE2EE Signal Protocol Relay through the hosted client factory:
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
<!-- doc-snippet:skip requires-external-context -->
|
|
19
|
+
```ts
|
|
20
|
+
import { createHostedSignalProtocolClient } from "@open-e2ee/signal-protocol-sdk";
|
|
21
|
+
|
|
22
|
+
const signal = await createHostedSignalProtocolClient({
|
|
23
|
+
adapters: { storage },
|
|
24
|
+
hosted: {
|
|
25
|
+
relayUrl,
|
|
26
|
+
getIdentityAssertion,
|
|
27
|
+
},
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
await client.syncToServer();
|
|
31
29
|
```
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
`
|
|
31
|
+
`oe new` writes `relayUrl` to `.env.local` as `OPEN_E2EE_RELAY_URL`, with the
|
|
32
|
+
public prefix of the framework in a Next.js, Expo, or Vite application. Supply
|
|
33
|
+
`storage` for this device and `getIdentityAssertion`. In a Sandbox environment,
|
|
34
|
+
pass `hostedRelaySandboxIdentity(storage)`. In production, pass the callback of
|
|
35
|
+
your identity provider.
|
|
36
|
+
|
|
37
|
+
For advanced integrations, implement the `SignalProtocolRelayServer` client
|
|
38
|
+
transport against your own backend. That backend must authenticate
|
|
36
39
|
mutations, allocate linked-device IDs, consume one-time prekeys atomically,
|
|
37
40
|
enforce access policy, and store only encrypted envelopes plus required routing
|
|
38
41
|
metadata.
|
|
39
42
|
|
|
43
|
+
The published package contains client transports and contracts. It does not
|
|
44
|
+
include a relay server implementation.
|
|
45
|
+
|
|
40
46
|
See the [remote guide](../README.md), [interface guide](../../docs/INTERFACES.md),
|
|
41
|
-
|
|
47
|
+
and [API reference](../../docs/api/README.md).
|
package/zk/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Zero-Knowledge Credentials and Groups
|
|
2
2
|
|
|
3
|
-
The `zk` subpaths expose credential
|
|
4
|
-
group cryptographic primitives
|
|
5
|
-
features.
|
|
3
|
+
The `zk` subpaths expose client credential requests, response verification,
|
|
4
|
+
presentation creation, and group cryptographic primitives.
|
|
6
5
|
|
|
7
6
|
## Why it exists
|
|
8
7
|
|
|
@@ -28,10 +27,10 @@ const profileKeyVersion = computeProfileKeyVersion(
|
|
|
28
27
|
);
|
|
29
28
|
```
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
Clients use trusted public parameters to verify credential responses and create
|
|
31
|
+
presentations. Credential issuance and server-side presentation checks belong
|
|
32
|
+
to the relay. The published package excludes server secret-key generation,
|
|
33
|
+
credential issuance, and server signing implementations.
|
|
35
34
|
|
|
36
35
|
See the [groups guide](../groups/README.md), [protocol policy](../docs/PROTOCOL_POLICY.md),
|
|
37
36
|
and [API reference](../docs/api/README.md).
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dual Protocol Store: ACI/PNI Identity Router
|
|
3
|
-
*
|
|
4
|
-
* Thin wrapper providing .aci() and .pni() views over KeyStorage,
|
|
5
|
-
* each pre-filling identityType for all operations.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { IdentityType, IdentityKeyPair, EcSignedPreKey, EcOneTimePreKey, KyberPreKey, KemOneTimePreKey } from '../keys/types.js';
|
|
9
|
-
import type { SignalProtocolLocalStore } from '../types/api.js';
|
|
10
|
-
/**
|
|
11
|
-
* A view of SignalProtocolLocalStore scoped to a specific identity type.
|
|
12
|
-
* All identity-type-aware methods are pre-filled with the given type.
|
|
13
|
-
*/
|
|
14
|
-
export {};
|
|
15
|
-
export declare class IdentityTypedStore {
|
|
16
|
-
private readonly store;
|
|
17
|
-
readonly identityType: IdentityType;
|
|
18
|
-
constructor(store: SignalProtocolLocalStore, identityType: IdentityType);
|
|
19
|
-
storeIdentityKey(keyPair: IdentityKeyPair): Promise<void>;
|
|
20
|
-
getIdentityKey(): Promise<IdentityKeyPair | null>;
|
|
21
|
-
hasIdentityKey(): Promise<boolean>;
|
|
22
|
-
getLocalRegistrationId(): Promise<number>;
|
|
23
|
-
setLocalRegistrationId(id: number): Promise<void>;
|
|
24
|
-
storeEcSignedPreKey(signedPreKey: EcSignedPreKey): Promise<void>;
|
|
25
|
-
getEcSignedPreKey(keyId?: number): Promise<EcSignedPreKey | null>;
|
|
26
|
-
getAllEcSignedPreKeys(): Promise<EcSignedPreKey[]> | undefined;
|
|
27
|
-
removeEcSignedPreKey(keyId: number): Promise<void> | undefined;
|
|
28
|
-
getEcSignedPreKeyMaxId(): Promise<number>;
|
|
29
|
-
storeEcOneTimePreKeys(prekeys: EcOneTimePreKey[]): Promise<void>;
|
|
30
|
-
getEcOneTimePreKeys(): Promise<EcOneTimePreKey[]>;
|
|
31
|
-
removeEcOneTimePreKey(keyId: number): Promise<void>;
|
|
32
|
-
storeKyberPreKey(prekey: KyberPreKey): Promise<void>;
|
|
33
|
-
getKyberPreKey(): Promise<KyberPreKey | null>;
|
|
34
|
-
markKyberPreKeyUsed(kyberPreKeyId: number, signedPreKeyId: number, baseKeyBytes: Uint8Array): Promise<void>;
|
|
35
|
-
getKyberPreKeyMaxId(): Promise<number>;
|
|
36
|
-
storeKemOneTimePreKeys(prekeys: KemOneTimePreKey[]): Promise<void>;
|
|
37
|
-
getKemOneTimePreKeys(): Promise<KemOneTimePreKey[]>;
|
|
38
|
-
getKemOneTimePreKey(keyId: number): Promise<KemOneTimePreKey | null>;
|
|
39
|
-
removeKemOneTimePreKey(keyId: number): Promise<void>;
|
|
40
|
-
getKemOneTimePreKeyCount(): Promise<number>;
|
|
41
|
-
deleteAllPreKeys(): Promise<{
|
|
42
|
-
ecSignedPreKeys: number;
|
|
43
|
-
ecOneTimePreKeys: number;
|
|
44
|
-
kyberPreKeys: number;
|
|
45
|
-
kemOneTimePreKeys: number;
|
|
46
|
-
}>;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Dual protocol store. Routes operations to ACI or PNI identity stores.
|
|
50
|
-
*
|
|
51
|
-
* Usage:
|
|
52
|
-
* ```typescript
|
|
53
|
-
* const dual = new DualProtocolStore(localStore);
|
|
54
|
-
* await dual.aci().getIdentityKey(); // ACI identity key
|
|
55
|
-
* await dual.pni().getIdentityKey(); // PNI identity key
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare class DualProtocolStore {
|
|
59
|
-
private readonly localStore;
|
|
60
|
-
private readonly aciStore;
|
|
61
|
-
private readonly pniStore;
|
|
62
|
-
constructor(localStore: SignalProtocolLocalStore);
|
|
63
|
-
/** ACI (Account Identity) protocol store */
|
|
64
|
-
aci(): IdentityTypedStore;
|
|
65
|
-
/** PNI (Phone/discoverable Number Identity) protocol store */
|
|
66
|
-
pni(): IdentityTypedStore;
|
|
67
|
-
/** Access the underlying unscoped store (for identity-agnostic operations) */
|
|
68
|
-
get unscoped(): SignalProtocolLocalStore;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=dual-store.d.ts.map
|