ethers.js/packages/json-wallets/lib.esm/keystore.d.ts

34 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-05-15 01:48:48 +03:00
import { ExternallyOwnedAccount } from "@ethersproject/abstract-signer";
import { Bytes, BytesLike } from "@ethersproject/bytes";
2020-01-19 05:48:12 +03:00
import { Mnemonic } from "@ethersproject/hdnode";
2019-05-15 01:48:48 +03:00
import { Description } from "@ethersproject/properties";
2020-04-25 10:54:54 +03:00
export interface _KeystoreAccount {
2020-01-08 03:58:04 +03:00
address: string;
privateKey: string;
2020-01-19 05:48:12 +03:00
mnemonic?: Mnemonic;
2020-01-08 03:58:04 +03:00
_isKeystoreAccount: boolean;
}
export declare class KeystoreAccount extends Description<_KeystoreAccount> implements ExternallyOwnedAccount {
2019-05-15 01:48:48 +03:00
readonly address: string;
readonly privateKey: string;
2020-01-19 05:48:12 +03:00
readonly mnemonic?: Mnemonic;
2019-06-12 00:57:04 +03:00
readonly _isKeystoreAccount: boolean;
isKeystoreAccount(value: any): value is KeystoreAccount;
2019-05-15 01:48:48 +03:00
}
export declare type ProgressCallback = (percent: number) => void;
export declare type EncryptOptions = {
iv?: BytesLike;
entropy?: BytesLike;
client?: string;
salt?: BytesLike;
uuid?: string;
scrypt?: {
N?: number;
r?: number;
p?: number;
};
};
2020-02-27 22:58:05 +03:00
export declare function decryptSync(json: string, password: Bytes | string): KeystoreAccount;
2019-05-15 01:48:48 +03:00
export declare function decrypt(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise<KeystoreAccount>;
export declare function encrypt(account: ExternallyOwnedAccount, password: Bytes | string, options?: EncryptOptions, progressCallback?: ProgressCallback): Promise<string>;