ping-openmls-sdk-react-native-macos 0.2.3 → 0.3.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/src/NativePing.ts CHANGED
@@ -54,11 +54,22 @@ export interface Spec extends TurboModule {
54
54
  * - `identityB64` — base64 of the identity export bytes
55
55
  * - `deviceLabel` — human-readable label (e.g. "MacBook")
56
56
  * - `nowMs` — wall clock; pass `Date.now()`
57
+ * - [CR-4] `sqlitePath` — absolute path to a host-managed SQLite file the SDK creates
58
+ * and owns for persistent MLS state. `null` falls back to the in-memory provider
59
+ * (fine for tests / non-cold-start flows; **not** fine for NSE-style wake-ups).
60
+ * - [CR-4] `sqliteEncryptionKeyB64` — 32-byte SQLCipher key, base64-encoded. Ignored
61
+ * when `sqlitePath` is `null`. Pass `null` if you don't want at-rest encryption.
57
62
  *
58
63
  * Resolves to `true` on success, rejects with `InitFailed` (Rust error) or
59
64
  * `InvalidIdentity` (base64 decode) on failure.
60
65
  */
61
- initClient(identityB64: string, deviceLabel: string, nowMs: number): Promise<boolean>;
66
+ initClient(
67
+ identityB64: string,
68
+ deviceLabel: string,
69
+ nowMs: number,
70
+ sqlitePath: string | null,
71
+ sqliteEncryptionKeyB64: string | null,
72
+ ): Promise<boolean>;
62
73
 
63
74
  /** Returns the active client's user_id as a hex string. Rejects if not initialised. */
64
75
  getUserId(): Promise<string>;
@@ -89,10 +100,15 @@ export interface Spec extends TurboModule {
89
100
  nowMs: number,
90
101
  ): Promise<Record<string, unknown>>;
91
102
 
92
- /** Add members by their KeyPackage bytes. Resolves to null on success. */
103
+ /**
104
+ * Add members by `(deviceId, keyPackage)` pairs ([CR-2]). The SDK persists a
105
+ * per-conversation device→leaf map so [revokeDevice] can later locate the leaves
106
+ * without a fresh directory lookup. Each entry is a dict so the codegen marshals
107
+ * it as an NSDictionary (macOS) / JSValueObject (Windows).
108
+ */
93
109
  addMembers(
94
110
  conversationId: number[],
95
- keyPackages: number[][],
111
+ entries: { deviceId: number[]; keyPackage: number[] }[],
96
112
  nowMs: number,
97
113
  ): Promise<null>;
98
114
 
@@ -137,10 +153,17 @@ export interface Spec extends TurboModule {
137
153
 
138
154
  // ----- Stage 4f: linking + revocation -----
139
155
 
140
- /** Build a linking ticket for a new device (caller is the existing device E). */
156
+ /**
157
+ * Build a linking ticket for a new device (caller is the existing device E).
158
+ *
159
+ * [CR-13] `lastAppEvents` is host-supplied per-conversation "what you missed"
160
+ * data the new device will render before sync catches up. Empty array suppresses
161
+ * catchup data. Each entry's bytes are opaque to the SDK.
162
+ */
141
163
  buildLinkingTicket(
142
164
  newDeviceId: number[],
143
165
  newDeviceKp: number[],
166
+ lastAppEvents: { conversationId: number[]; appEventBytes: number[] }[],
144
167
  nowMs: number,
145
168
  ): Promise<Record<string, unknown>>;
146
169
 
@@ -150,8 +173,44 @@ export interface Spec extends TurboModule {
150
173
  nowMs: number,
151
174
  ): Promise<null>;
152
175
 
153
- /** Revoke a device — Remove proposals in DeviceGroup + every conversation. */
154
- revokeDevice(deviceId: number[], nowMs: number): Promise<null>;
176
+ /**
177
+ * Revoke a device ([CR-2]). Returns one Commit envelope per conversation the
178
+ * device was a locally-known leaf in. Empty array means the device wasn't locally
179
+ * known anywhere (scope limit — see CR-2 doc).
180
+ */
181
+ revokeDevice(deviceId: number[], nowMs: number): Promise<Record<string, unknown>[]>;
182
+
183
+ // ----- CR-8 / CR-7 surface -----
184
+
185
+ /**
186
+ * Export a derived secret from a conversation's MLS exporter ([CR-8]). Returned
187
+ * bytes are a secret — never log; the caller is responsible for wiping the array.
188
+ */
189
+ exportConversationSecret(
190
+ conversationId: number[],
191
+ label: string,
192
+ context: number[],
193
+ length: number,
194
+ ): Promise<number[]>;
195
+
196
+ /**
197
+ * Export a portable MLS state snapshot for one conversation ([CR-7]). Returns the
198
+ * raw bytes — embed in a recovery blob or a linking ticket. Contains past epoch
199
+ * secrets; treat as a secret.
200
+ */
201
+ exportConversationStateSnapshot(
202
+ conversationId: number[],
203
+ nowMs: number,
204
+ ): Promise<number[]>;
205
+
206
+ /**
207
+ * Import a `GroupStateSnapshot` from another device of the same user identity
208
+ * ([CR-7]). Returns the imported conversation id.
209
+ */
210
+ importStateSnapshot(
211
+ snapshotBytes: number[],
212
+ nowMs: number,
213
+ ): Promise<number[]>;
155
214
 
156
215
  // ----- macOS-platform helpers -----
157
216