///
import type { ec } from 'elliptic';
import { IStorageSuite } from './storage';
export interface IAccountMethods {
signTransaction: >(tx: T) => Promise;
sign(data: string): Buffer;
encrypt(password: string, options?: Record): Promise;
}
export interface IAccountProvider {
privateKeyToAccount: (privateKey: string) => T;
create: () => T;
decrypt: (keystore: IKeyStore, password: string, options?: Record) => Promise;
}
export interface IBlockchainWallet {
BIP44Path: string;
address: string;
childWallet: IBlockchainWallet | string;
keyPair: ec.KeyPair;
mnemonic: string;
privateKey: string;
}
export interface IBaseWalletAccount extends IAccountMethods {
[key: string]: unknown;
readonly wallet: IBlockchainWallet;
readonly address: string;
readonly privateKey: string;
}
export interface IBaseWallet {
create(numberOfAccounts: number): this;
add(account: T | string): this;
get(addressOrIndex: string | number): T | undefined;
remove(addressOrIndex: string | number): boolean;
clear(): this;
encrypt(password: string, options?: Record): Promise;
decrypt(encryptedWallets: IKeyStore[], password: string, options?: Record): Promise;
save(password: string, keyName?: string): Promise;
load(password: string, keyName?: string): Promise;
}
export interface IDIDBaseWallet {
create(): this;
save(password: string, keyName?: string): Promise;
load(password: string, keyName?: string): Promise;
}
export declare abstract class BaseWalletFactory extends Array {
protected readonly _accountProvider: IAccountProvider;
protected readonly _storage?: IStorageSuite;
constructor(accountProvider: IAccountProvider, storage?: IStorageSuite);
}
export declare abstract class BaseWallet extends BaseWalletFactory implements IBaseWallet {
abstract create(numberOfAccounts: number): this;
abstract add(account: T | string): this;
abstract get(addressOrIndex: string | number): T | undefined;
abstract remove(addressOrIndex: string | number): boolean;
abstract clear(): this;
abstract encrypt(password: string, options?: Record): Promise;
abstract decrypt(encryptedWallets: IKeyStore[], password: string, options?: Record): Promise;
abstract save(password: string, keyName?: string): Promise;
abstract load(password: string, keyName?: string): Promise;
}
interface ICrypto {
cipher: string;
cipherparams: {
iv: string;
};
ciphertext: string;
kdf: string;
kdfparams: {
dklen: number;
n: number;
r: number;
p: number;
salt: string;
};
mac: string;
mnemonicEncrypted: string;
}
export interface IKeyStore {
version: number;
type: string;
nickName?: string;
address: string;
crypto: ICrypto;
}
export interface ISignature {
signature: Buffer;
}
export {};