Client side atproto account migrator in your web browser, along with services for backups and adversarial migrations. pdsmoover.com
pds atproto migrations moo cow
at main 94 lines 3.9 kB view raw
1/** 2 * JSDoc type-only import to avoid runtime import errors in the browser. 3 */ 4export type InferXRPCBodyOutput = any; 5/** 6 * JSDoc type-only import to avoid runtime import errors in the browser. 7 * @typedef {import('@atcute/lexicons').InferXRPCBodyOutput} InferXRPCBodyOutput 8 */ 9/** 10 * Logic to sign up and manage backups for pdsmoover.com (or your own selfhosted instance) 11 */ 12export class BackupService { 13 /** 14 * 15 * @param backupDidWeb {string} - The did:web for the xrpc service for backups, defaults to did:web:pdsmoover.com 16 */ 17 constructor(backupDidWeb?: string); 18 /** 19 * 20 * @type {Client} 21 */ 22 atCuteClient: Client; 23 /** 24 * 25 * @type {CredentialManager} 26 */ 27 atCuteCredentialManager: CredentialManager; 28 /** 29 * The did:web for the xrpc service for backups, defaults to pdsmoover.com 30 * @type {string} 31 */ 32 backupDidWeb: string; 33 /** 34 * Logs in and returns the backup status. 35 * To use the rest of the BackupService, it is assumed that this has ran first, 36 * and the user has successfully signed up. A successful login is a returned null if the user has not signed up. 37 * or the backup status if they are 38 * 39 * If the server requires 2FA, 40 * it will throw with error.error === 'AuthFactorTokenRequired'. 41 * @param identifier {string} handle or did 42 * @param password {string} 43 * @param {function|null} onStatus - a function that takes a string used to update the UI. 44 * Like (status) => console.log(status) 45 * @param twoFactorCode {string|null} 46 * 47 * @returns {Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>|null>} 48 */ 49 loginAndStatus(identifier: string, password: string, onStatus?: Function | null, twoFactorCode?: string | null): Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema["output"]> | null>; 50 /** 51 * Signs the user up for backups with the service 52 * @param onStatus 53 * @returns {Promise<void>} 54 */ 55 signUp(onStatus?: any): Promise<void>; 56 /** 57 * Requests a PLC token to be sent to the user's email, needed to add a new rotation key 58 * @returns {Promise<void>} 59 */ 60 requestAPlcToken(): Promise<void>; 61 /** 62 * Adds a new rotation to the users did document. Assumes you are already signed in. 63 * 64 * WARNING: This will overwrite any existing rotation keys with the new one at the top, and the PDS key as the second one 65 * @param plcToken {string} - PLC token from the user's email that was sent from requestAPlcToken 66 * @param rotationKey {string} - The new rotation key to add to the user's did document 67 * @returns {Promise<void>} 68 */ 69 addANewRotationKey(plcToken: string, rotationKey: string): Promise<void>; 70 /** 71 * 72 * Gets the current status of the user's backup repository. 73 * 74 * @param onStatus {function|null} - a function that takes a string used to update the UI. 75 * @returns {Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>>} 76 */ 77 getUsersRepoStatus(onStatus?: Function | null): Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema["output"]>>; 78 /** 79 * Requests a backup to be run immediately for the signed-in user. Usually does, depend on the server's backup queue 80 * @param onStatus 81 * @returns {Promise<boolean>} 82 */ 83 runBackupNow(onStatus?: any): Promise<boolean>; 84 /** 85 * Remove (delete) the signed-in user's backup repository. this also deletes all the user's backup data. 86 * @param onStatus 87 * @returns {Promise<boolean>} 88 */ 89 removeRepo(onStatus?: any): Promise<boolean>; 90} 91import { Client } from '@atcute/client'; 92import { CredentialManager } from '@atcute/client'; 93import { ComPdsmooverBackupDescribeServer } from '@pds-moover/lexicons'; 94//# sourceMappingURL=backup.d.ts.map