@ping-app/ping-openmls-sdk 0.10.2 → 0.10.4
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/README.md +13 -10
- package/dist/index.cjs +1401 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +999 -145
- package/dist/index.d.ts +999 -145
- package/dist/index.js +1360 -263
- package/dist/index.js.map +1 -1
- package/dist/notification-preview.cjs +1 -3
- package/dist/notification-preview.cjs.map +1 -1
- package/dist/notification-preview.d.cts +1 -8
- package/dist/notification-preview.d.ts +1 -8
- package/dist/notification-preview.js +1 -3
- package/dist/notification-preview.js.map +1 -1
- package/dist/storage/indexeddb.cjs +4 -3
- package/dist/storage/indexeddb.cjs.map +1 -1
- package/dist/storage/indexeddb.d.cts +1 -1
- package/dist/storage/indexeddb.d.ts +1 -1
- package/dist/storage/indexeddb.js +4 -3
- package/dist/storage/indexeddb.js.map +1 -1
- package/dist/transport/websocket.d.cts +1 -1
- package/dist/transport/websocket.d.ts +1 -1
- package/dist/{types-gAmJFSC-.d.cts → types-omhvRjtq.d.cts} +343 -45
- package/dist/{types-gAmJFSC-.d.ts → types-omhvRjtq.d.ts} +343 -45
- package/dist/worker.cjs +686 -69
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +716 -80
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/wasm/package.json +1 -1
- package/wasm/ping_wasm.d.ts +539 -112
- package/wasm/ping_wasm.js +1387 -322
- package/wasm/ping_wasm_bg.wasm +0 -0
- package/wasm/ping_wasm_bg.wasm.d.ts +74 -21
package/README.md
CHANGED
|
@@ -12,23 +12,26 @@ npm install @ping-app/ping-openmls-sdk
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
|
-
import { MessagingClient } from "@ping-app/ping-openmls-sdk";
|
|
15
|
+
import { AccountSetup, MessagingClient } from "@ping-app/ping-openmls-sdk";
|
|
16
16
|
import { IndexedDbStorage } from "@ping-app/ping-openmls-sdk/storage/indexeddb";
|
|
17
17
|
import { WebSocketTransport } from "@ping-app/ping-openmls-sdk/transport/websocket";
|
|
18
18
|
|
|
19
|
-
// 1. Identity — generate once per user, then persist (encrypted) by your auth flow.
|
|
20
|
-
const identityExport = await MessagingClient.generateIdentity();
|
|
21
|
-
|
|
22
19
|
// 2. Plug in storage + transport.
|
|
23
20
|
const storage = new IndexedDbStorage();
|
|
24
21
|
const transport = new WebSocketTransport({ baseUrl: "https://relay.example.com" });
|
|
25
22
|
|
|
26
|
-
// 3.
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
// 3. Set a NEW account up once (it writes the device record into `storage`; the
|
|
24
|
+
// app never makes, holds or exports an account identity), or link or restore.
|
|
25
|
+
const setup = AccountSetup.open({ storage });
|
|
26
|
+
await setup.createAccount({ slot, identityState, persistentStorage });
|
|
27
|
+
setup.close();
|
|
28
|
+
|
|
29
|
+
// 4. Start from the device record.
|
|
30
|
+
const client = await MessagingClient.initFromDeviceRecord({
|
|
31
|
+
deviceLabel: "Web", storage, transport,
|
|
29
32
|
});
|
|
30
33
|
|
|
31
|
-
//
|
|
34
|
+
// 5. Use.
|
|
32
35
|
const convo = await client.createConversation({ name: "Team" });
|
|
33
36
|
await convo.addMembers([bobKeyPackage]);
|
|
34
37
|
await convo.send(new TextEncoder().encode("hello"));
|
|
@@ -85,8 +88,8 @@ Aim: ≤ 350 KiB gzipped for the WASM blob, ≤ 8 KiB gzipped for the TS surface
|
|
|
85
88
|
by:
|
|
86
89
|
|
|
87
90
|
- Building the WASM with `--release`, `wasm-opt -O3`, and stripping symbols.
|
|
88
|
-
- Lazy-initializing WASM only on first
|
|
89
|
-
pay the cost on cold pages).
|
|
91
|
+
- Lazy-initializing WASM only on the first request that needs it (so the static calls of
|
|
92
|
+
`MessagingClient` do not pay the cost on cold pages).
|
|
90
93
|
- No CBOR or crypto libraries on the main thread.
|
|
91
94
|
|
|
92
95
|
## React Native
|