@tagea/capacitor-matrix 0.0.2

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.
@@ -0,0 +1,347 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ export interface LoginOptions {
3
+ homeserverUrl: string;
4
+ userId: string;
5
+ password: string;
6
+ }
7
+ export interface LoginWithTokenOptions {
8
+ homeserverUrl: string;
9
+ accessToken: string;
10
+ userId: string;
11
+ deviceId: string;
12
+ }
13
+ export interface SessionInfo {
14
+ accessToken: string;
15
+ userId: string;
16
+ deviceId: string;
17
+ homeserverUrl: string;
18
+ }
19
+ export interface SendMessageOptions {
20
+ roomId: string;
21
+ body: string;
22
+ msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';
23
+ fileUri?: string;
24
+ fileName?: string;
25
+ mimeType?: string;
26
+ fileSize?: number;
27
+ }
28
+ export interface PresenceInfo {
29
+ presence: 'online' | 'offline' | 'unavailable';
30
+ statusMsg?: string;
31
+ lastActiveAgo?: number;
32
+ }
33
+ export interface TypingEvent {
34
+ roomId: string;
35
+ userIds: string[];
36
+ }
37
+ export interface ReceiptReceivedEvent {
38
+ roomId: string;
39
+ }
40
+ export interface PresenceChangedEvent {
41
+ userId: string;
42
+ presence: PresenceInfo;
43
+ }
44
+ export interface EditMessageOptions {
45
+ roomId: string;
46
+ eventId: string;
47
+ newBody: string;
48
+ }
49
+ export interface SendReplyOptions {
50
+ roomId: string;
51
+ body: string;
52
+ replyToEventId: string;
53
+ msgtype?: 'm.text' | 'm.notice' | 'm.emote' | 'm.image' | 'm.audio' | 'm.video' | 'm.file';
54
+ fileUri?: string;
55
+ fileName?: string;
56
+ mimeType?: string;
57
+ fileSize?: number;
58
+ }
59
+ export interface UploadContentOptions {
60
+ fileUri: string;
61
+ fileName: string;
62
+ mimeType: string;
63
+ }
64
+ export interface UploadContentResult {
65
+ contentUri: string;
66
+ }
67
+ export interface ThumbnailUrlOptions {
68
+ mxcUrl: string;
69
+ width: number;
70
+ height: number;
71
+ method?: 'scale' | 'crop';
72
+ }
73
+ export interface MatrixEvent {
74
+ eventId: string;
75
+ roomId: string;
76
+ senderId: string;
77
+ type: string;
78
+ content: Record<string, unknown>;
79
+ originServerTs: number;
80
+ /** Delivery/read status for own messages: 'sending' | 'sent' | 'delivered' | 'read' */
81
+ status?: 'sending' | 'sent' | 'delivered' | 'read';
82
+ /** User IDs that have read this event */
83
+ readBy?: string[];
84
+ /** Unsigned data (e.g. m.relations for edits, transaction_id for local echo) */
85
+ unsigned?: Record<string, unknown>;
86
+ }
87
+ export interface RoomSummary {
88
+ roomId: string;
89
+ name: string;
90
+ topic?: string;
91
+ memberCount: number;
92
+ isEncrypted: boolean;
93
+ unreadCount: number;
94
+ lastEventTs?: number;
95
+ membership?: 'join' | 'invite' | 'leave' | 'ban';
96
+ avatarUrl?: string;
97
+ isDirect?: boolean;
98
+ }
99
+ export interface RoomMember {
100
+ userId: string;
101
+ displayName?: string;
102
+ membership: 'join' | 'invite' | 'leave' | 'ban';
103
+ avatarUrl?: string;
104
+ }
105
+ export interface DeviceInfo {
106
+ deviceId: string;
107
+ displayName?: string;
108
+ lastSeenTs?: number;
109
+ lastSeenIp?: string;
110
+ }
111
+ export interface PusherOptions {
112
+ pushkey: string;
113
+ kind: string | null;
114
+ appId: string;
115
+ appDisplayName: string;
116
+ deviceDisplayName: string;
117
+ lang: string;
118
+ data: {
119
+ url: string;
120
+ format?: string;
121
+ };
122
+ }
123
+ export interface UserProfile {
124
+ userId: string;
125
+ displayName?: string;
126
+ avatarUrl?: string;
127
+ }
128
+ export interface CrossSigningStatus {
129
+ hasMaster: boolean;
130
+ hasSelfSigning: boolean;
131
+ hasUserSigning: boolean;
132
+ isReady: boolean;
133
+ }
134
+ export interface KeyBackupStatus {
135
+ exists: boolean;
136
+ version?: string;
137
+ enabled: boolean;
138
+ }
139
+ export interface RecoveryKeyInfo {
140
+ recoveryKey: string;
141
+ }
142
+ export interface EncryptionStatus {
143
+ isCrossSigningReady: boolean;
144
+ crossSigningStatus: CrossSigningStatus;
145
+ isKeyBackupEnabled: boolean;
146
+ keyBackupVersion?: string;
147
+ isSecretStorageReady: boolean;
148
+ }
149
+ export type SyncState = 'INITIAL' | 'SYNCING' | 'ERROR' | 'STOPPED';
150
+ export interface SyncStateChangeEvent {
151
+ state: SyncState;
152
+ error?: string;
153
+ }
154
+ export interface MessageReceivedEvent {
155
+ event: MatrixEvent;
156
+ }
157
+ export interface RoomUpdatedEvent {
158
+ roomId: string;
159
+ summary: RoomSummary;
160
+ }
161
+ export interface MatrixPlugin {
162
+ login(options: LoginOptions): Promise<SessionInfo>;
163
+ loginWithToken(options: LoginWithTokenOptions): Promise<SessionInfo>;
164
+ logout(): Promise<void>;
165
+ getSession(): Promise<SessionInfo | null>;
166
+ startSync(): Promise<void>;
167
+ stopSync(): Promise<void>;
168
+ getSyncState(): Promise<{
169
+ state: SyncState;
170
+ }>;
171
+ createRoom(options: {
172
+ name?: string;
173
+ topic?: string;
174
+ isEncrypted?: boolean;
175
+ isDirect?: boolean;
176
+ invite?: string[];
177
+ preset?: 'private_chat' | 'trusted_private_chat' | 'public_chat';
178
+ historyVisibility?: 'invited' | 'joined' | 'shared' | 'world_readable';
179
+ }): Promise<{
180
+ roomId: string;
181
+ }>;
182
+ getRooms(): Promise<{
183
+ rooms: RoomSummary[];
184
+ }>;
185
+ getRoomMembers(options: {
186
+ roomId: string;
187
+ }): Promise<{
188
+ members: RoomMember[];
189
+ }>;
190
+ joinRoom(options: {
191
+ roomIdOrAlias: string;
192
+ }): Promise<{
193
+ roomId: string;
194
+ }>;
195
+ leaveRoom(options: {
196
+ roomId: string;
197
+ }): Promise<void>;
198
+ forgetRoom(options: {
199
+ roomId: string;
200
+ }): Promise<void>;
201
+ sendMessage(options: SendMessageOptions): Promise<{
202
+ eventId: string;
203
+ }>;
204
+ editMessage(options: EditMessageOptions): Promise<{
205
+ eventId: string;
206
+ }>;
207
+ sendReply(options: SendReplyOptions): Promise<{
208
+ eventId: string;
209
+ }>;
210
+ getRoomMessages(options: {
211
+ roomId: string;
212
+ limit?: number;
213
+ from?: string;
214
+ }): Promise<{
215
+ events: MatrixEvent[];
216
+ nextBatch?: string;
217
+ }>;
218
+ markRoomAsRead(options: {
219
+ roomId: string;
220
+ eventId: string;
221
+ }): Promise<void>;
222
+ refreshEventStatuses(options: {
223
+ roomId: string;
224
+ eventIds: string[];
225
+ }): Promise<{
226
+ events: MatrixEvent[];
227
+ }>;
228
+ redactEvent(options: {
229
+ roomId: string;
230
+ eventId: string;
231
+ reason?: string;
232
+ }): Promise<void>;
233
+ sendReaction(options: {
234
+ roomId: string;
235
+ eventId: string;
236
+ key: string;
237
+ }): Promise<{
238
+ eventId: string;
239
+ }>;
240
+ setRoomName(options: {
241
+ roomId: string;
242
+ name: string;
243
+ }): Promise<void>;
244
+ setRoomTopic(options: {
245
+ roomId: string;
246
+ topic: string;
247
+ }): Promise<void>;
248
+ setRoomAvatar(options: {
249
+ roomId: string;
250
+ mxcUrl: string;
251
+ }): Promise<void>;
252
+ inviteUser(options: {
253
+ roomId: string;
254
+ userId: string;
255
+ }): Promise<void>;
256
+ kickUser(options: {
257
+ roomId: string;
258
+ userId: string;
259
+ reason?: string;
260
+ }): Promise<void>;
261
+ banUser(options: {
262
+ roomId: string;
263
+ userId: string;
264
+ reason?: string;
265
+ }): Promise<void>;
266
+ unbanUser(options: {
267
+ roomId: string;
268
+ userId: string;
269
+ }): Promise<void>;
270
+ sendTyping(options: {
271
+ roomId: string;
272
+ isTyping: boolean;
273
+ timeout?: number;
274
+ }): Promise<void>;
275
+ getMediaUrl(options: {
276
+ mxcUrl: string;
277
+ }): Promise<{
278
+ httpUrl: string;
279
+ }>;
280
+ getThumbnailUrl(options: ThumbnailUrlOptions): Promise<{
281
+ httpUrl: string;
282
+ }>;
283
+ uploadContent(options: UploadContentOptions): Promise<UploadContentResult>;
284
+ searchUsers(options: {
285
+ searchTerm: string;
286
+ limit?: number;
287
+ }): Promise<{
288
+ results: UserProfile[];
289
+ limited: boolean;
290
+ }>;
291
+ setPresence(options: {
292
+ presence: 'online' | 'offline' | 'unavailable';
293
+ statusMsg?: string;
294
+ }): Promise<void>;
295
+ getPresence(options: {
296
+ userId: string;
297
+ }): Promise<PresenceInfo>;
298
+ getDevices(): Promise<{
299
+ devices: DeviceInfo[];
300
+ }>;
301
+ deleteDevice(options: {
302
+ deviceId: string;
303
+ auth?: Record<string, unknown>;
304
+ }): Promise<void>;
305
+ setPusher(options: PusherOptions): Promise<void>;
306
+ initializeCrypto(): Promise<void>;
307
+ getEncryptionStatus(): Promise<EncryptionStatus>;
308
+ bootstrapCrossSigning(): Promise<void>;
309
+ setupKeyBackup(): Promise<KeyBackupStatus>;
310
+ getKeyBackupStatus(): Promise<KeyBackupStatus>;
311
+ restoreKeyBackup(options?: {
312
+ recoveryKey?: string;
313
+ }): Promise<{
314
+ importedKeys: number;
315
+ }>;
316
+ setupRecovery(options?: {
317
+ passphrase?: string;
318
+ }): Promise<RecoveryKeyInfo>;
319
+ isRecoveryEnabled(): Promise<{
320
+ enabled: boolean;
321
+ }>;
322
+ recoverAndSetup(options: {
323
+ recoveryKey?: string;
324
+ passphrase?: string;
325
+ }): Promise<void>;
326
+ resetRecoveryKey(options?: {
327
+ passphrase?: string;
328
+ }): Promise<RecoveryKeyInfo>;
329
+ exportRoomKeys(options: {
330
+ passphrase: string;
331
+ }): Promise<{
332
+ data: string;
333
+ }>;
334
+ importRoomKeys(options: {
335
+ data: string;
336
+ passphrase: string;
337
+ }): Promise<{
338
+ importedKeys: number;
339
+ }>;
340
+ addListener(event: 'syncStateChange', listenerFunc: (data: SyncStateChangeEvent) => void): Promise<PluginListenerHandle>;
341
+ addListener(event: 'messageReceived', listenerFunc: (data: MessageReceivedEvent) => void): Promise<PluginListenerHandle>;
342
+ addListener(event: 'roomUpdated', listenerFunc: (data: RoomUpdatedEvent) => void): Promise<PluginListenerHandle>;
343
+ addListener(event: 'typingChanged', listenerFunc: (data: TypingEvent) => void): Promise<PluginListenerHandle>;
344
+ addListener(event: 'receiptReceived', listenerFunc: (data: ReceiptReceivedEvent) => void): Promise<PluginListenerHandle>;
345
+ addListener(event: 'presenceChanged', listenerFunc: (data: PresenceChangedEvent) => void): Promise<PluginListenerHandle>;
346
+ removeAllListeners(): Promise<void>;
347
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,4 @@
1
+ import type { MatrixPlugin } from './definitions';
2
+ declare const Matrix: MatrixPlugin;
3
+ export * from './definitions';
4
+ export { Matrix };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const Matrix = registerPlugin('Matrix', {
3
+ web: () => import('./web').then((m) => new m.MatrixWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { Matrix };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,MAAM,GAAG,cAAc,CAAe,QAAQ,EAAE;IACpD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;CAC1D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { MatrixPlugin } from './definitions';\n\nconst Matrix = registerPlugin<MatrixPlugin>('Matrix', {\n web: () => import('./web').then((m) => new m.MatrixWeb()),\n});\n\nexport * from './definitions';\nexport { Matrix };\n"]}
@@ -0,0 +1,193 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { MatrixPlugin, LoginOptions, LoginWithTokenOptions, SessionInfo, SendMessageOptions, EditMessageOptions, SendReplyOptions, UploadContentOptions, UploadContentResult, ThumbnailUrlOptions, PusherOptions, DeviceInfo, MatrixEvent, RoomSummary, RoomMember, SyncState, EncryptionStatus, KeyBackupStatus, RecoveryKeyInfo, PresenceInfo, UserProfile } from './definitions';
3
+ export declare class MatrixWeb extends WebPlugin implements MatrixPlugin {
4
+ private client?;
5
+ private secretStorageKey?;
6
+ private recoveryPassphrase?;
7
+ private readonly _cryptoCallbacks;
8
+ login(options: LoginOptions): Promise<SessionInfo>;
9
+ loginWithToken(options: LoginWithTokenOptions): Promise<SessionInfo>;
10
+ logout(): Promise<void>;
11
+ getSession(): Promise<SessionInfo | null>;
12
+ startSync(): Promise<void>;
13
+ stopSync(): Promise<void>;
14
+ getSyncState(): Promise<{
15
+ state: SyncState;
16
+ }>;
17
+ createRoom(options: {
18
+ name?: string;
19
+ topic?: string;
20
+ isEncrypted?: boolean;
21
+ isDirect?: boolean;
22
+ invite?: string[];
23
+ preset?: 'private_chat' | 'trusted_private_chat' | 'public_chat';
24
+ historyVisibility?: 'invited' | 'joined' | 'shared' | 'world_readable';
25
+ }): Promise<{
26
+ roomId: string;
27
+ }>;
28
+ getRooms(): Promise<{
29
+ rooms: RoomSummary[];
30
+ }>;
31
+ getRoomMembers(options: {
32
+ roomId: string;
33
+ }): Promise<{
34
+ members: RoomMember[];
35
+ }>;
36
+ joinRoom(options: {
37
+ roomIdOrAlias: string;
38
+ }): Promise<{
39
+ roomId: string;
40
+ }>;
41
+ leaveRoom(options: {
42
+ roomId: string;
43
+ }): Promise<void>;
44
+ forgetRoom(options: {
45
+ roomId: string;
46
+ }): Promise<void>;
47
+ sendMessage(options: SendMessageOptions): Promise<{
48
+ eventId: string;
49
+ }>;
50
+ editMessage(options: EditMessageOptions): Promise<{
51
+ eventId: string;
52
+ }>;
53
+ sendReply(options: SendReplyOptions): Promise<{
54
+ eventId: string;
55
+ }>;
56
+ getRoomMessages(options: {
57
+ roomId: string;
58
+ limit?: number;
59
+ from?: string;
60
+ }): Promise<{
61
+ events: MatrixEvent[];
62
+ nextBatch?: string;
63
+ }>;
64
+ markRoomAsRead(options: {
65
+ roomId: string;
66
+ eventId: string;
67
+ }): Promise<void>;
68
+ refreshEventStatuses(options: {
69
+ roomId: string;
70
+ eventIds: string[];
71
+ }): Promise<{
72
+ events: import('./definitions').MatrixEvent[];
73
+ }>;
74
+ redactEvent(options: {
75
+ roomId: string;
76
+ eventId: string;
77
+ reason?: string;
78
+ }): Promise<void>;
79
+ sendReaction(options: {
80
+ roomId: string;
81
+ eventId: string;
82
+ key: string;
83
+ }): Promise<{
84
+ eventId: string;
85
+ }>;
86
+ setRoomName(options: {
87
+ roomId: string;
88
+ name: string;
89
+ }): Promise<void>;
90
+ setRoomTopic(options: {
91
+ roomId: string;
92
+ topic: string;
93
+ }): Promise<void>;
94
+ setRoomAvatar(options: {
95
+ roomId: string;
96
+ mxcUrl: string;
97
+ }): Promise<void>;
98
+ inviteUser(options: {
99
+ roomId: string;
100
+ userId: string;
101
+ }): Promise<void>;
102
+ kickUser(options: {
103
+ roomId: string;
104
+ userId: string;
105
+ reason?: string;
106
+ }): Promise<void>;
107
+ banUser(options: {
108
+ roomId: string;
109
+ userId: string;
110
+ reason?: string;
111
+ }): Promise<void>;
112
+ unbanUser(options: {
113
+ roomId: string;
114
+ userId: string;
115
+ }): Promise<void>;
116
+ sendTyping(options: {
117
+ roomId: string;
118
+ isTyping: boolean;
119
+ timeout?: number;
120
+ }): Promise<void>;
121
+ getMediaUrl(options: {
122
+ mxcUrl: string;
123
+ }): Promise<{
124
+ httpUrl: string;
125
+ }>;
126
+ getThumbnailUrl(options: ThumbnailUrlOptions): Promise<{
127
+ httpUrl: string;
128
+ }>;
129
+ uploadContent(options: UploadContentOptions): Promise<UploadContentResult>;
130
+ setPresence(options: {
131
+ presence: 'online' | 'offline' | 'unavailable';
132
+ statusMsg?: string;
133
+ }): Promise<void>;
134
+ getPresence(options: {
135
+ userId: string;
136
+ }): Promise<PresenceInfo>;
137
+ getDevices(): Promise<{
138
+ devices: DeviceInfo[];
139
+ }>;
140
+ deleteDevice(options: {
141
+ deviceId: string;
142
+ auth?: Record<string, unknown>;
143
+ }): Promise<void>;
144
+ setPusher(options: PusherOptions): Promise<void>;
145
+ initializeCrypto(): Promise<void>;
146
+ getEncryptionStatus(): Promise<EncryptionStatus>;
147
+ bootstrapCrossSigning(): Promise<void>;
148
+ setupKeyBackup(): Promise<KeyBackupStatus>;
149
+ getKeyBackupStatus(): Promise<KeyBackupStatus>;
150
+ restoreKeyBackup(_options?: {
151
+ recoveryKey?: string;
152
+ }): Promise<{
153
+ importedKeys: number;
154
+ }>;
155
+ setupRecovery(options?: {
156
+ passphrase?: string;
157
+ }): Promise<RecoveryKeyInfo>;
158
+ isRecoveryEnabled(): Promise<{
159
+ enabled: boolean;
160
+ }>;
161
+ recoverAndSetup(options: {
162
+ recoveryKey?: string;
163
+ passphrase?: string;
164
+ }): Promise<void>;
165
+ resetRecoveryKey(options?: {
166
+ passphrase?: string;
167
+ }): Promise<RecoveryKeyInfo>;
168
+ exportRoomKeys(options: {
169
+ passphrase: string;
170
+ }): Promise<{
171
+ data: string;
172
+ }>;
173
+ importRoomKeys(options: {
174
+ data: string;
175
+ passphrase: string;
176
+ }): Promise<{
177
+ importedKeys: number;
178
+ }>;
179
+ private requireClient;
180
+ private requireCrypto;
181
+ private ensureCrypto;
182
+ private persistSession;
183
+ private serializeEvent;
184
+ private serializeRoom;
185
+ searchUsers(options: {
186
+ searchTerm: string;
187
+ limit?: number;
188
+ }): Promise<{
189
+ results: UserProfile[];
190
+ limited: boolean;
191
+ }>;
192
+ private mapSyncState;
193
+ }