import { DeletionStatus, ImportStatus, PubkeyHex, SignerDefinition } from "@lodestar/api/keymanager"; import { ProposerConfig } from "@lodestar/validator"; import { IPersistedKeysBackend, LocalKeystoreDefinition } from "./interface.js"; export { ImportStatus, DeletionStatus }; type PathArgs = { keystoresDir: string; secretsDir: string; remoteKeysDir: string; proposerDir: string; }; /** * Class to unify read+write of keystores and remoteKeys from disk. * Consumers of this class include: * - validator cmd: Read all keystores + lock them, and read all remote keys * - import cmd: Write keystores * - list cmd: Read all keystores * - keymanager importKeystores route: Write keystores + lock them * - keymanager importRemoteKeys route: Write remote keys * * This logic ensures no inconsistencies between all methods of read + write. * It also ensures that keystores lockfiles are consistent and checked in all code paths. * * NOTES: * - Keystores imported via keymanager API behave the same and import cmd end result. * - Logic to scan an external dir for keystores is the same for import cmd and validator cmd. * - lockfile locks are not explicitly released. The underlying library handles that automatically * - Imported remote key definitions are stored in a separate directory from imported keystores */ export declare class PersistedKeysBackend implements IPersistedKeysBackend { private readonly paths; constructor(paths: PathArgs); writeProposerConfig(pubkeyHex: PubkeyHex, proposerConfig: ProposerConfig | null): void; deleteProposerConfig(pubkeyHex: PubkeyHex): void; readProposerConfigs(): { [index: string]: ProposerConfig; }; deleteProposerConfigs(): void; readAllKeystores(): LocalKeystoreDefinition[]; writeKeystore({ keystoreStr, password, lockBeforeWrite, persistIfDuplicate }: { keystoreStr: string; password: string; lockBeforeWrite: boolean; persistIfDuplicate: boolean; }): boolean; /** Returns true if some component was actually deleted */ deleteKeystore(pubkey: PubkeyHex): boolean; readAllRemoteKeys(): SignerDefinition[]; writeRemoteKey({ pubkey, url, persistIfDuplicate }: { pubkey: PubkeyHex; url: string; persistIfDuplicate: boolean; }): boolean; /** Returns true if it was actually deleted */ deleteRemoteKey(pubkey: PubkeyHex): boolean; private getDefinitionPaths; private getValidatorPaths; } /** * Validate SignerDefinition from un-trusted disk file. * Performs type validation and re-maps only expected properties. */ export declare function readRemoteSignerDefinition(filepath: string): SignerDefinition; /** * Re-map all properties to ensure they are defined. * To just write `remoteSigner` is not safe since it may contain extra properties too. */ export declare function writeRemoteSignerDefinition(filepath: string, remoteSigner: SignerDefinition): void; //# sourceMappingURL=persistedKeys.d.ts.map