@tagea/capacitor-matrix 0.0.2 → 0.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/README.md +66 -37
- package/android/src/main/kotlin/de/tremaze/capacitor/matrix/CapMatrix.kt +10 -13
- package/android/src/main/kotlin/de/tremaze/capacitor/matrix/CapMatrixPlugin.kt +18 -2
- package/dist/docs.json +131 -2
- package/dist/esm/definitions.d.ts +40 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +5 -0
- package/dist/esm/web.js +190 -48
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +190 -48
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +190 -48
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapMatrixPlugin/CapMatrix.swift +18 -7
- package/ios/Sources/CapMatrixPlugin/CapMatrixPlugin.swift +19 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -357,6 +357,7 @@ The full API reference is auto-generated below from the TypeScript definitions.
|
|
|
357
357
|
* [`getKeyBackupStatus()`](#getkeybackupstatus)
|
|
358
358
|
* [`restoreKeyBackup(...)`](#restorekeybackup)
|
|
359
359
|
* [`setupRecovery(...)`](#setuprecovery)
|
|
360
|
+
* [`clearAllData()`](#clearalldata)
|
|
360
361
|
* [`isRecoveryEnabled()`](#isrecoveryenabled)
|
|
361
362
|
* [`recoverAndSetup(...)`](#recoverandsetup)
|
|
362
363
|
* [`resetRecoveryKey(...)`](#resetrecoverykey)
|
|
@@ -952,18 +953,29 @@ restoreKeyBackup(options?: { recoveryKey?: string | undefined; } | undefined) =>
|
|
|
952
953
|
### setupRecovery(...)
|
|
953
954
|
|
|
954
955
|
```typescript
|
|
955
|
-
setupRecovery(options?: { passphrase?: string | undefined; } | undefined) => Promise<RecoveryKeyInfo>
|
|
956
|
+
setupRecovery(options?: { passphrase?: string | undefined; existingPassphrase?: string | undefined; } | undefined) => Promise<RecoveryKeyInfo>
|
|
956
957
|
```
|
|
957
958
|
|
|
958
|
-
| Param | Type
|
|
959
|
-
| ------------- |
|
|
960
|
-
| **`options`** | <code>{ passphrase?: string; }</code> |
|
|
959
|
+
| Param | Type |
|
|
960
|
+
| ------------- | ------------------------------------------------------------------ |
|
|
961
|
+
| **`options`** | <code>{ passphrase?: string; existingPassphrase?: string; }</code> |
|
|
961
962
|
|
|
962
963
|
**Returns:** <code>Promise<<a href="#recoverykeyinfo">RecoveryKeyInfo</a>></code>
|
|
963
964
|
|
|
964
965
|
--------------------
|
|
965
966
|
|
|
966
967
|
|
|
968
|
+
### clearAllData()
|
|
969
|
+
|
|
970
|
+
```typescript
|
|
971
|
+
clearAllData() => Promise<void>
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
Wipe all local Matrix state (crypto DB, session, caches).
|
|
975
|
+
|
|
976
|
+
--------------------
|
|
977
|
+
|
|
978
|
+
|
|
967
979
|
### isRecoveryEnabled()
|
|
968
980
|
|
|
969
981
|
```typescript
|
|
@@ -1198,38 +1210,52 @@ removeAllListeners() => Promise<void>
|
|
|
1198
1210
|
|
|
1199
1211
|
#### SendMessageOptions
|
|
1200
1212
|
|
|
1201
|
-
| Prop | Type |
|
|
1202
|
-
| -------------- | --------------------------------------------------------------------------------------------------- |
|
|
1203
|
-
| **`roomId`** | <code>string</code> |
|
|
1204
|
-
| **`body`** | <code>string</code> |
|
|
1205
|
-
| **`msgtype`** | <code>'m.text' \| 'm.notice' \| 'm.emote' \| 'm.image' \| 'm.audio' \| 'm.video' \| 'm.file'</code> |
|
|
1206
|
-
| **`fileUri`** | <code>string</code> |
|
|
1207
|
-
| **`fileName`** | <code>string</code> |
|
|
1208
|
-
| **`mimeType`** | <code>string</code> |
|
|
1209
|
-
| **`fileSize`** | <code>number</code> |
|
|
1213
|
+
| Prop | Type | Description |
|
|
1214
|
+
| -------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
1215
|
+
| **`roomId`** | <code>string</code> | |
|
|
1216
|
+
| **`body`** | <code>string</code> | |
|
|
1217
|
+
| **`msgtype`** | <code>'m.text' \| 'm.notice' \| 'm.emote' \| 'm.image' \| 'm.audio' \| 'm.video' \| 'm.file'</code> | |
|
|
1218
|
+
| **`fileUri`** | <code>string</code> | |
|
|
1219
|
+
| **`fileName`** | <code>string</code> | |
|
|
1220
|
+
| **`mimeType`** | <code>string</code> | |
|
|
1221
|
+
| **`fileSize`** | <code>number</code> | |
|
|
1222
|
+
| **`duration`** | <code>number</code> | Audio/video duration in milliseconds (sets info.duration per Matrix spec) |
|
|
1223
|
+
| **`width`** | <code>number</code> | Image/video width in pixels (sets info.w per Matrix spec) |
|
|
1224
|
+
| **`height`** | <code>number</code> | Image/video height in pixels (sets info.h per Matrix spec) |
|
|
1210
1225
|
|
|
1211
1226
|
|
|
1212
1227
|
#### EditMessageOptions
|
|
1213
1228
|
|
|
1214
|
-
| Prop
|
|
1215
|
-
|
|
|
1216
|
-
| **`roomId`**
|
|
1217
|
-
| **`eventId`**
|
|
1218
|
-
| **`newBody`**
|
|
1229
|
+
| Prop | Type | Description |
|
|
1230
|
+
| -------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
1231
|
+
| **`roomId`** | <code>string</code> | |
|
|
1232
|
+
| **`eventId`** | <code>string</code> | |
|
|
1233
|
+
| **`newBody`** | <code>string</code> | |
|
|
1234
|
+
| **`msgtype`** | <code>'m.text' \| 'm.notice' \| 'm.emote' \| 'm.image' \| 'm.audio' \| 'm.video' \| 'm.file'</code> | Required when editing a media message; must match the original msgtype |
|
|
1235
|
+
| **`fileUri`** | <code>string</code> | New file to replace the media content (optional for caption-only edits) |
|
|
1236
|
+
| **`fileName`** | <code>string</code> | |
|
|
1237
|
+
| **`mimeType`** | <code>string</code> | |
|
|
1238
|
+
| **`fileSize`** | <code>number</code> | |
|
|
1239
|
+
| **`duration`** | <code>number</code> | Audio/video duration in milliseconds |
|
|
1240
|
+
| **`width`** | <code>number</code> | Image/video width in pixels |
|
|
1241
|
+
| **`height`** | <code>number</code> | Image/video height in pixels |
|
|
1219
1242
|
|
|
1220
1243
|
|
|
1221
1244
|
#### SendReplyOptions
|
|
1222
1245
|
|
|
1223
|
-
| Prop | Type |
|
|
1224
|
-
| -------------------- | --------------------------------------------------------------------------------------------------- |
|
|
1225
|
-
| **`roomId`** | <code>string</code> |
|
|
1226
|
-
| **`body`** | <code>string</code> |
|
|
1227
|
-
| **`replyToEventId`** | <code>string</code> |
|
|
1228
|
-
| **`msgtype`** | <code>'m.text' \| 'm.notice' \| 'm.emote' \| 'm.image' \| 'm.audio' \| 'm.video' \| 'm.file'</code> |
|
|
1229
|
-
| **`fileUri`** | <code>string</code> |
|
|
1230
|
-
| **`fileName`** | <code>string</code> |
|
|
1231
|
-
| **`mimeType`** | <code>string</code> |
|
|
1232
|
-
| **`fileSize`** | <code>number</code> |
|
|
1246
|
+
| Prop | Type | Description |
|
|
1247
|
+
| -------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
1248
|
+
| **`roomId`** | <code>string</code> | |
|
|
1249
|
+
| **`body`** | <code>string</code> | |
|
|
1250
|
+
| **`replyToEventId`** | <code>string</code> | |
|
|
1251
|
+
| **`msgtype`** | <code>'m.text' \| 'm.notice' \| 'm.emote' \| 'm.image' \| 'm.audio' \| 'm.video' \| 'm.file'</code> | |
|
|
1252
|
+
| **`fileUri`** | <code>string</code> | |
|
|
1253
|
+
| **`fileName`** | <code>string</code> | |
|
|
1254
|
+
| **`mimeType`** | <code>string</code> | |
|
|
1255
|
+
| **`fileSize`** | <code>number</code> | |
|
|
1256
|
+
| **`duration`** | <code>number</code> | Audio/video duration in milliseconds (sets info.duration per Matrix spec) |
|
|
1257
|
+
| **`width`** | <code>number</code> | Image/video width in pixels (sets info.w per Matrix spec) |
|
|
1258
|
+
| **`height`** | <code>number</code> | Image/video height in pixels (sets info.h per Matrix spec) |
|
|
1233
1259
|
|
|
1234
1260
|
|
|
1235
1261
|
#### MatrixEvent
|
|
@@ -1293,12 +1319,13 @@ removeAllListeners() => Promise<void>
|
|
|
1293
1319
|
|
|
1294
1320
|
#### DeviceInfo
|
|
1295
1321
|
|
|
1296
|
-
| Prop
|
|
1297
|
-
|
|
|
1298
|
-
| **`deviceId`**
|
|
1299
|
-
| **`displayName`**
|
|
1300
|
-
| **`lastSeenTs`**
|
|
1301
|
-
| **`lastSeenIp`**
|
|
1322
|
+
| Prop | Type | Description |
|
|
1323
|
+
| ---------------------------- | -------------------- | ------------------------------------------------- |
|
|
1324
|
+
| **`deviceId`** | <code>string</code> | |
|
|
1325
|
+
| **`displayName`** | <code>string</code> | |
|
|
1326
|
+
| **`lastSeenTs`** | <code>number</code> | |
|
|
1327
|
+
| **`lastSeenIp`** | <code>string</code> | |
|
|
1328
|
+
| **`isCrossSigningVerified`** | <code>boolean</code> | Whether this device is verified via cross-signing |
|
|
1302
1329
|
|
|
1303
1330
|
|
|
1304
1331
|
#### PusherOptions
|
|
@@ -1391,9 +1418,11 @@ removeAllListeners() => Promise<void>
|
|
|
1391
1418
|
|
|
1392
1419
|
#### ReceiptReceivedEvent
|
|
1393
1420
|
|
|
1394
|
-
| Prop
|
|
1395
|
-
|
|
|
1396
|
-
| **`roomId`**
|
|
1421
|
+
| Prop | Type | Description |
|
|
1422
|
+
| ------------- | ------------------- | ---------------------------------- |
|
|
1423
|
+
| **`roomId`** | <code>string</code> | |
|
|
1424
|
+
| **`eventId`** | <code>string</code> | The event that was read |
|
|
1425
|
+
| **`userId`** | <code>string</code> | The user who sent the read receipt |
|
|
1397
1426
|
|
|
1398
1427
|
|
|
1399
1428
|
#### PresenceChangedEvent
|
|
@@ -181,7 +181,7 @@ class MatrixSDKBridge(private val context: Context) {
|
|
|
181
181
|
onSyncState: (String) -> Unit,
|
|
182
182
|
onMessage: (Map<String, Any?>) -> Unit,
|
|
183
183
|
onRoomUpdate: (String, Map<String, Any?>) -> Unit,
|
|
184
|
-
onReceipt: (String) -> Unit,
|
|
184
|
+
onReceipt: (roomId: String, eventId: String, userId: String) -> Unit,
|
|
185
185
|
) {
|
|
186
186
|
val c = requireClient()
|
|
187
187
|
val service = c.syncService().finish()
|
|
@@ -634,6 +634,7 @@ class MatrixSDKBridge(private val context: Context) {
|
|
|
634
634
|
"displayName" to device.optString("display_name", null),
|
|
635
635
|
"lastSeenTs" to if (device.has("last_seen_ts")) device.getLong("last_seen_ts") else null,
|
|
636
636
|
"lastSeenIp" to device.optString("last_seen_ip", null),
|
|
637
|
+
"isCrossSigningVerified" to false, // TODO: wire up Rust SDK per-device verification
|
|
637
638
|
))
|
|
638
639
|
}
|
|
639
640
|
return devices
|
|
@@ -1108,7 +1109,7 @@ class MatrixSDKBridge(private val context: Context) {
|
|
|
1108
1109
|
|
|
1109
1110
|
// ── Receipt Sync (parallel v2 sync for read receipts) ──────
|
|
1110
1111
|
|
|
1111
|
-
private fun startReceiptSync(onReceipt: (String) -> Unit) {
|
|
1112
|
+
private fun startReceiptSync(onReceipt: (roomId: String, eventId: String, userId: String) -> Unit) {
|
|
1112
1113
|
val session = sessionStore.load()
|
|
1113
1114
|
if (session == null) {
|
|
1114
1115
|
android.util.Log.e("CapMatrix", "receiptSync: NO SESSION FOUND, cannot start receipt sync")
|
|
@@ -1250,7 +1251,7 @@ class MatrixSDKBridge(private val context: Context) {
|
|
|
1250
1251
|
return sb.toString()
|
|
1251
1252
|
}
|
|
1252
1253
|
|
|
1253
|
-
private fun processReceiptResponse(body: String, onReceipt: (String) -> Unit) {
|
|
1254
|
+
private fun processReceiptResponse(body: String, onReceipt: (roomId: String, eventId: String, userId: String) -> Unit) {
|
|
1254
1255
|
try {
|
|
1255
1256
|
val json = org.json.JSONObject(body)
|
|
1256
1257
|
val join = json.optJSONObject("rooms")?.optJSONObject("join") ?: return
|
|
@@ -1259,11 +1260,9 @@ class MatrixSDKBridge(private val context: Context) {
|
|
|
1259
1260
|
val roomData = join.optJSONObject(roomId) ?: continue
|
|
1260
1261
|
val ephemeral = roomData.optJSONObject("ephemeral") ?: continue
|
|
1261
1262
|
val events = ephemeral.optJSONArray("events") ?: continue
|
|
1262
|
-
var hasReceipts = false
|
|
1263
1263
|
for (i in 0 until events.length()) {
|
|
1264
1264
|
val event = events.optJSONObject(i) ?: continue
|
|
1265
1265
|
if (event.optString("type") != "m.receipt") continue
|
|
1266
|
-
hasReceipts = true
|
|
1267
1266
|
// Content format: { "$eventId": { "m.read": { "@user:server": { "ts": 123 } } } }
|
|
1268
1267
|
val content = event.optJSONObject("content") ?: continue
|
|
1269
1268
|
val roomReceipts = receiptCache.getOrPut(roomId) { mutableMapOf() }
|
|
@@ -1273,18 +1272,16 @@ class MatrixSDKBridge(private val context: Context) {
|
|
|
1273
1272
|
for (rType in listOf("m.read", "m.read.private")) {
|
|
1274
1273
|
val readers = receiptTypes.optJSONObject(rType) ?: continue
|
|
1275
1274
|
for (userId in readers.keys()) {
|
|
1276
|
-
//
|
|
1277
|
-
if (userId
|
|
1278
|
-
|
|
1279
|
-
|
|
1275
|
+
// Cache receipts from others for watermark logic
|
|
1276
|
+
if (userId != myUserId) {
|
|
1277
|
+
roomReceipts.getOrPut(eventId) { mutableSetOf() }.add(userId)
|
|
1278
|
+
}
|
|
1279
|
+
android.util.Log.d("CapMatrix", "receiptSync: receipt roomId=$roomId eventId=$eventId userId=$userId")
|
|
1280
|
+
onReceipt(roomId, eventId, userId)
|
|
1280
1281
|
}
|
|
1281
1282
|
}
|
|
1282
1283
|
}
|
|
1283
1284
|
}
|
|
1284
|
-
if (hasReceipts) {
|
|
1285
|
-
android.util.Log.d("CapMatrix", "receiptSync: receipt in $roomId, cache size=${receiptCache[roomId]?.size ?: 0}")
|
|
1286
|
-
onReceipt(roomId)
|
|
1287
|
-
}
|
|
1288
1285
|
}
|
|
1289
1286
|
} catch (e: Exception) {
|
|
1290
1287
|
android.util.Log.e("CapMatrix", "receiptSync: processReceiptResponse error: ${e.message}")
|
|
@@ -112,10 +112,10 @@ class MatrixPlugin : Plugin() {
|
|
|
112
112
|
JSObject().put("roomId", roomId).put("summary", mapToJSObject(summary)),
|
|
113
113
|
)
|
|
114
114
|
},
|
|
115
|
-
onReceipt = { roomId ->
|
|
115
|
+
onReceipt = { roomId, eventId, userId ->
|
|
116
116
|
notifyListeners(
|
|
117
117
|
"receiptReceived",
|
|
118
|
-
JSObject().put("roomId", roomId),
|
|
118
|
+
JSObject().put("roomId", roomId).put("eventId", eventId).put("userId", userId),
|
|
119
119
|
)
|
|
120
120
|
},
|
|
121
121
|
)
|
|
@@ -225,6 +225,10 @@ class MatrixPlugin : Plugin() {
|
|
|
225
225
|
val roomId = call.getString("roomId") ?: return call.reject("Missing roomId")
|
|
226
226
|
val body = call.getString("body") ?: return call.reject("Missing body")
|
|
227
227
|
val msgtype = call.getString("msgtype") ?: "m.text"
|
|
228
|
+
// Media info fields — consumed by the bridge when media sending is fully implemented
|
|
229
|
+
@Suppress("UNUSED_VARIABLE") val duration = call.getInt("duration")
|
|
230
|
+
@Suppress("UNUSED_VARIABLE") val width = call.getInt("width")
|
|
231
|
+
@Suppress("UNUSED_VARIABLE") val height = call.getInt("height")
|
|
228
232
|
|
|
229
233
|
scope.launch {
|
|
230
234
|
try {
|
|
@@ -241,6 +245,11 @@ class MatrixPlugin : Plugin() {
|
|
|
241
245
|
val roomId = call.getString("roomId") ?: return call.reject("Missing roomId")
|
|
242
246
|
val eventId = call.getString("eventId") ?: return call.reject("Missing eventId")
|
|
243
247
|
val newBody = call.getString("newBody") ?: return call.reject("Missing newBody")
|
|
248
|
+
// Media edit fields — not yet implemented in the native bridge
|
|
249
|
+
@Suppress("UNUSED_VARIABLE") val msgtype = call.getString("msgtype")
|
|
250
|
+
@Suppress("UNUSED_VARIABLE") val duration = call.getInt("duration")
|
|
251
|
+
@Suppress("UNUSED_VARIABLE") val width = call.getInt("width")
|
|
252
|
+
@Suppress("UNUSED_VARIABLE") val height = call.getInt("height")
|
|
244
253
|
|
|
245
254
|
scope.launch {
|
|
246
255
|
try {
|
|
@@ -258,6 +267,10 @@ class MatrixPlugin : Plugin() {
|
|
|
258
267
|
val body = call.getString("body") ?: return call.reject("Missing body")
|
|
259
268
|
val replyToEventId = call.getString("replyToEventId") ?: return call.reject("Missing replyToEventId")
|
|
260
269
|
val msgtype = call.getString("msgtype") ?: "m.text"
|
|
270
|
+
// Media info fields — consumed by the bridge when media sending is fully implemented
|
|
271
|
+
@Suppress("UNUSED_VARIABLE") val duration = call.getInt("duration")
|
|
272
|
+
@Suppress("UNUSED_VARIABLE") val width = call.getInt("width")
|
|
273
|
+
@Suppress("UNUSED_VARIABLE") val height = call.getInt("height")
|
|
261
274
|
|
|
262
275
|
scope.launch {
|
|
263
276
|
try {
|
|
@@ -692,6 +705,9 @@ class MatrixPlugin : Plugin() {
|
|
|
692
705
|
@PluginMethod
|
|
693
706
|
fun setupRecovery(call: PluginCall) {
|
|
694
707
|
val passphrase = call.getString("passphrase")
|
|
708
|
+
// existingPassphrase is a web-only hint for SSSS migration; the Rust SDK
|
|
709
|
+
// handles migration internally on Android. Read and ignore for now.
|
|
710
|
+
@Suppress("UNUSED_VARIABLE") val existingPassphrase = call.getString("existingPassphrase")
|
|
695
711
|
|
|
696
712
|
scope.launch {
|
|
697
713
|
try {
|
package/dist/docs.json
CHANGED
|
@@ -684,12 +684,12 @@
|
|
|
684
684
|
},
|
|
685
685
|
{
|
|
686
686
|
"name": "setupRecovery",
|
|
687
|
-
"signature": "(options?: { passphrase?: string | undefined; } | undefined) => Promise<RecoveryKeyInfo>",
|
|
687
|
+
"signature": "(options?: { passphrase?: string | undefined; existingPassphrase?: string | undefined; } | undefined) => Promise<RecoveryKeyInfo>",
|
|
688
688
|
"parameters": [
|
|
689
689
|
{
|
|
690
690
|
"name": "options",
|
|
691
691
|
"docs": "",
|
|
692
|
-
"type": "{ passphrase?: string | undefined; } | undefined"
|
|
692
|
+
"type": "{ passphrase?: string | undefined; existingPassphrase?: string | undefined; } | undefined"
|
|
693
693
|
}
|
|
694
694
|
],
|
|
695
695
|
"returns": "Promise<RecoveryKeyInfo>",
|
|
@@ -700,6 +700,16 @@
|
|
|
700
700
|
],
|
|
701
701
|
"slug": "setuprecovery"
|
|
702
702
|
},
|
|
703
|
+
{
|
|
704
|
+
"name": "clearAllData",
|
|
705
|
+
"signature": "() => Promise<void>",
|
|
706
|
+
"parameters": [],
|
|
707
|
+
"returns": "Promise<void>",
|
|
708
|
+
"tags": [],
|
|
709
|
+
"docs": "Wipe all local Matrix state (crypto DB, session, caches).",
|
|
710
|
+
"complexTypes": [],
|
|
711
|
+
"slug": "clearalldata"
|
|
712
|
+
},
|
|
703
713
|
{
|
|
704
714
|
"name": "isRecoveryEnabled",
|
|
705
715
|
"signature": "() => Promise<{ enabled: boolean; }>",
|
|
@@ -1209,6 +1219,27 @@
|
|
|
1209
1219
|
"docs": "",
|
|
1210
1220
|
"complexTypes": [],
|
|
1211
1221
|
"type": "number | undefined"
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
"name": "duration",
|
|
1225
|
+
"tags": [],
|
|
1226
|
+
"docs": "Audio/video duration in milliseconds (sets info.duration per Matrix spec)",
|
|
1227
|
+
"complexTypes": [],
|
|
1228
|
+
"type": "number | undefined"
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
"name": "width",
|
|
1232
|
+
"tags": [],
|
|
1233
|
+
"docs": "Image/video width in pixels (sets info.w per Matrix spec)",
|
|
1234
|
+
"complexTypes": [],
|
|
1235
|
+
"type": "number | undefined"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
"name": "height",
|
|
1239
|
+
"tags": [],
|
|
1240
|
+
"docs": "Image/video height in pixels (sets info.h per Matrix spec)",
|
|
1241
|
+
"complexTypes": [],
|
|
1242
|
+
"type": "number | undefined"
|
|
1212
1243
|
}
|
|
1213
1244
|
]
|
|
1214
1245
|
},
|
|
@@ -1239,6 +1270,62 @@
|
|
|
1239
1270
|
"docs": "",
|
|
1240
1271
|
"complexTypes": [],
|
|
1241
1272
|
"type": "string"
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
"name": "msgtype",
|
|
1276
|
+
"tags": [],
|
|
1277
|
+
"docs": "Required when editing a media message; must match the original msgtype",
|
|
1278
|
+
"complexTypes": [],
|
|
1279
|
+
"type": "'m.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file' | undefined"
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
"name": "fileUri",
|
|
1283
|
+
"tags": [],
|
|
1284
|
+
"docs": "New file to replace the media content (optional for caption-only edits)",
|
|
1285
|
+
"complexTypes": [],
|
|
1286
|
+
"type": "string | undefined"
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
"name": "fileName",
|
|
1290
|
+
"tags": [],
|
|
1291
|
+
"docs": "",
|
|
1292
|
+
"complexTypes": [],
|
|
1293
|
+
"type": "string | undefined"
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
"name": "mimeType",
|
|
1297
|
+
"tags": [],
|
|
1298
|
+
"docs": "",
|
|
1299
|
+
"complexTypes": [],
|
|
1300
|
+
"type": "string | undefined"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
"name": "fileSize",
|
|
1304
|
+
"tags": [],
|
|
1305
|
+
"docs": "",
|
|
1306
|
+
"complexTypes": [],
|
|
1307
|
+
"type": "number | undefined"
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
"name": "duration",
|
|
1311
|
+
"tags": [],
|
|
1312
|
+
"docs": "Audio/video duration in milliseconds",
|
|
1313
|
+
"complexTypes": [],
|
|
1314
|
+
"type": "number | undefined"
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
"name": "width",
|
|
1318
|
+
"tags": [],
|
|
1319
|
+
"docs": "Image/video width in pixels",
|
|
1320
|
+
"complexTypes": [],
|
|
1321
|
+
"type": "number | undefined"
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
"name": "height",
|
|
1325
|
+
"tags": [],
|
|
1326
|
+
"docs": "Image/video height in pixels",
|
|
1327
|
+
"complexTypes": [],
|
|
1328
|
+
"type": "number | undefined"
|
|
1242
1329
|
}
|
|
1243
1330
|
]
|
|
1244
1331
|
},
|
|
@@ -1304,6 +1391,27 @@
|
|
|
1304
1391
|
"docs": "",
|
|
1305
1392
|
"complexTypes": [],
|
|
1306
1393
|
"type": "number | undefined"
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
"name": "duration",
|
|
1397
|
+
"tags": [],
|
|
1398
|
+
"docs": "Audio/video duration in milliseconds (sets info.duration per Matrix spec)",
|
|
1399
|
+
"complexTypes": [],
|
|
1400
|
+
"type": "number | undefined"
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
"name": "width",
|
|
1404
|
+
"tags": [],
|
|
1405
|
+
"docs": "Image/video width in pixels (sets info.w per Matrix spec)",
|
|
1406
|
+
"complexTypes": [],
|
|
1407
|
+
"type": "number | undefined"
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
"name": "height",
|
|
1411
|
+
"tags": [],
|
|
1412
|
+
"docs": "Image/video height in pixels (sets info.h per Matrix spec)",
|
|
1413
|
+
"complexTypes": [],
|
|
1414
|
+
"type": "number | undefined"
|
|
1307
1415
|
}
|
|
1308
1416
|
]
|
|
1309
1417
|
},
|
|
@@ -1560,6 +1668,13 @@
|
|
|
1560
1668
|
"docs": "",
|
|
1561
1669
|
"complexTypes": [],
|
|
1562
1670
|
"type": "string | undefined"
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
"name": "isCrossSigningVerified",
|
|
1674
|
+
"tags": [],
|
|
1675
|
+
"docs": "Whether this device is verified via cross-signing",
|
|
1676
|
+
"complexTypes": [],
|
|
1677
|
+
"type": "boolean | undefined"
|
|
1563
1678
|
}
|
|
1564
1679
|
]
|
|
1565
1680
|
},
|
|
@@ -1870,6 +1985,20 @@
|
|
|
1870
1985
|
"docs": "",
|
|
1871
1986
|
"complexTypes": [],
|
|
1872
1987
|
"type": "string"
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
"name": "eventId",
|
|
1991
|
+
"tags": [],
|
|
1992
|
+
"docs": "The event that was read",
|
|
1993
|
+
"complexTypes": [],
|
|
1994
|
+
"type": "string"
|
|
1995
|
+
},
|
|
1996
|
+
{
|
|
1997
|
+
"name": "userId",
|
|
1998
|
+
"tags": [],
|
|
1999
|
+
"docs": "The user who sent the read receipt",
|
|
2000
|
+
"complexTypes": [],
|
|
2001
|
+
"type": "string"
|
|
1873
2002
|
}
|
|
1874
2003
|
]
|
|
1875
2004
|
},
|
|
@@ -24,6 +24,12 @@ export interface SendMessageOptions {
|
|
|
24
24
|
fileName?: string;
|
|
25
25
|
mimeType?: string;
|
|
26
26
|
fileSize?: number;
|
|
27
|
+
/** Audio/video duration in milliseconds (sets info.duration per Matrix spec) */
|
|
28
|
+
duration?: number;
|
|
29
|
+
/** Image/video width in pixels (sets info.w per Matrix spec) */
|
|
30
|
+
width?: number;
|
|
31
|
+
/** Image/video height in pixels (sets info.h per Matrix spec) */
|
|
32
|
+
height?: number;
|
|
27
33
|
}
|
|
28
34
|
export interface PresenceInfo {
|
|
29
35
|
presence: 'online' | 'offline' | 'unavailable';
|
|
@@ -36,6 +42,10 @@ export interface TypingEvent {
|
|
|
36
42
|
}
|
|
37
43
|
export interface ReceiptReceivedEvent {
|
|
38
44
|
roomId: string;
|
|
45
|
+
/** The event that was read */
|
|
46
|
+
eventId: string;
|
|
47
|
+
/** The user who sent the read receipt */
|
|
48
|
+
userId: string;
|
|
39
49
|
}
|
|
40
50
|
export interface PresenceChangedEvent {
|
|
41
51
|
userId: string;
|
|
@@ -45,6 +55,19 @@ export interface EditMessageOptions {
|
|
|
45
55
|
roomId: string;
|
|
46
56
|
eventId: string;
|
|
47
57
|
newBody: string;
|
|
58
|
+
/** Required when editing a media message; must match the original msgtype */
|
|
59
|
+
msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';
|
|
60
|
+
/** New file to replace the media content (optional for caption-only edits) */
|
|
61
|
+
fileUri?: string;
|
|
62
|
+
fileName?: string;
|
|
63
|
+
mimeType?: string;
|
|
64
|
+
fileSize?: number;
|
|
65
|
+
/** Audio/video duration in milliseconds */
|
|
66
|
+
duration?: number;
|
|
67
|
+
/** Image/video width in pixels */
|
|
68
|
+
width?: number;
|
|
69
|
+
/** Image/video height in pixels */
|
|
70
|
+
height?: number;
|
|
48
71
|
}
|
|
49
72
|
export interface SendReplyOptions {
|
|
50
73
|
roomId: string;
|
|
@@ -55,6 +78,12 @@ export interface SendReplyOptions {
|
|
|
55
78
|
fileName?: string;
|
|
56
79
|
mimeType?: string;
|
|
57
80
|
fileSize?: number;
|
|
81
|
+
/** Audio/video duration in milliseconds (sets info.duration per Matrix spec) */
|
|
82
|
+
duration?: number;
|
|
83
|
+
/** Image/video width in pixels (sets info.w per Matrix spec) */
|
|
84
|
+
width?: number;
|
|
85
|
+
/** Image/video height in pixels (sets info.h per Matrix spec) */
|
|
86
|
+
height?: number;
|
|
58
87
|
}
|
|
59
88
|
export interface UploadContentOptions {
|
|
60
89
|
fileUri: string;
|
|
@@ -107,6 +136,8 @@ export interface DeviceInfo {
|
|
|
107
136
|
displayName?: string;
|
|
108
137
|
lastSeenTs?: number;
|
|
109
138
|
lastSeenIp?: string;
|
|
139
|
+
/** Whether this device is verified via cross-signing */
|
|
140
|
+
isCrossSigningVerified?: boolean;
|
|
110
141
|
}
|
|
111
142
|
export interface PusherOptions {
|
|
112
143
|
pushkey: string;
|
|
@@ -315,7 +346,16 @@ export interface MatrixPlugin {
|
|
|
315
346
|
}>;
|
|
316
347
|
setupRecovery(options?: {
|
|
317
348
|
passphrase?: string;
|
|
349
|
+
/**
|
|
350
|
+
* Passphrase for the *existing* secret storage key, used by
|
|
351
|
+
* bootstrapSecretStorage to decrypt and migrate the current cross-signing
|
|
352
|
+
* and backup secrets into the newly created SSSS. Only needed on web;
|
|
353
|
+
* native platforms (Rust SDK) handle the migration internally.
|
|
354
|
+
*/
|
|
355
|
+
existingPassphrase?: string;
|
|
318
356
|
}): Promise<RecoveryKeyInfo>;
|
|
357
|
+
/** Wipe all local Matrix state (crypto DB, session, caches). */
|
|
358
|
+
clearAllData(): Promise<void>;
|
|
319
359
|
isRecoveryEnabled(): Promise<{
|
|
320
360
|
enabled: boolean;
|
|
321
361
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n// Auth & Session\n\nexport interface LoginOptions {\n homeserverUrl: string;\n userId: string;\n password: string;\n}\n\nexport interface LoginWithTokenOptions {\n homeserverUrl: string;\n accessToken: string;\n userId: string;\n deviceId: string;\n}\n\nexport interface SessionInfo {\n accessToken: string;\n userId: string;\n deviceId: string;\n homeserverUrl: string;\n}\n\n// Messaging\n\nexport interface SendMessageOptions {\n roomId: string;\n body: string;\n msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';\n fileUri?: string;\n fileName?: string;\n mimeType?: string;\n fileSize?: number;\n}\n\n// Presence\n\nexport interface PresenceInfo {\n presence: 'online' | 'offline' | 'unavailable';\n statusMsg?: string;\n lastActiveAgo?: number;\n}\n\n// Typing\n\nexport interface TypingEvent {\n roomId: string;\n userIds: string[];\n}\n\nexport interface ReceiptReceivedEvent {\n roomId: string;\n}\n\nexport interface PresenceChangedEvent {\n userId: string;\n presence: PresenceInfo;\n}\n\n// Edit & Reply\n\nexport interface EditMessageOptions {\n roomId: string;\n eventId: string;\n newBody: string;\n}\n\nexport interface SendReplyOptions {\n roomId: string;\n body: string;\n replyToEventId: string;\n msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';\n fileUri?: string;\n fileName?: string;\n mimeType?: string;\n fileSize?: number;\n}\n\n// Upload\n\nexport interface UploadContentOptions {\n fileUri: string;\n fileName: string;\n mimeType: string;\n}\n\nexport interface UploadContentResult {\n contentUri: string;\n}\n\n// Thumbnail\n\nexport interface ThumbnailUrlOptions {\n mxcUrl: string;\n width: number;\n height: number;\n method?: 'scale' | 'crop';\n}\n\nexport interface MatrixEvent {\n eventId: string;\n roomId: string;\n senderId: string;\n type: string;\n content: Record<string, unknown>;\n originServerTs: number;\n /** Delivery/read status for own messages: 'sending' | 'sent' | 'delivered' | 'read' */\n status?: 'sending' | 'sent' | 'delivered' | 'read';\n /** User IDs that have read this event */\n readBy?: string[];\n /** Unsigned data (e.g. m.relations for edits, transaction_id for local echo) */\n unsigned?: Record<string, unknown>;\n}\n\n// Rooms\n\nexport interface RoomSummary {\n roomId: string;\n name: string;\n topic?: string;\n memberCount: number;\n isEncrypted: boolean;\n unreadCount: number;\n lastEventTs?: number;\n membership?: 'join' | 'invite' | 'leave' | 'ban';\n avatarUrl?: string;\n isDirect?: boolean;\n}\n\nexport interface RoomMember {\n userId: string;\n displayName?: string;\n membership: 'join' | 'invite' | 'leave' | 'ban';\n avatarUrl?: string;\n}\n\n// Device Management\n\nexport interface DeviceInfo {\n deviceId: string;\n displayName?: string;\n lastSeenTs?: number;\n lastSeenIp?: string;\n}\n\n// Pusher\n\nexport interface PusherOptions {\n pushkey: string;\n kind: string | null;\n appId: string;\n appDisplayName: string;\n deviceDisplayName: string;\n lang: string;\n data: { url: string; format?: string };\n}\n\n// User Discovery\n\nexport interface UserProfile {\n userId: string;\n displayName?: string;\n avatarUrl?: string;\n}\n\n// Encryption\n\nexport interface CrossSigningStatus {\n hasMaster: boolean;\n hasSelfSigning: boolean;\n hasUserSigning: boolean;\n isReady: boolean;\n}\n\nexport interface KeyBackupStatus {\n exists: boolean;\n version?: string;\n enabled: boolean;\n}\n\nexport interface RecoveryKeyInfo {\n recoveryKey: string;\n}\n\nexport interface EncryptionStatus {\n isCrossSigningReady: boolean;\n crossSigningStatus: CrossSigningStatus;\n isKeyBackupEnabled: boolean;\n keyBackupVersion?: string;\n isSecretStorageReady: boolean;\n}\n\n// Events & Sync\n\nexport type SyncState = 'INITIAL' | 'SYNCING' | 'ERROR' | 'STOPPED';\n\nexport interface SyncStateChangeEvent {\n state: SyncState;\n error?: string;\n}\n\nexport interface MessageReceivedEvent {\n event: MatrixEvent;\n}\n\nexport interface RoomUpdatedEvent {\n roomId: string;\n summary: RoomSummary;\n}\n\n// Plugin Interface\n\nexport interface MatrixPlugin {\n // Auth\n login(options: LoginOptions): Promise<SessionInfo>;\n loginWithToken(options: LoginWithTokenOptions): Promise<SessionInfo>;\n logout(): Promise<void>;\n getSession(): Promise<SessionInfo | null>;\n\n // Sync\n startSync(): Promise<void>;\n stopSync(): Promise<void>;\n getSyncState(): Promise<{ state: SyncState }>;\n\n // Rooms\n createRoom(options: {\n name?: string;\n topic?: string;\n isEncrypted?: boolean;\n isDirect?: boolean;\n invite?: string[];\n preset?: 'private_chat' | 'trusted_private_chat' | 'public_chat';\n historyVisibility?: 'invited' | 'joined' | 'shared' | 'world_readable';\n }): Promise<{ roomId: string }>;\n getRooms(): Promise<{ rooms: RoomSummary[] }>;\n getRoomMembers(options: { roomId: string }): Promise<{ members: RoomMember[] }>;\n joinRoom(options: { roomIdOrAlias: string }): Promise<{ roomId: string }>;\n leaveRoom(options: { roomId: string }): Promise<void>;\n forgetRoom(options: { roomId: string }): Promise<void>;\n\n // Messaging\n sendMessage(options: SendMessageOptions): Promise<{ eventId: string }>;\n editMessage(options: EditMessageOptions): Promise<{ eventId: string }>;\n sendReply(options: SendReplyOptions): Promise<{ eventId: string }>;\n getRoomMessages(options: {\n roomId: string;\n limit?: number;\n from?: string;\n }): Promise<{ events: MatrixEvent[]; nextBatch?: string }>;\n markRoomAsRead(options: {\n roomId: string;\n eventId: string;\n }): Promise<void>;\n refreshEventStatuses(options: {\n roomId: string;\n eventIds: string[];\n }): Promise<{ events: MatrixEvent[] }>;\n redactEvent(options: {\n roomId: string;\n eventId: string;\n reason?: string;\n }): Promise<void>;\n sendReaction(options: {\n roomId: string;\n eventId: string;\n key: string;\n }): Promise<{ eventId: string }>;\n\n // Room Management\n setRoomName(options: { roomId: string; name: string }): Promise<void>;\n setRoomTopic(options: { roomId: string; topic: string }): Promise<void>;\n setRoomAvatar(options: { roomId: string; mxcUrl: string }): Promise<void>;\n inviteUser(options: { roomId: string; userId: string }): Promise<void>;\n kickUser(options: { roomId: string; userId: string; reason?: string }): Promise<void>;\n banUser(options: { roomId: string; userId: string; reason?: string }): Promise<void>;\n unbanUser(options: { roomId: string; userId: string }): Promise<void>;\n\n // Typing\n sendTyping(options: {\n roomId: string;\n isTyping: boolean;\n timeout?: number;\n }): Promise<void>;\n\n // Media\n getMediaUrl(options: { mxcUrl: string }): Promise<{ httpUrl: string }>;\n getThumbnailUrl(options: ThumbnailUrlOptions): Promise<{ httpUrl: string }>;\n uploadContent(options: UploadContentOptions): Promise<UploadContentResult>;\n\n // User Discovery\n searchUsers(options: {\n searchTerm: string;\n limit?: number;\n }): Promise<{ results: UserProfile[]; limited: boolean }>;\n\n // Presence\n setPresence(options: {\n presence: 'online' | 'offline' | 'unavailable';\n statusMsg?: string;\n }): Promise<void>;\n getPresence(options: { userId: string }): Promise<PresenceInfo>;\n\n // Device Management\n getDevices(): Promise<{ devices: DeviceInfo[] }>;\n deleteDevice(options: { deviceId: string; auth?: Record<string, unknown> }): Promise<void>;\n\n // Push\n setPusher(options: PusherOptions): Promise<void>;\n\n // Encryption\n initializeCrypto(): Promise<void>;\n getEncryptionStatus(): Promise<EncryptionStatus>;\n bootstrapCrossSigning(): Promise<void>;\n setupKeyBackup(): Promise<KeyBackupStatus>;\n getKeyBackupStatus(): Promise<KeyBackupStatus>;\n restoreKeyBackup(options?: {\n recoveryKey?: string;\n }): Promise<{ importedKeys: number }>;\n setupRecovery(options?: {\n passphrase?: string;\n }): Promise<RecoveryKeyInfo>;\n isRecoveryEnabled(): Promise<{ enabled: boolean }>;\n recoverAndSetup(options: {\n recoveryKey?: string;\n passphrase?: string;\n }): Promise<void>;\n resetRecoveryKey(options?: {\n passphrase?: string;\n }): Promise<RecoveryKeyInfo>;\n exportRoomKeys(options: {\n passphrase: string;\n }): Promise<{ data: string }>;\n importRoomKeys(options: {\n data: string;\n passphrase: string;\n }): Promise<{ importedKeys: number }>;\n\n // Listeners\n addListener(\n event: 'syncStateChange',\n listenerFunc: (data: SyncStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'messageReceived',\n listenerFunc: (data: MessageReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'roomUpdated',\n listenerFunc: (data: RoomUpdatedEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'typingChanged',\n listenerFunc: (data: TypingEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'receiptReceived',\n listenerFunc: (data: ReceiptReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'presenceChanged',\n listenerFunc: (data: PresenceChangedEvent) => void,\n ): Promise<PluginListenerHandle>;\n removeAllListeners(): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n// Auth & Session\n\nexport interface LoginOptions {\n homeserverUrl: string;\n userId: string;\n password: string;\n}\n\nexport interface LoginWithTokenOptions {\n homeserverUrl: string;\n accessToken: string;\n userId: string;\n deviceId: string;\n}\n\nexport interface SessionInfo {\n accessToken: string;\n userId: string;\n deviceId: string;\n homeserverUrl: string;\n}\n\n// Messaging\n\nexport interface SendMessageOptions {\n roomId: string;\n body: string;\n msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';\n fileUri?: string;\n fileName?: string;\n mimeType?: string;\n fileSize?: number;\n /** Audio/video duration in milliseconds (sets info.duration per Matrix spec) */\n duration?: number;\n /** Image/video width in pixels (sets info.w per Matrix spec) */\n width?: number;\n /** Image/video height in pixels (sets info.h per Matrix spec) */\n height?: number;\n}\n\n// Presence\n\nexport interface PresenceInfo {\n presence: 'online' | 'offline' | 'unavailable';\n statusMsg?: string;\n lastActiveAgo?: number;\n}\n\n// Typing\n\nexport interface TypingEvent {\n roomId: string;\n userIds: string[];\n}\n\nexport interface ReceiptReceivedEvent {\n roomId: string;\n /** The event that was read */\n eventId: string;\n /** The user who sent the read receipt */\n userId: string;\n}\n\nexport interface PresenceChangedEvent {\n userId: string;\n presence: PresenceInfo;\n}\n\n// Edit & Reply\n\nexport interface EditMessageOptions {\n roomId: string;\n eventId: string;\n newBody: string;\n /** Required when editing a media message; must match the original msgtype */\n msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';\n /** New file to replace the media content (optional for caption-only edits) */\n fileUri?: string;\n fileName?: string;\n mimeType?: string;\n fileSize?: number;\n /** Audio/video duration in milliseconds */\n duration?: number;\n /** Image/video width in pixels */\n width?: number;\n /** Image/video height in pixels */\n height?: number;\n}\n\nexport interface SendReplyOptions {\n roomId: string;\n body: string;\n replyToEventId: string;\n msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';\n fileUri?: string;\n fileName?: string;\n mimeType?: string;\n fileSize?: number;\n /** Audio/video duration in milliseconds (sets info.duration per Matrix spec) */\n duration?: number;\n /** Image/video width in pixels (sets info.w per Matrix spec) */\n width?: number;\n /** Image/video height in pixels (sets info.h per Matrix spec) */\n height?: number;\n}\n\n// Upload\n\nexport interface UploadContentOptions {\n fileUri: string;\n fileName: string;\n mimeType: string;\n}\n\nexport interface UploadContentResult {\n contentUri: string;\n}\n\n// Thumbnail\n\nexport interface ThumbnailUrlOptions {\n mxcUrl: string;\n width: number;\n height: number;\n method?: 'scale' | 'crop';\n}\n\nexport interface MatrixEvent {\n eventId: string;\n roomId: string;\n senderId: string;\n type: string;\n content: Record<string, unknown>;\n originServerTs: number;\n /** Delivery/read status for own messages: 'sending' | 'sent' | 'delivered' | 'read' */\n status?: 'sending' | 'sent' | 'delivered' | 'read';\n /** User IDs that have read this event */\n readBy?: string[];\n /** Unsigned data (e.g. m.relations for edits, transaction_id for local echo) */\n unsigned?: Record<string, unknown>;\n}\n\n// Rooms\n\nexport interface RoomSummary {\n roomId: string;\n name: string;\n topic?: string;\n memberCount: number;\n isEncrypted: boolean;\n unreadCount: number;\n lastEventTs?: number;\n membership?: 'join' | 'invite' | 'leave' | 'ban';\n avatarUrl?: string;\n isDirect?: boolean;\n}\n\nexport interface RoomMember {\n userId: string;\n displayName?: string;\n membership: 'join' | 'invite' | 'leave' | 'ban';\n avatarUrl?: string;\n}\n\n// Device Management\n\nexport interface DeviceInfo {\n deviceId: string;\n displayName?: string;\n lastSeenTs?: number;\n lastSeenIp?: string;\n /** Whether this device is verified via cross-signing */\n isCrossSigningVerified?: boolean;\n}\n\n// Pusher\n\nexport interface PusherOptions {\n pushkey: string;\n kind: string | null;\n appId: string;\n appDisplayName: string;\n deviceDisplayName: string;\n lang: string;\n data: { url: string; format?: string };\n}\n\n// User Discovery\n\nexport interface UserProfile {\n userId: string;\n displayName?: string;\n avatarUrl?: string;\n}\n\n// Encryption\n\nexport interface CrossSigningStatus {\n hasMaster: boolean;\n hasSelfSigning: boolean;\n hasUserSigning: boolean;\n isReady: boolean;\n}\n\nexport interface KeyBackupStatus {\n exists: boolean;\n version?: string;\n enabled: boolean;\n}\n\nexport interface RecoveryKeyInfo {\n recoveryKey: string;\n}\n\nexport interface EncryptionStatus {\n isCrossSigningReady: boolean;\n crossSigningStatus: CrossSigningStatus;\n isKeyBackupEnabled: boolean;\n keyBackupVersion?: string;\n isSecretStorageReady: boolean;\n}\n\n// Events & Sync\n\nexport type SyncState = 'INITIAL' | 'SYNCING' | 'ERROR' | 'STOPPED';\n\nexport interface SyncStateChangeEvent {\n state: SyncState;\n error?: string;\n}\n\nexport interface MessageReceivedEvent {\n event: MatrixEvent;\n}\n\nexport interface RoomUpdatedEvent {\n roomId: string;\n summary: RoomSummary;\n}\n\n// Plugin Interface\n\nexport interface MatrixPlugin {\n // Auth\n login(options: LoginOptions): Promise<SessionInfo>;\n loginWithToken(options: LoginWithTokenOptions): Promise<SessionInfo>;\n logout(): Promise<void>;\n getSession(): Promise<SessionInfo | null>;\n\n // Sync\n startSync(): Promise<void>;\n stopSync(): Promise<void>;\n getSyncState(): Promise<{ state: SyncState }>;\n\n // Rooms\n createRoom(options: {\n name?: string;\n topic?: string;\n isEncrypted?: boolean;\n isDirect?: boolean;\n invite?: string[];\n preset?: 'private_chat' | 'trusted_private_chat' | 'public_chat';\n historyVisibility?: 'invited' | 'joined' | 'shared' | 'world_readable';\n }): Promise<{ roomId: string }>;\n getRooms(): Promise<{ rooms: RoomSummary[] }>;\n getRoomMembers(options: { roomId: string }): Promise<{ members: RoomMember[] }>;\n joinRoom(options: { roomIdOrAlias: string }): Promise<{ roomId: string }>;\n leaveRoom(options: { roomId: string }): Promise<void>;\n forgetRoom(options: { roomId: string }): Promise<void>;\n\n // Messaging\n sendMessage(options: SendMessageOptions): Promise<{ eventId: string }>;\n editMessage(options: EditMessageOptions): Promise<{ eventId: string }>;\n sendReply(options: SendReplyOptions): Promise<{ eventId: string }>;\n getRoomMessages(options: {\n roomId: string;\n limit?: number;\n from?: string;\n }): Promise<{ events: MatrixEvent[]; nextBatch?: string }>;\n markRoomAsRead(options: {\n roomId: string;\n eventId: string;\n }): Promise<void>;\n refreshEventStatuses(options: {\n roomId: string;\n eventIds: string[];\n }): Promise<{ events: MatrixEvent[] }>;\n redactEvent(options: {\n roomId: string;\n eventId: string;\n reason?: string;\n }): Promise<void>;\n sendReaction(options: {\n roomId: string;\n eventId: string;\n key: string;\n }): Promise<{ eventId: string }>;\n\n // Room Management\n setRoomName(options: { roomId: string; name: string }): Promise<void>;\n setRoomTopic(options: { roomId: string; topic: string }): Promise<void>;\n setRoomAvatar(options: { roomId: string; mxcUrl: string }): Promise<void>;\n inviteUser(options: { roomId: string; userId: string }): Promise<void>;\n kickUser(options: { roomId: string; userId: string; reason?: string }): Promise<void>;\n banUser(options: { roomId: string; userId: string; reason?: string }): Promise<void>;\n unbanUser(options: { roomId: string; userId: string }): Promise<void>;\n\n // Typing\n sendTyping(options: {\n roomId: string;\n isTyping: boolean;\n timeout?: number;\n }): Promise<void>;\n\n // Media\n getMediaUrl(options: { mxcUrl: string }): Promise<{ httpUrl: string }>;\n getThumbnailUrl(options: ThumbnailUrlOptions): Promise<{ httpUrl: string }>;\n uploadContent(options: UploadContentOptions): Promise<UploadContentResult>;\n\n // User Discovery\n searchUsers(options: {\n searchTerm: string;\n limit?: number;\n }): Promise<{ results: UserProfile[]; limited: boolean }>;\n\n // Presence\n setPresence(options: {\n presence: 'online' | 'offline' | 'unavailable';\n statusMsg?: string;\n }): Promise<void>;\n getPresence(options: { userId: string }): Promise<PresenceInfo>;\n\n // Device Management\n getDevices(): Promise<{ devices: DeviceInfo[] }>;\n deleteDevice(options: { deviceId: string; auth?: Record<string, unknown> }): Promise<void>;\n\n // Push\n setPusher(options: PusherOptions): Promise<void>;\n\n // Encryption\n initializeCrypto(): Promise<void>;\n getEncryptionStatus(): Promise<EncryptionStatus>;\n bootstrapCrossSigning(): Promise<void>;\n setupKeyBackup(): Promise<KeyBackupStatus>;\n getKeyBackupStatus(): Promise<KeyBackupStatus>;\n restoreKeyBackup(options?: {\n recoveryKey?: string;\n }): Promise<{ importedKeys: number }>;\n setupRecovery(options?: {\n passphrase?: string;\n /**\n * Passphrase for the *existing* secret storage key, used by\n * bootstrapSecretStorage to decrypt and migrate the current cross-signing\n * and backup secrets into the newly created SSSS. Only needed on web;\n * native platforms (Rust SDK) handle the migration internally.\n */\n existingPassphrase?: string;\n }): Promise<RecoveryKeyInfo>;\n /** Wipe all local Matrix state (crypto DB, session, caches). */\n clearAllData(): Promise<void>;\n isRecoveryEnabled(): Promise<{ enabled: boolean }>;\n recoverAndSetup(options: {\n recoveryKey?: string;\n passphrase?: string;\n }): Promise<void>;\n resetRecoveryKey(options?: {\n passphrase?: string;\n }): Promise<RecoveryKeyInfo>;\n exportRoomKeys(options: {\n passphrase: string;\n }): Promise<{ data: string }>;\n importRoomKeys(options: {\n data: string;\n passphrase: string;\n }): Promise<{ importedKeys: number }>;\n\n // Listeners\n addListener(\n event: 'syncStateChange',\n listenerFunc: (data: SyncStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'messageReceived',\n listenerFunc: (data: MessageReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'roomUpdated',\n listenerFunc: (data: RoomUpdatedEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'typingChanged',\n listenerFunc: (data: TypingEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'receiptReceived',\n listenerFunc: (data: ReceiptReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n event: 'presenceChanged',\n listenerFunc: (data: PresenceChangedEvent) => void,\n ): Promise<PluginListenerHandle>;\n removeAllListeners(): Promise<void>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -3,11 +3,14 @@ import type { MatrixPlugin, LoginOptions, LoginWithTokenOptions, SessionInfo, Se
|
|
|
3
3
|
export declare class MatrixWeb extends WebPlugin implements MatrixPlugin {
|
|
4
4
|
private client?;
|
|
5
5
|
private secretStorageKey?;
|
|
6
|
+
private secretStorageKeyId?;
|
|
6
7
|
private recoveryPassphrase?;
|
|
8
|
+
private fallbackPassphrase?;
|
|
7
9
|
private readonly _cryptoCallbacks;
|
|
8
10
|
login(options: LoginOptions): Promise<SessionInfo>;
|
|
9
11
|
loginWithToken(options: LoginWithTokenOptions): Promise<SessionInfo>;
|
|
10
12
|
logout(): Promise<void>;
|
|
13
|
+
clearAllData(): Promise<void>;
|
|
11
14
|
getSession(): Promise<SessionInfo | null>;
|
|
12
15
|
startSync(): Promise<void>;
|
|
13
16
|
stopSync(): Promise<void>;
|
|
@@ -143,6 +146,7 @@ export declare class MatrixWeb extends WebPlugin implements MatrixPlugin {
|
|
|
143
146
|
}): Promise<void>;
|
|
144
147
|
setPusher(options: PusherOptions): Promise<void>;
|
|
145
148
|
initializeCrypto(): Promise<void>;
|
|
149
|
+
private deleteCryptoStore;
|
|
146
150
|
getEncryptionStatus(): Promise<EncryptionStatus>;
|
|
147
151
|
bootstrapCrossSigning(): Promise<void>;
|
|
148
152
|
setupKeyBackup(): Promise<KeyBackupStatus>;
|
|
@@ -154,6 +158,7 @@ export declare class MatrixWeb extends WebPlugin implements MatrixPlugin {
|
|
|
154
158
|
}>;
|
|
155
159
|
setupRecovery(options?: {
|
|
156
160
|
passphrase?: string;
|
|
161
|
+
existingPassphrase?: string;
|
|
157
162
|
}): Promise<RecoveryKeyInfo>;
|
|
158
163
|
isRecoveryEnabled(): Promise<{
|
|
159
164
|
enabled: boolean;
|