ping-openmls-sdk-react-native-macos 0.2.3 → 0.6.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,27 @@ 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.
62
+ * - `deviceSigningSecretKeyB64` — optional 32-byte Ed25519 secret the SDK
63
+ * adopts as its device signing key on FIRST init. Pass `null` to keep
64
+ * the legacy random-key behaviour. See `ClientConfig.deviceSigningSecretKey`
65
+ * in MessagingClient.ts for the security rationale.
57
66
  *
58
67
  * Resolves to `true` on success, rejects with `InitFailed` (Rust error) or
59
68
  * `InvalidIdentity` (base64 decode) on failure.
60
69
  */
61
- initClient(identityB64: string, deviceLabel: string, nowMs: number): Promise<boolean>;
70
+ initClient(
71
+ identityB64: string,
72
+ deviceLabel: string,
73
+ nowMs: number,
74
+ sqlitePath: string | null,
75
+ sqliteEncryptionKeyB64: string | null,
76
+ deviceSigningSecretKeyB64: string | null,
77
+ ): Promise<boolean>;
62
78
 
63
79
  /** Returns the active client's user_id as a hex string. Rejects if not initialised. */
64
80
  getUserId(): Promise<string>;
@@ -89,10 +105,15 @@ export interface Spec extends TurboModule {
89
105
  nowMs: number,
90
106
  ): Promise<Record<string, unknown>>;
91
107
 
92
- /** Add members by their KeyPackage bytes. Resolves to null on success. */
108
+ /**
109
+ * Add members by `(deviceId, keyPackage)` pairs ([CR-2]). The SDK persists a
110
+ * per-conversation device→leaf map so [revokeDevice] can later locate the leaves
111
+ * without a fresh directory lookup. Each entry is a dict so the codegen marshals
112
+ * it as an NSDictionary (macOS) / JSValueObject (Windows).
113
+ */
93
114
  addMembers(
94
115
  conversationId: number[],
95
- keyPackages: number[][],
116
+ entries: { deviceId: number[]; keyPackage: number[] }[],
96
117
  nowMs: number,
97
118
  ): Promise<null>;
98
119
 
@@ -137,10 +158,17 @@ export interface Spec extends TurboModule {
137
158
 
138
159
  // ----- Stage 4f: linking + revocation -----
139
160
 
140
- /** Build a linking ticket for a new device (caller is the existing device E). */
161
+ /**
162
+ * Build a linking ticket for a new device (caller is the existing device E).
163
+ *
164
+ * [CR-13] `lastAppEvents` is host-supplied per-conversation "what you missed"
165
+ * data the new device will render before sync catches up. Empty array suppresses
166
+ * catchup data. Each entry's bytes are opaque to the SDK.
167
+ */
141
168
  buildLinkingTicket(
142
169
  newDeviceId: number[],
143
170
  newDeviceKp: number[],
171
+ lastAppEvents: { conversationId: number[]; appEventBytes: number[] }[],
144
172
  nowMs: number,
145
173
  ): Promise<Record<string, unknown>>;
146
174
 
@@ -150,8 +178,44 @@ export interface Spec extends TurboModule {
150
178
  nowMs: number,
151
179
  ): Promise<null>;
152
180
 
153
- /** Revoke a device — Remove proposals in DeviceGroup + every conversation. */
154
- revokeDevice(deviceId: number[], nowMs: number): Promise<null>;
181
+ /**
182
+ * Revoke a device ([CR-2]). Returns one Commit envelope per conversation the
183
+ * device was a locally-known leaf in. Empty array means the device wasn't locally
184
+ * known anywhere (scope limit — see CR-2 doc).
185
+ */
186
+ revokeDevice(deviceId: number[], nowMs: number): Promise<Record<string, unknown>[]>;
187
+
188
+ // ----- CR-8 / CR-7 surface -----
189
+
190
+ /**
191
+ * Export a derived secret from a conversation's MLS exporter ([CR-8]). Returned
192
+ * bytes are a secret — never log; the caller is responsible for wiping the array.
193
+ */
194
+ exportConversationSecret(
195
+ conversationId: number[],
196
+ label: string,
197
+ context: number[],
198
+ length: number,
199
+ ): Promise<number[]>;
200
+
201
+ /**
202
+ * Export a portable MLS state snapshot for one conversation ([CR-7]). Returns the
203
+ * raw bytes — embed in a recovery blob or a linking ticket. Contains past epoch
204
+ * secrets; treat as a secret.
205
+ */
206
+ exportConversationStateSnapshot(
207
+ conversationId: number[],
208
+ nowMs: number,
209
+ ): Promise<number[]>;
210
+
211
+ /**
212
+ * Import a `GroupStateSnapshot` from another device of the same user identity
213
+ * ([CR-7]). Returns the imported conversation id.
214
+ */
215
+ importStateSnapshot(
216
+ snapshotBytes: number[],
217
+ nowMs: number,
218
+ ): Promise<number[]>;
155
219
 
156
220
  // ----- macOS-platform helpers -----
157
221