import { Client, DidString } from '@atproto/lex'; import { PasswordSession } from '@atproto/lex-password-session'; import { com } from '@pds-moover/lexicons'; type RepoStatus = com.pdsmoover.backup.getRepoStatus.$OutputBody; type StatusHandler = ((status: string) => void) | null; /** * Logic to sign up and manage backups for pdsmoover.com (or your own selfhosted instance) */ declare class BackupService { /** * Client that proxies com.pdsmoover.backup.* calls to the backup service via the user's PDS */ proxiedClient: Client | null; /** * Client pointed straight at the user's PDS (no proxying), for com.atproto.identity.* calls */ pdsClient: Client | null; /** * The logged-in session for the user's PDS */ session: PasswordSession | null; /** * The did:web for the xrpc service for backups, defaults to pdsmoover.com */ backupDidWeb: DidString; /** * @param backupDidWeb - The did:web for the xrpc service for backups, defaults to did:web:pdsmoover.com */ constructor(backupDidWeb?: DidString); /** * Logs in and returns the backup status. * To use the rest of the BackupService, it is assumed that this has ran first, * and the user has successfully signed up. A successful login is a returned null if the user has not signed up. * or the backup status if they are * * If the server requires 2FA, * it will throw with error.error === 'AuthFactorTokenRequired'. * @param identifier - handle or did * @param password * @param onStatus - a function that takes a string used to update the UI. * Like (status) => console.log(status) * @param twoFactorCode */ loginAndStatus(identifier: string, password: string, onStatus?: StatusHandler, twoFactorCode?: string | null): Promise; /** * Signs the user up for backups with the service */ signUp(onStatus?: StatusHandler): Promise; /** * Requests a PLC token to be sent to the user's email, needed to add a new rotation key */ requestAPlcToken(): Promise; /** * Adds a new rotation to the users did document. Assumes you are already signed in. * * WARNING: This will overwrite any existing rotation keys with the new one at the top, and the PDS key as the second one * @param plcToken - PLC token from the user's email that was sent from requestAPlcToken * @param rotationKey - The new rotation key to add to the user's did document */ addANewRotationKey(plcToken: string, rotationKey: string): Promise; /** * Gets the current status of the user's backup repository. * * @param onStatus - a function that takes a string used to update the UI. */ getUsersRepoStatus(onStatus?: StatusHandler): Promise; /** * Requests a backup to be run immediately for the signed-in user. Usually does, depend on the server's backup queue */ runBackupNow(onStatus?: StatusHandler): Promise; /** * Remove (delete) the signed-in user's backup repository. this also deletes all the user's backup data. */ removeRepo(onStatus?: StatusHandler): Promise; } export { BackupService }; //# sourceMappingURL=backup.d.ts.map