mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-13 11:01:03 +00:00
Batch export patch up (#455)
* . * . * fix lint * . * change on request * .
This commit is contained in:
@@ -83,7 +83,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return pair.toJson(password);
|
||||
}
|
||||
|
||||
public async backupAccounts (addresses: string[]): Promise<KeyringPairs$Json> {
|
||||
public async backupAccounts (addresses: string[], password: string): Promise<KeyringPairs$Json> {
|
||||
const accountPromises = addresses.map((address) => {
|
||||
return new Promise<KeyringJson>((resolve) => {
|
||||
this._store.get(accountKey(address), resolve);
|
||||
@@ -93,7 +93,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
const accounts = await Promise.all(accountPromises);
|
||||
|
||||
return {
|
||||
...jsonEncrypt(stringToU8a(JSON.stringify(accounts)), ['batch-pkcs8']),
|
||||
...jsonEncrypt(stringToU8a(JSON.stringify(accounts)), ['batch-pkcs8'], password),
|
||||
accounts: accounts.map((account) => ({
|
||||
address: account.address,
|
||||
meta: account.meta
|
||||
@@ -329,8 +329,8 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return pair;
|
||||
}
|
||||
|
||||
public restoreAccounts (json: EncryptedJson): void {
|
||||
const accounts: KeyringJson[] = JSON.parse(u8aToString(jsonDecrypt(json))) as KeyringJson[];
|
||||
public restoreAccounts (json: EncryptedJson, password: string): void {
|
||||
const accounts: KeyringJson[] = JSON.parse(u8aToString(jsonDecrypt(json, password))) as KeyringJson[];
|
||||
|
||||
accounts.forEach((account) => {
|
||||
this.loadAccount(account, accountKey(account.address));
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface KeyringStruct {
|
||||
addPair: (pair: KeyringPair, password: string) => CreateResult;
|
||||
addUri: (suri: string, password?: string, meta?: KeyringPair$Meta, type?: KeypairType) => CreateResult;
|
||||
backupAccount: (pair: KeyringPair, password: string) => KeyringPair$Json;
|
||||
backupAccounts: (addresses: string[]) => Promise<KeyringPairs$Json>
|
||||
backupAccounts: (addresses: string[], password: string) => Promise<KeyringPairs$Json>
|
||||
createFromUri (suri: string, meta?: KeyringPair$Meta, type?: KeypairType): KeyringPair;
|
||||
decodeAddress: (key: string | Uint8Array) => Uint8Array;
|
||||
encodeAddress: (key: string | Uint8Array) => string;
|
||||
@@ -95,6 +95,7 @@ export interface KeyringStruct {
|
||||
isPassValid: (password: string) => boolean;
|
||||
loadAll: (options: KeyringOptions) => void;
|
||||
restoreAccount: (json: KeyringPair$Json, password: string) => KeyringPair;
|
||||
restoreAccounts: (json: EncryptedJson, password: string) => void;
|
||||
saveAccount: (pair: KeyringPair, password?: string) => KeyringPair$Json;
|
||||
saveAccountMeta: (pair: KeyringPair, meta: KeyringPair$Meta) => void;
|
||||
saveAddress: (address: string, meta: KeyringPair$Meta) => KeyringPair$Json;
|
||||
|
||||
Reference in New Issue
Block a user