@planetarium/account-web3-secret-storage
Version:
Libplanet account implementation using Ethereum Web3 Secret Storage
28 lines (27 loc) • 1.39 kB
TypeScript
import { KeyId } from "./KeyId.js";
import { PassphraseEntry } from "./PassphraseEntry.js";
import { type Web3AccountOptions, Web3Account } from "./Web3Account.js";
import { type AccountDeletion, type AccountGeneration, type AccountImportation, type AccountMetadata, type AccountRetrieval, Address, type ImportableKeyStore, RawPrivateKey } from "@planetarium/account";
export { getDefaultWeb3KeyStorePath } from "#path";
export interface Web3KeyStoreOptions {
path?: string;
passphraseEntry: PassphraseEntry;
}
export declare function parseKeyFilename(name: string): undefined | {
keyId: KeyId;
createdAt?: Date;
};
export interface Web3KeyMetadata {
address?: Address;
}
export declare class Web3KeyStore implements ImportableKeyStore<KeyId, Web3Account, Web3KeyMetadata> {
#private;
readonly path: string;
constructor(options: Web3KeyStoreOptions & Partial<Web3AccountOptions>);
list(): AsyncIterable<AccountMetadata<KeyId, Web3KeyMetadata>>;
get(keyId: Readonly<KeyId>): Promise<AccountRetrieval<KeyId, Web3Account, Web3KeyMetadata>>;
generate(metadata?: Partial<Web3KeyMetadata>): Promise<AccountGeneration<KeyId, Web3Account>>;
delete(keyId: Readonly<KeyId>): Promise<AccountDeletion<KeyId>>;
import(privateKey: RawPrivateKey, metadata?: Partial<Web3KeyMetadata>): Promise<AccountImportation<KeyId>>;
}
export default Web3KeyStore;