···11-export const handleResolver: CompositeHandleResolver
22-export const docResolver: CompositeDidDocumentResolver<'plc' | 'web'>
11+export const handleResolver: CompositeHandleResolver;
22+export const docResolver: CompositeDidDocumentResolver<"plc" | "web">;
33/**
44 * Cleans the handle of @ and some other unicode characters that used to show up when copied from the profile
55 * @param handle {string}
66 * @returns {string}
77 */
88-export function cleanHandle(handle: string): string
88+export function cleanHandle(handle: string): string;
99/**
1010 * Convince helper to resolve a handle to a did and then find the PDS url from the did document.
1111 *
···1313 * @returns {Promise<{usersDid: string, pds: string}>}
1414 */
1515export function handleAndPDSResolver(handle: any): Promise<{
1616- usersDid: string
1717- pds: string
1818-}>
1616+ usersDid: string;
1717+ pds: string;
1818+}>;
1919/**
2020 * Fetches the DID Web from the .well-known/did.json endpoint of the server.
2121 * Legacy and was helpful if the web ui and server are on the same domain, not as useful now
2222 * @param baseUrl
2323 * @returns {Promise<*>}
2424 */
2525-export function fetchPDSMooverDIDWeb(baseUrl: any): Promise<any>
2626-import { CompositeHandleResolver } from '@atcute/identity-resolver'
2727-import { CompositeDidDocumentResolver } from '@atcute/identity-resolver'
2828-//# sourceMappingURL=atprotoUtils.d.ts.map
2525+export function fetchPDSMooverDIDWeb(baseUrl: any): Promise<any>;
2626+import { CompositeHandleResolver } from '@atcute/identity-resolver';
2727+import { CompositeDidDocumentResolver } from '@atcute/identity-resolver';
2828+//# sourceMappingURL=atprotoUtils.d.ts.map
···11/**
22 * JSDoc type-only import to avoid runtime import errors in the browser.
33 */
44-export type InferXRPCBodyOutput = any
44+export type InferXRPCBodyOutput = any;
55/**
66 * JSDoc type-only import to avoid runtime import errors in the browser.
77 * @typedef {import('@atcute/lexicons').InferXRPCBodyOutput} InferXRPCBodyOutput
···1010 * Logic to sign up and manage backups for pdsmoover.com (or your own selfhosted instance)
1111 */
1212export class BackupService {
1313- /**
1414- *
1515- * @param backupDidWeb {string} - The did:web for the xrpc service for backups, defaults to did:web:pdsmoover.com
1616- */
1717- constructor(backupDidWeb?: string)
1818- /**
1919- *
2020- * @type {Client}
2121- */
2222- atCuteClient: Client
2323- /**
2424- *
2525- * @type {CredentialManager}
2626- */
2727- atCuteCredentialManager: CredentialManager
2828- /**
2929- * The did:web for the xrpc service for backups, defaults to pdsmoover.com
3030- * @type {string}
3131- */
3232- backupDidWeb: string
3333- /**
3434- * Logs in and returns the backup status.
3535- * To use the rest of the BackupService, it is assumed that this has ran first,
3636- * and the user has successfully signed up. A successful login is a returned null if the user has not signed up.
3737- * or the backup status if they are
3838- *
3939- * If the server requires 2FA,
4040- * it will throw with error.error === 'AuthFactorTokenRequired'.
4141- * @param identifier {string} handle or did
4242- * @param password {string}
4343- * @param {function|null} onStatus - a function that takes a string used to update the UI.
4444- * Like (status) => console.log(status)
4545- * @param twoFactorCode {string|null}
4646- *
4747- * @returns {Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>|null>}
4848- */
4949- loginAndStatus(
5050- identifier: string,
5151- password: string,
5252- onStatus?: Function | null,
5353- twoFactorCode?: string | null,
5454- ): Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']> | null>
5555- /**
5656- * Signs the user up for backups with the service
5757- * @param onStatus
5858- * @returns {Promise<void>}
5959- */
6060- signUp(onStatus?: any): Promise<void>
6161- /**
6262- * Requests a PLC token to be sent to the user's email, needed to add a new rotation key
6363- * @returns {Promise<void>}
6464- */
6565- requestAPlcToken(): Promise<void>
6666- /**
6767- * Adds a new rotation to the users did document. Assumes you are already signed in.
6868- *
6969- * WARNING: This will overwrite any existing rotation keys with the new one at the top, and the PDS key as the second one
7070- * @param plcToken {string} - PLC token from the user's email that was sent from requestAPlcToken
7171- * @param rotationKey {string} - The new rotation key to add to the user's did document
7272- * @returns {Promise<void>}
7373- */
7474- addANewRotationKey(plcToken: string, rotationKey: string): Promise<void>
7575- /**
7676- *
7777- * Gets the current status of the user's backup repository.
7878- *
7979- * @param onStatus {function|null} - a function that takes a string used to update the UI.
8080- * @returns {Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>>}
8181- */
8282- getUsersRepoStatus(
8383- onStatus?: Function | null,
8484- ): Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>>
8585- /**
8686- * Requests a backup to be run immediately for the signed-in user. Usually does, depend on the server's backup queue
8787- * @param onStatus
8888- * @returns {Promise<boolean>}
8989- */
9090- runBackupNow(onStatus?: any): Promise<boolean>
9191- /**
9292- * Remove (delete) the signed-in user's backup repository. this also deletes all the user's backup data.
9393- * @param onStatus
9494- * @returns {Promise<boolean>}
9595- */
9696- removeRepo(onStatus?: any): Promise<boolean>
1313+ /**
1414+ *
1515+ * @param backupDidWeb {string} - The did:web for the xrpc service for backups, defaults to did:web:pdsmoover.com
1616+ */
1717+ constructor(backupDidWeb?: string);
1818+ /**
1919+ *
2020+ * @type {Client}
2121+ */
2222+ atCuteClient: Client;
2323+ /**
2424+ *
2525+ * @type {CredentialManager}
2626+ */
2727+ atCuteCredentialManager: CredentialManager;
2828+ /**
2929+ * The did:web for the xrpc service for backups, defaults to pdsmoover.com
3030+ * @type {string}
3131+ */
3232+ backupDidWeb: string;
3333+ /**
3434+ * Logs in and returns the backup status.
3535+ * To use the rest of the BackupService, it is assumed that this has ran first,
3636+ * and the user has successfully signed up. A successful login is a returned null if the user has not signed up.
3737+ * or the backup status if they are
3838+ *
3939+ * If the server requires 2FA,
4040+ * it will throw with error.error === 'AuthFactorTokenRequired'.
4141+ * @param identifier {string} handle or did
4242+ * @param password {string}
4343+ * @param {function|null} onStatus - a function that takes a string used to update the UI.
4444+ * Like (status) => console.log(status)
4545+ * @param twoFactorCode {string|null}
4646+ *
4747+ * @returns {Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>|null>}
4848+ */
4949+ loginAndStatus(identifier: string, password: string, onStatus?: Function | null, twoFactorCode?: string | null): Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema["output"]> | null>;
5050+ /**
5151+ * Signs the user up for backups with the service
5252+ * @param onStatus
5353+ * @returns {Promise<void>}
5454+ */
5555+ signUp(onStatus?: any): Promise<void>;
5656+ /**
5757+ * Requests a PLC token to be sent to the user's email, needed to add a new rotation key
5858+ * @returns {Promise<void>}
5959+ */
6060+ requestAPlcToken(): Promise<void>;
6161+ /**
6262+ * Adds a new rotation to the users did document. Assumes you are already signed in.
6363+ *
6464+ * WARNING: This will overwrite any existing rotation keys with the new one at the top, and the PDS key as the second one
6565+ * @param plcToken {string} - PLC token from the user's email that was sent from requestAPlcToken
6666+ * @param rotationKey {string} - The new rotation key to add to the user's did document
6767+ * @returns {Promise<void>}
6868+ */
6969+ addANewRotationKey(plcToken: string, rotationKey: string): Promise<void>;
7070+ /**
7171+ *
7272+ * Gets the current status of the user's backup repository.
7373+ *
7474+ * @param onStatus {function|null} - a function that takes a string used to update the UI.
7575+ * @returns {Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema['output']>>}
7676+ */
7777+ getUsersRepoStatus(onStatus?: Function | null): Promise<InferXRPCBodyOutput<ComPdsmooverBackupDescribeServer.mainSchema["output"]>>;
7878+ /**
7979+ * Requests a backup to be run immediately for the signed-in user. Usually does, depend on the server's backup queue
8080+ * @param onStatus
8181+ * @returns {Promise<boolean>}
8282+ */
8383+ runBackupNow(onStatus?: any): Promise<boolean>;
8484+ /**
8585+ * Remove (delete) the signed-in user's backup repository. this also deletes all the user's backup data.
8686+ * @param onStatus
8787+ * @returns {Promise<boolean>}
8888+ */
8989+ removeRepo(onStatus?: any): Promise<boolean>;
9790}
9898-import { Client } from '@atcute/client'
9999-import { CredentialManager } from '@atcute/client'
100100-import { ComPdsmooverBackupDescribeServer } from '@pds-moover/lexicons'
101101-//# sourceMappingURL=backup.d.ts.map
9191+import { Client } from '@atcute/client';
9292+import { CredentialManager } from '@atcute/client';
9393+import { ComPdsmooverBackupDescribeServer } from '@pds-moover/lexicons';
9494+//# sourceMappingURL=backup.d.ts.map
···22 * Class to help find missing blobs from the did's previous PDS and import them into the current PDS
33 */
44export class MissingBlobs {
55- /**
66- * The user's current PDS agent
77- * @type {AtpAgent}
88- */
99- currentPdsAgent: AtpAgent
1010- /**
1111- * The user's old PDS agent
1212- * @type {AtpAgent}
1313- */
1414- oldPdsAgent: AtpAgent
1515- /**
1616- * the user's did
1717- * @type {string|null}
1818- */
1919- did: string | null
2020- /**
2121- * The user's current PDS url
2222- * @type {null}
2323- */
2424- currentPdsUrl: any
2525- /**
2626- * A list of the missing cids blobs from the old PDS. In this case if a retry upload fails it gets put in this array for the ui
2727- * @type {string[]}
2828- */
2929- missingBlobs: string[]
3030- /**
3131- * Logs the user into the current PDS and gets the account status
3232- * @param handle {string}
3333- * @param password {string}
3434- * @param twoFactorCode {string|null}
3535- * @returns {Promise<{accountStatus: OutputSchema, missingBlobsCount: number}>}
3636- */
3737- currentAgentLogin(
3838- handle: string,
3939- password: string,
4040- twoFactorCode?: string | null,
4141- ): Promise<{
4242- accountStatus: OutputSchema
4343- missingBlobsCount: number
4444- }>
4545- /**
4646- * Logs into the old PDS and gets the account status.
4747- * Does not need a handle
4848- * since it is assumed the user has already logged in with the current PDS and we are using their did
4949- * @param password {string}
5050- * @param twoFactorCode {string|null}
5151- * @param pdsUrl {string|null} - If you know the url of the old PDS you can pass it in here. If not it will be guessed at from plc ops
5252- * @returns {Promise<void>}
5353- */
5454- oldAgentLogin(
5555- password: string,
5656- twoFactorCode?: string | null,
5757- pdsUrl?: string | null,
5858- ): Promise<void>
5959- /**
6060- * Gets the missing blobs from the old PDS and uploads them to the current PDS
6161- * @param statusUpdateHandler {function} - A function to update the status of the migration. This is useful for showing the user the progress of the migration
6262- * @returns {Promise<{accountStatus: OutputSchema, missingBlobsCount: number}>}
6363- */
6464- migrateMissingBlobs(statusUpdateHandler: Function): Promise<{
6565- accountStatus: OutputSchema
6666- missingBlobsCount: number
6767- }>
55+ /**
66+ * The user's current PDS agent
77+ * @type {AtpAgent}
88+ */
99+ currentPdsAgent: AtpAgent;
1010+ /**
1111+ * The user's old PDS agent
1212+ * @type {AtpAgent}
1313+ */
1414+ oldPdsAgent: AtpAgent;
1515+ /**
1616+ * the user's did
1717+ * @type {string|null}
1818+ */
1919+ did: string | null;
2020+ /**
2121+ * The user's current PDS url
2222+ * @type {null}
2323+ */
2424+ currentPdsUrl: any;
2525+ /**
2626+ * A list of the missing cids blobs from the old PDS. In this case if a retry upload fails it gets put in this array for the ui
2727+ * @type {string[]}
2828+ */
2929+ missingBlobs: string[];
3030+ /**
3131+ * Logs the user into the current PDS and gets the account status
3232+ * @param handle {string}
3333+ * @param password {string}
3434+ * @param twoFactorCode {string|null}
3535+ * @returns {Promise<{accountStatus: OutputSchema, missingBlobsCount: number}>}
3636+ */
3737+ currentAgentLogin(handle: string, password: string, twoFactorCode?: string | null): Promise<{
3838+ accountStatus: OutputSchema;
3939+ missingBlobsCount: number;
4040+ }>;
4141+ /**
4242+ * Logs into the old PDS and gets the account status.
4343+ * Does not need a handle
4444+ * since it is assumed the user has already logged in with the current PDS and we are using their did
4545+ * @param password {string}
4646+ * @param twoFactorCode {string|null}
4747+ * @param pdsUrl {string|null} - If you know the url of the old PDS you can pass it in here. If not it will be guessed at from plc ops
4848+ * @returns {Promise<void>}
4949+ */
5050+ oldAgentLogin(password: string, twoFactorCode?: string | null, pdsUrl?: string | null): Promise<void>;
5151+ /**
5252+ * Gets the missing blobs from the old PDS and uploads them to the current PDS
5353+ * @param statusUpdateHandler {function} - A function to update the status of the migration. This is useful for showing the user the progress of the migration
5454+ * @returns {Promise<{accountStatus: OutputSchema, missingBlobsCount: number}>}
5555+ */
5656+ migrateMissingBlobs(statusUpdateHandler: Function): Promise<{
5757+ accountStatus: OutputSchema;
5858+ missingBlobsCount: number;
5959+ }>;
6860}
6969-import { AtpAgent } from '@atproto/api'
7070-//# sourceMappingURL=missingBlobs.d.ts.map
6161+import { AtpAgent } from '@atproto/api';
6262+//# sourceMappingURL=missingBlobs.d.ts.map
···33 * On pdsmoover.com this is the logic for the MOOver
44 */
55export class Migrator {
66- /** @type {AtpAgent} */
77- oldAgent: AtpAgent
88- /** @type {AtpAgent} */
99- newAgent: AtpAgent
1010- /** @type {[string]} */
1111- missingBlobs: [string]
1212- /** @type {boolean} */
1313- createNewAccount: boolean
1414- /** @type {boolean} */
1515- migrateRepo: boolean
1616- /** @type {boolean} */
1717- migrateBlobs: boolean
1818- /** @type {boolean} */
1919- migrateMissingBlobs: boolean
2020- /** @type {boolean} */
2121- migratePrefs: boolean
2222- /** @type {boolean} */
2323- migratePlcRecord: boolean
2424- /**
2525- * This migrator is pretty cut and dry and makes a few assumptions
2626- * 1. You are using the same password between each account
2727- * 2. If this command fails for something like oauth 2fa code it throws an error and expects the same values when ran again.
2828- * 3. You can control which "actions" happen by setting the class variables to false.
2929- * 4. Each instance of the class is assumed to be for a single migration
3030- * @param {string} oldHandle - The handle you use on your old pds, something like alice.bsky.social
3131- * @param {string} password - Your password for your current login. Has to be your real password, no app password. When setting up a new account we reuse it as well for that account
3232- * @param {string} newPdsUrl - The new URL for your pds. Like https://coolnewpds.com
3333- * @param {string} newEmail - The email you want to use on the new pds (can be the same as the previous one as long as it's not already being used on the new pds)
3434- * @param {string} newHandle - The new handle you want, like alice.bsky.social, or if you already have a domain name set as a handle can use it myname.com.
3535- * @param {string|null} inviteCode - The invite code you got from the PDS you are migrating to. If null does not include one
3636- * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI. Like (status) => console.log(status)
3737- * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required
3838- * @param verificationCode - Optional verification captcha code for account creation if the PDS requires it
3939- */
4040- migrate(
4141- oldHandle: string,
4242- password: string,
4343- newPdsUrl: string,
4444- newEmail: string,
4545- newHandle: string,
4646- inviteCode: string | null,
4747- statusUpdateHandler?: Function | null,
4848- twoFactorCode?: string | null,
4949- verificationCode?: any,
5050- ): Promise<void>
5151- /**
5252- * Sign and submits the PLC operation to officially migrate the account
5353- * @param {string} token - the PLC token sent in the email. If you're just wanting to run this rerun migrate with all the flags set as false except for migratePlcRecord
5454- * @param additionalRotationKeysToAdd {string[]} - additional rotation keys to add in addition to the ones provided by the new PDS.
5555- * @returns {Promise<void>}
5656- */
5757- signPlcOperation(token: string, additionalRotationKeysToAdd?: string[]): Promise<void>
5858- /**
5959- * Using this method assumes the Migrator class was constructed new and this was called.
6060- * Find the user's previous PDS from the PLC op logs,
6161- * logs in and deactivates their old account if it was found still active.
6262- *
6363- * @param oldHandle {string}
6464- * @param oldPassword {string}
6565- * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI.
6666- * Like (status) => console.log(status)
6767- * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required
6868- * @returns {Promise<void>}
6969- */
7070- deactivateOldAccount(
7171- oldHandle: string,
7272- oldPassword: string,
7373- statusUpdateHandler?: Function | null,
7474- twoFactorCode?: string | null,
7575- ): Promise<void>
7676- /**
7777- * Signs the logged-in user in this.newAgent for backups with PDS MOOver. This is usually called after migrate and signPlcOperation are successful
7878- *
7979- * @param {string} didWeb
8080- * @returns {Promise<void>}
8181- */
8282- signUpForBackupsFromMigration(didWeb?: string): Promise<void>
66+ /** @type {AtpAgent} */
77+ oldAgent: AtpAgent;
88+ /** @type {AtpAgent} */
99+ newAgent: AtpAgent;
1010+ /** @type {[string]} */
1111+ missingBlobs: [string];
1212+ /** @type {boolean} */
1313+ createNewAccount: boolean;
1414+ /** @type {boolean} */
1515+ migrateRepo: boolean;
1616+ /** @type {boolean} */
1717+ migrateBlobs: boolean;
1818+ /** @type {boolean} */
1919+ migrateMissingBlobs: boolean;
2020+ /** @type {boolean} */
2121+ migratePrefs: boolean;
2222+ /** @type {boolean} */
2323+ migratePlcRecord: boolean;
2424+ /**
2525+ * How many blobs have been uploaded to the new PDS in the current step
2626+ @type {number} */
2727+ uploadedBlobsCount: number;
2828+ /**
2929+ * Uploads blobs to the new PDS
3030+ * @param {AtpAgent} oldAgent
3131+ * @param {AtpAgent} newAgent
3232+ * @param {string} usersDid
3333+ * @param {[string]} cids
3434+ * @param {number} totalBlobs
3535+ * @param {function|null} statusUpdateHandler
3636+ */
3737+ uploadBlobs(oldAgent: AtpAgent, newAgent: AtpAgent, usersDid: string, cids: [string], totalBlobs: number, statusUpdateHandler: Function | null): Promise<void>;
3838+ /**
3939+ * This migrator is pretty cut and dry and makes a few assumptions
4040+ * 1. You are using the same password between each account
4141+ * 2. If this command fails for something like oauth 2fa code it throws an error and expects the same values when ran again.
4242+ * 3. You can control which "actions" happen by setting the class variables to false.
4343+ * 4. Each instance of the class is assumed to be for a single migration
4444+ * @param {string} oldHandle - The handle you use on your old pds, something like alice.bsky.social
4545+ * @param {string} password - Your password for your current login. Has to be your real password, no app password. When setting up a new account we reuse it as well for that account
4646+ * @param {string} newPdsUrl - The new URL for your pds. Like https://coolnewpds.com
4747+ * @param {string} newEmail - The email you want to use on the new pds (can be the same as the previous one as long as it's not already being used on the new pds)
4848+ * @param {string} newHandle - The new handle you want, like alice.bsky.social, or if you already have a domain name set as a handle can use it myname.com.
4949+ * @param {string|null} inviteCode - The invite code you got from the PDS you are migrating to. If null does not include one
5050+ * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI. Like (status) => console.log(status)
5151+ * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required
5252+ * @param verificationCode - Optional verification captcha code for account creation if the PDS requires it
5353+ */
5454+ migrate(oldHandle: string, password: string, newPdsUrl: string, newEmail: string, newHandle: string, inviteCode: string | null, statusUpdateHandler?: Function | null, twoFactorCode?: string | null, verificationCode?: any): Promise<void>;
5555+ /**
5656+ * Sign and submits the PLC operation to officially migrate the account
5757+ * @param {string} token - the PLC token sent in the email. If you're just wanting to run this rerun migrate with all the flags set as false except for migratePlcRecord
5858+ * @param additionalRotationKeysToAdd {string[]} - additional rotation keys to add in addition to the ones provided by the new PDS.
5959+ * @returns {Promise<void>}
6060+ */
6161+ signPlcOperation(token: string, additionalRotationKeysToAdd?: string[]): Promise<void>;
6262+ /**
6363+ * Using this method assumes the Migrator class was constructed new and this was called.
6464+ * Find the user's previous PDS from the PLC op logs,
6565+ * logs in and deactivates their old account if it was found still active.
6666+ *
6767+ * @param oldHandle {string}
6868+ * @param oldPassword {string}
6969+ * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI.
7070+ * Like (status) => console.log(status)
7171+ * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required
7272+ * @returns {Promise<void>}
7373+ */
7474+ deactivateOldAccount(oldHandle: string, oldPassword: string, statusUpdateHandler?: Function | null, twoFactorCode?: string | null): Promise<void>;
7575+ /**
7676+ * Signs the logged-in user in this.newAgent for backups with PDS MOOver. This is usually called after migrate and signPlcOperation are successful
7777+ *
7878+ * @param {string} didWeb
7979+ * @returns {Promise<void>}
8080+ */
8181+ signUpForBackupsFromMigration(didWeb?: string): Promise<void>;
8382}
8484-import { AtpAgent } from '@atproto/api'
8585-//# sourceMappingURL=pdsmoover.d.ts.map
8383+import { AtpAgent } from '@atproto/api';
8484+//# sourceMappingURL=pdsmoover.d.ts.map
···11/**
22 * JSDoc type-only import to avoid runtime import errors in the browser.
33 */
44-export type defs = typeof defs
44+export type defs = typeof defs;
55/**
66 * JSDoc type-only import to avoid runtime import errors in the browser.
77 */
88-export type normalizeOp = any
88+export type normalizeOp = any;
99/**
1010 * JSDoc type-only import to avoid runtime import errors in the browser.
1111 */
1212-export type Operation = import('@atcute/did-plc').Operation
1212+export type Operation = import("@atcute/did-plc").Operation;
1313/**
1414 * JSDoc type-only import to avoid runtime import errors in the browser.
1515 */
1616-export type CompatibleOperation = import('@atcute/did-plc').CompatibleOperation
1616+export type CompatibleOperation = import("@atcute/did-plc").CompatibleOperation;
1717/**
1818 * JSDoc type-only import to avoid runtime import errors in the browser.
1919 */
2020-export type IndexedEntryLog = import('@atcute/did-plc').IndexedEntryLog
2020+export type IndexedEntryLog = import("@atcute/did-plc").IndexedEntryLog;
2121/**
2222 * JSDoc type-only import to avoid runtime import errors in the browser.
2323 */
2424-export type IndexedEntry = import('@atcute/did-plc').IndexedEntry
2424+export type IndexedEntry = import("@atcute/did-plc").IndexedEntry;
2525/**
2626 * Class to help with various PLC operations
2727 */
2828export class PlcOps {
2929- /**
3030- *
3131- * @param plcDirectoryUrl {string} - The url of the plc directory, defaults to https://plc.directory
3232- */
3333- constructor(plcDirectoryUrl?: string)
3434- /**
3535- * The url of the plc directory
3636- * @type {string}
3737- */
3838- plcDirectoryUrl: string
3939- /**
4040- * Gets the current rotation keys for a user via their last PlC operation
4141- * @param did
4242- * @returns {Promise<string[]>}
4343- */
4444- getCurrentRotationKeysForUser(did: any): Promise<string[]>
4545- /**
4646- * Gets the last PlC operation for a user from the plc directory
4747- * @param did
4848- * @returns {Promise<{lastOperation: Operation, base: any}>}
4949- */
5050- getLastPlcOpFromPlc(did: any): Promise<{
5151- lastOperation: Operation
5252- base: any
5353- }>
5454- /**
5555- *
5656- * @param logs {IndexedEntryLog}
5757- * @returns {{lastOperation: Operation, base: IndexedEntry}}
5858- */
5959- getLastPlcOp(logs: IndexedEntryLog): {
6060- lastOperation: Operation
6161- base: IndexedEntry
6262- }
6363- /**
6464- * Gets the plc audit logs for a user from the plc directory
6565- * @param did
6666- * @returns {Promise<IndexedEntryLog>}
6767- */
6868- getPlcAuditLogs(did: any): Promise<IndexedEntryLog>
6969- /**
7070- * Creates a new secp256k1 key that can be used for either rotation or verification key
7171- * @returns {Promise<{privateKey: string, publicKey: `did:key:${string}`}>}
7272- */
7373- createANewSecp256k1(): Promise<{
7474- privateKey: string
7575- publicKey: `did:key:${string}`
7676- }>
7777- /**
7878- * Signs a new operation with the provided signing key, and information and submits it to the plc directory
7979- * @param did {string} - The user's did
8080- * @param signingRotationKey { P256PrivateKey|Secp256k1PrivateKey} - The keypair to sign the op with
8181- * @param alsoKnownAs {string[]}
8282- * @param rotationKeys {string[]}
8383- * @param pds {string}
8484- * @param verificationKey {string} - The public verification key
8585- * @param prev {string} - The previous valid operation's cid.
8686- * @returns {Promise<void>}
8787- */
8888- signAndPublishNewOp(
8989- did: string,
9090- signingRotationKey: P256PrivateKey | Secp256k1PrivateKey,
9191- alsoKnownAs: string[],
9292- rotationKeys: string[],
9393- pds: string,
9494- verificationKey: string,
9595- prev: string,
9696- ): Promise<void>
9797- /**
9898- * Takes a multi or hex based private key and returns a keypair
9999- * @param privateKeyString {string}
100100- * @param type {string} - secp256k1 or p256, needed if the private key is hex based, can be assumed if it's a multikey
101101- * @returns {Promise<{type: string, didPublicKey: `did:key:${string}`, keypair: P256PrivateKey|Secp256k1PrivateKey}>}
102102- */
103103- getKeyPair(
104104- privateKeyString: string,
105105- type?: string,
106106- ): Promise<{
107107- type: string
108108- didPublicKey: `did:key:${string}`
109109- keypair: P256PrivateKey | Secp256k1PrivateKey
110110- }>
111111- /**
112112- * Submits a new operation to the plc directory
113113- * @param did {string} - The user's did
114114- * @param operation
115115- * @returns {Promise<void>}
116116- */
117117- pushPlcOperation(did: string, operation: any): Promise<void>
118118- /**
119119- * Creates a new service auth token for a user. This is what is used to create a new account on a PDS for your did
120120- *
121121- * @param iss The user's did
122122- * @param aud The did:web, if it's a PDS it's usually from /xrpc/com.atproto.server.describeServer
123123- * @param keypair The keypair to sign with only supporting ES256K atm
124124- * @param lxm The lxm which is usually com.atproto.server.createAccount for creating a new account
125125- * @returns {Promise<string>}
126126- */
127127- createANewServiceAuthToken(iss: any, aud: any, keypair: any, lxm: any): Promise<string>
2929+ /**
3030+ *
3131+ * @param plcDirectoryUrl {string} - The url of the plc directory, defaults to https://plc.directory
3232+ */
3333+ constructor(plcDirectoryUrl?: string);
3434+ /**
3535+ * The url of the plc directory
3636+ * @type {string}
3737+ */
3838+ plcDirectoryUrl: string;
3939+ /**
4040+ * Gets the current rotation keys for a user via their last PlC operation
4141+ * @param did
4242+ * @returns {Promise<string[]>}
4343+ */
4444+ getCurrentRotationKeysForUser(did: any): Promise<string[]>;
4545+ /**
4646+ * Gets the last PlC operation for a user from the plc directory
4747+ * @param did
4848+ * @returns {Promise<{lastOperation: Operation, base: any}>}
4949+ */
5050+ getLastPlcOpFromPlc(did: any): Promise<{
5151+ lastOperation: Operation;
5252+ base: any;
5353+ }>;
5454+ /**
5555+ *
5656+ * @param logs {IndexedEntryLog}
5757+ * @returns {{lastOperation: Operation, base: IndexedEntry}}
5858+ */
5959+ getLastPlcOp(logs: IndexedEntryLog): {
6060+ lastOperation: Operation;
6161+ base: IndexedEntry;
6262+ };
6363+ /**
6464+ * Gets the plc audit logs for a user from the plc directory
6565+ * @param did
6666+ * @returns {Promise<IndexedEntryLog>}
6767+ */
6868+ getPlcAuditLogs(did: any): Promise<IndexedEntryLog>;
6969+ /**
7070+ * Creates a new secp256k1 key that can be used for either rotation or verification key
7171+ * @returns {Promise<{privateKey: string, publicKey: `did:key:${string}`}>}
7272+ */
7373+ createANewSecp256k1(): Promise<{
7474+ privateKey: string;
7575+ publicKey: `did:key:${string}`;
7676+ }>;
7777+ /**
7878+ * Signs a new operation with the provided signing key, and information and submits it to the plc directory
7979+ * @param did {string} - The user's did
8080+ * @param signingRotationKey { P256PrivateKey|Secp256k1PrivateKey} - The keypair to sign the op with
8181+ * @param alsoKnownAs {string[]}
8282+ * @param rotationKeys {string[]}
8383+ * @param pds {string}
8484+ * @param verificationKey {string} - The public verification key
8585+ * @param prev {string} - The previous valid operation's cid.
8686+ * @returns {Promise<void>}
8787+ */
8888+ signAndPublishNewOp(did: string, signingRotationKey: P256PrivateKey | Secp256k1PrivateKey, alsoKnownAs: string[], rotationKeys: string[], pds: string, verificationKey: string, prev: string): Promise<void>;
8989+ /**
9090+ * Takes a multi or hex based private key and returns a keypair
9191+ * @param privateKeyString {string}
9292+ * @param type {string} - secp256k1 or p256, needed if the private key is hex based, can be assumed if it's a multikey
9393+ * @returns {Promise<{type: string, didPublicKey: `did:key:${string}`, keypair: P256PrivateKey|Secp256k1PrivateKey}>}
9494+ */
9595+ getKeyPair(privateKeyString: string, type?: string): Promise<{
9696+ type: string;
9797+ didPublicKey: `did:key:${string}`;
9898+ keypair: P256PrivateKey | Secp256k1PrivateKey;
9999+ }>;
100100+ /**
101101+ * Submits a new operation to the plc directory
102102+ * @param did {string} - The user's did
103103+ * @param operation
104104+ * @returns {Promise<void>}
105105+ */
106106+ pushPlcOperation(did: string, operation: any): Promise<void>;
107107+ /**
108108+ * Creates a new service auth token for a user. This is what is used to create a new account on a PDS for your did
109109+ *
110110+ * @param iss The user's did
111111+ * @param aud The did:web, if it's a PDS it's usually from /xrpc/com.atproto.server.describeServer
112112+ * @param keypair The keypair to sign with only supporting ES256K atm
113113+ * @param lxm The lxm which is usually com.atproto.server.createAccount for creating a new account
114114+ * @returns {Promise<string>}
115115+ */
116116+ createANewServiceAuthToken(iss: any, aud: any, keypair: any, lxm: any): Promise<string>;
128117}
129129-import { defs } from '@atcute/did-plc'
130130-import { P256PrivateKey } from '@atcute/crypto'
131131-import { Secp256k1PrivateKey } from '@atcute/crypto'
132132-//# sourceMappingURL=plc-ops.d.ts.map
118118+import { defs } from '@atcute/did-plc';
119119+import { P256PrivateKey } from '@atcute/crypto';
120120+import { Secp256k1PrivateKey } from '@atcute/crypto';
121121+//# sourceMappingURL=plc-ops.d.ts.map
···11-export type Operation = import('@atcute/did-plc').Operation
11+export type Operation = import("@atcute/did-plc").Operation;
22export class Restore {
33- /**
44- *
55- * @param pdsMooverInstance {string} - The url of the pds moover instance to restore from. Defaults to https://pdsmover.com
66- */
77- constructor(pdsMooverInstance?: string)
88- /**
99- * If you want to use a different plc directory create your own instance of the plc ops class and pass it in here
1010- * @type {PlcOps} */
1111- plcOps: PlcOps
1212- /**
1313- * This is the base url for the pds moover instance used to restore the files from a backup.
1414- * @type {string}
1515- */
1616- pdsMooverInstance: string
1717- /**
1818- * To keep it simple, only uses secp256k for the temp verification key that is used to create the new account on the new PDS
1919- * and is temporarily assigned to the user's account on PLC
2020- * @type {null|Secp256k1PrivateKeyExportable}
2121- */
2222- tempVerificationKeypair: null | Secp256k1PrivateKeyExportable
2323- /** @type {AtpAgent} */
2424- atpAgent: AtpAgent
2525- /**
2626- * The keypair that is used to sign the plc operation
2727- * @type {null|{type: string, didPublicKey: `did:key:${string}`, keypair: P256PrivateKey|Secp256k1PrivateKey}}
2828- */
2929- recoveryRotationKeyPair: null | {
3030- type: string
3131- didPublicKey: `did:key:${string}`
3232- keypair: P256PrivateKey | Secp256k1PrivateKey
3333- }
3434- /**
3535- * If this is true we are just restoring the repo and blobs. Ideally for rerunning a restore process after account recovery
3636- * @type {boolean}
3737- */
3838- RestoreFromBackup: boolean
3939- /**
4040- * If set to true then it will do the account recovery. Writes a temp key to the did doc,
4141- * create a new account on the new pds, and then submit a new plc op for the pds to have control (finishes the migration, can always restore the backup later)
4242- * @type {boolean}
4343- */
4444- AccountRecovery: boolean
4545- /**
4646- * Recovers an account with the users rotation key and restores the repo from a PDS MOOver backup
4747- * This method can fail, and the account was still recovered, it's best to check the PLC logs to see where an account stands before reruns
4848- * @param rotationKey {string} - The users private rotation key, can be a multi key or hex key
4949- * @param rotationKeyType {string} - The type of the key, secp256k1 or p256. Required if the key is in hex format, defaults to secp256k1
5050- * @param currentHandleOrDid {string} - The users current handle or did, if they don't have a DNS record it will have to be their did for success
5151- * @param newPDS {string} - The new PDS url, like https://coolnewpds.com
5252- * @param newHandle {string} - Can be the users DNS handle if it is already setup with their did, if not it's bob.mypds.com
5353- * @param newPassword {string} - The new password for the new account
5454- * @param newEmail {string} - The new email for the new account
5555- * @param inviteCode {string|null} - The invite code for the new PDS if it requires one
5656- * @param cidToRestoreTo {string|null} - The cid of the plc op to restore to, used mostly to revert a fraudulent plc op. Want to give it the last valid operations cid
5757- * @param onStatus {function|null} - A function that takes a string used to update the UI. Like (status) => console.log(status)
5858- * @returns {Promise<void>} If there is a failure during restoring the back up (after the status Success! Restoring your repo...) then your account is most likely
5959- * recovered and future runs need to have the RestoreFromBackup flag set to true and AccountRecovery set to false.
6060- */
6161- recover(
6262- rotationKey: string,
6363- rotationKeyType: string,
6464- currentHandleOrDid: string,
6565- newPDS: string,
6666- newHandle: string,
6767- newPassword: string,
6868- newEmail: string,
6969- inviteCode: string | null,
7070- cidToRestoreTo?: string | null,
7171- onStatus?: Function | null,
7272- ): Promise<void>
7373- /**
7474- * This method signs the plc operation over to the new PDS and activates the account
7575- * Assumes you have already created a new account during the recovery process and logged in
7676- * Uses the recommended did doc from the PDS as a base and adds the users rotation key to the rotation keys array
7777- *
7878- * @param usersDid
7979- * @param additionalRotationKeysToAdd
8080- * @param prevCid
8181- * @returns {Promise<void>}
8282- */
8383- signRestorePlcOperation(
8484- usersDid: any,
8585- additionalRotationKeysToAdd: any[],
8686- prevCid: any,
8787- ): Promise<void>
33+ /**
44+ *
55+ * @param pdsMooverInstance {string} - The url of the pds moover instance to restore from. Defaults to https://pdsmover.com
66+ */
77+ constructor(pdsMooverInstance?: string);
88+ /**
99+ * If you want to use a different plc directory create your own instance of the plc ops class and pass it in here
1010+ * @type {PlcOps} */
1111+ plcOps: PlcOps;
1212+ /**
1313+ * This is the base url for the pds moover instance used to restore the files from a backup.
1414+ * @type {string}
1515+ */
1616+ pdsMooverInstance: string;
1717+ /**
1818+ * To keep it simple, only uses secp256k for the temp verification key that is used to create the new account on the new PDS
1919+ * and is temporarily assigned to the user's account on PLC
2020+ * @type {null|Secp256k1PrivateKeyExportable}
2121+ */
2222+ tempVerificationKeypair: null | Secp256k1PrivateKeyExportable;
2323+ /** @type {AtpAgent} */
2424+ atpAgent: AtpAgent;
2525+ /**
2626+ * The keypair that is used to sign the plc operation
2727+ * @type {null|{type: string, didPublicKey: `did:key:${string}`, keypair: P256PrivateKey|Secp256k1PrivateKey}}
2828+ */
2929+ recoveryRotationKeyPair: null | {
3030+ type: string;
3131+ didPublicKey: `did:key:${string}`;
3232+ keypair: P256PrivateKey | Secp256k1PrivateKey;
3333+ };
3434+ /**
3535+ * If this is true we are just restoring the repo and blobs. Ideally for rerunning a restore process after account recovery
3636+ * @type {boolean}
3737+ */
3838+ RestoreFromBackup: boolean;
3939+ /**
4040+ * If set to true then it will do the account recovery. Writes a temp key to the did doc,
4141+ * create a new account on the new pds, and then submit a new plc op for the pds to have control (finishes the migration, can always restore the backup later)
4242+ * @type {boolean}
4343+ */
4444+ AccountRecovery: boolean;
4545+ /**
4646+ * Recovers an account with the users rotation key and restores the repo from a PDS MOOver backup
4747+ * This method can fail, and the account was still recovered, it's best to check the PLC logs to see where an account stands before reruns
4848+ * @param rotationKey {string} - The users private rotation key, can be a multi key or hex key
4949+ * @param rotationKeyType {string} - The type of the key, secp256k1 or p256. Required if the key is in hex format, defaults to secp256k1
5050+ * @param currentHandleOrDid {string} - The users current handle or did, if they don't have a DNS record it will have to be their did for success
5151+ * @param newPDS {string} - The new PDS url, like https://coolnewpds.com
5252+ * @param newHandle {string} - Can be the users DNS handle if it is already setup with their did, if not it's bob.mypds.com
5353+ * @param newPassword {string} - The new password for the new account
5454+ * @param newEmail {string} - The new email for the new account
5555+ * @param inviteCode {string|null} - The invite code for the new PDS if it requires one
5656+ * @param cidToRestoreTo {string|null} - The cid of the plc op to restore to, used mostly to revert a fraudulent plc op. Want to give it the last valid operations cid
5757+ * @param onStatus {function|null} - A function that takes a string used to update the UI. Like (status) => console.log(status)
5858+ * @returns {Promise<void>} If there is a failure during restoring the back up (after the status Success! Restoring your repo...) then your account is most likely
5959+ * recovered and future runs need to have the RestoreFromBackup flag set to true and AccountRecovery set to false.
6060+ */
6161+ recover(rotationKey: string, rotationKeyType: string, currentHandleOrDid: string, newPDS: string, newHandle: string, newPassword: string, newEmail: string, inviteCode: string | null, cidToRestoreTo?: string | null, onStatus?: Function | null): Promise<void>;
6262+ /**
6363+ * This method signs the plc operation over to the new PDS and activates the account
6464+ * Assumes you have already created a new account during the recovery process and logged in
6565+ * Uses the recommended did doc from the PDS as a base and adds the users rotation key to the rotation keys array
6666+ *
6767+ * @param usersDid
6868+ * @param additionalRotationKeysToAdd
6969+ * @param prevCid
7070+ * @returns {Promise<void>}
7171+ */
7272+ signRestorePlcOperation(usersDid: any, additionalRotationKeysToAdd: any[], prevCid: any): Promise<void>;
8873}
8989-import { PlcOps } from './plc-ops.js'
9090-import { Secp256k1PrivateKeyExportable } from '@atcute/crypto'
9191-import { AtpAgent } from '@atproto/api'
9292-import { P256PrivateKey } from '@atcute/crypto'
9393-import { Secp256k1PrivateKey } from '@atcute/crypto'
9494-//# sourceMappingURL=restore.d.ts.map
7474+import { PlcOps } from './plc-ops.js';
7575+import { Secp256k1PrivateKeyExportable } from '@atcute/crypto';
7676+import { AtpAgent } from '@atproto/api';
7777+import { P256PrivateKey } from '@atcute/crypto';
7878+import { Secp256k1PrivateKey } from '@atcute/crypto';
7979+//# sourceMappingURL=restore.d.ts.map