matrix-react-sdk
Version:
SDK for matrix.org using React
69 lines (68 loc) • 2.48 kB
TypeScript
import { MatrixClient } from "matrix-js-sdk/src/matrix";
export default class DeviceListener {
private dispatcherRef?;
private dismissed;
private dismissedThisDeviceToast;
/** Cache of the info about the current key backup on the server. */
private keyBackupInfo;
/** When `keyBackupInfo` was last updated */
private keyBackupFetchedAt;
private ourDeviceIdsAtStart;
private displayingToastsForDeviceIds;
private running;
private client?;
private shouldRecordClientInformation;
private enableBulkUnverifiedSessionsReminder;
private deviceClientInformationSettingWatcherRef;
private analyticsVerificationState?;
private analyticsRecoveryState?;
static sharedInstance(): DeviceListener;
start(matrixClient: MatrixClient): void;
stop(): void;
/**
* Dismiss notifications about our own unverified devices
*
* @param {String[]} deviceIds List of device IDs to dismiss notifications for
*/
dismissUnverifiedSessions(deviceIds: Iterable<string>): Promise<void>;
dismissEncryptionSetup(): void;
private ensureDeviceIdsAtStartPopulated;
/** Get the device list for the current user
*
* @returns the set of device IDs
*/
private getDeviceIds;
private onDevicesUpdated;
private onUserTrustStatusChanged;
private onCrossSingingKeysChanged;
private onAccountData;
private onSync;
private onRoomStateEvents;
private onAction;
/**
* Fetch the key backup information from the server.
*
* The result is cached for `KEY_BACKUP_POLL_INTERVAL` ms to avoid repeated API calls.
*
* @returns The key backup info from the server, or `null` if there is no key backup.
*/
private getKeyBackupInfo;
private shouldShowSetupEncryptionToast;
private recheck;
private doRecheck;
/**
* Reports current recovery state to analytics.
* Checks if the session is verified and if the recovery is correctly set up (i.e all secrets known locally and in 4S).
* @param cli - the matrix client
* @private
*/
private reportCryptoSessionStateToAnalytics;
/**
* Check if key backup is enabled, and if not, raise an `Action.ReportKeyBackupNotEnabled` event (which will
* trigger an auto-rageshake).
*/
private checkKeyBackupStatus;
private keyBackupStatusChecked;
private onRecordClientInformationSettingChange;
private updateClientInformation;
}