import type { IndexedEntry, IndexedEntryLog, Operation } from '@atcute/did-plc'; import { P256PrivateKey, Secp256k1PrivateKey } from '@atcute/crypto'; /** A private key that can sign PLC operations */ export type SigningKeypair = P256PrivateKey | Secp256k1PrivateKey; export interface KeyPairInfo { type: string; didPublicKey: `did:key:${string}`; keypair: SigningKeypair; } /** * Class to help with various PLC operations */ declare class PlcOps { /** * The url of the plc directory */ plcDirectoryUrl: string; /** * @param plcDirectoryUrl - The url of the plc directory, defaults to https://plc.directory */ constructor(plcDirectoryUrl?: string); /** * Gets the current rotation keys for a user via their last PlC operation */ getCurrentRotationKeysForUser(did: string): Promise; /** * Gets the last PlC operation for a user from the plc directory */ getLastPlcOpFromPlc(did: string): Promise<{ lastOperation: Operation; base: IndexedEntry; }>; getLastPlcOp(logs: IndexedEntryLog): { lastOperation: Operation; base: IndexedEntry; }; /** * Gets the plc audit logs for a user from the plc directory */ getPlcAuditLogs(did: string): Promise; /** * Creates a new secp256k1 key that can be used for either rotation or verification key */ createANewSecp256k1(): Promise<{ privateKey: string; publicKey: `did:key:${string}`; }>; /** * Signs a new operation with the provided signing key, and information and submits it to the plc directory * @param did - The user's did * @param signingRotationKey - The keypair to sign the op with * @param alsoKnownAs * @param rotationKeys * @param pds * @param verificationKey - The public verification key * @param prev - The previous valid operation's cid. */ signAndPublishNewOp(did: string, signingRotationKey: SigningKeypair, alsoKnownAs: string[], rotationKeys: string[], pds: string, verificationKey: string, prev: string): Promise; /** * Takes a multi or hex based private key and returns a keypair * @param privateKeyString * @param type - secp256k1 or p256, needed if the private key is hex based, can be assumed if it's a multikey */ getKeyPair(privateKeyString: string, type?: string): Promise; /** * Submits a new operation to the plc directory * @param did - The user's did * @param operation */ pushPlcOperation(did: string, operation: object): Promise; /** * 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 * * @param iss The user's did * @param aud The did:web, if it's a PDS it's usually from /xrpc/com.atproto.server.describeServer * @param keypair The keypair to sign with only supporting ES256K atm * @param lxm The lxm which is usually com.atproto.server.createAccount for creating a new account */ createANewServiceAuthToken(iss: string, aud: string, keypair: { sign(bytes: Uint8Array): Promise | Uint8Array; }, lxm: string): Promise; } export { PlcOps }; //# sourceMappingURL=plc-ops.d.ts.map