import { Transaction } from "@digitalbits-blockchain/xdb-digitalbits-base"; import { KeyType } from "../constants/keys"; export interface BaseKey { extra?: any; path?: string; publicKey: string; network?: string; type: KeyType | string; } export interface Key extends BaseKey { id: string; privateKey: string; } export interface UnstoredKey extends BaseKey { id?: string; privateKey: string; } export interface EncryptedKey { encryptedBlob: string; encrypterName: string; id: string; salt: string; } export interface KeyMetadata { id: string; } export interface EncryptParams { key: Key; password: string; } export interface DecryptParams { encryptedKey: EncryptedKey; password: string; } export interface Encrypter { name: string; encryptKey(params: EncryptParams): Promise; decryptKey(params: DecryptParams): Promise; } export interface KeyStore { name: string; configure(data?: any): Promise; storeKeys(encryptedKeys: EncryptedKey[]): Promise; updateKeys(keys: EncryptedKey[]): Promise; loadKey(id: string): Promise; removeKey(id: string): Promise; loadAllKeys(): Promise; } export interface HandlerSignTransactionParams { transaction: Transaction; key: Key; custom?: { [key: string]: any; }; } export interface KeyTypeHandler { keyType: KeyType; signTransaction(params: HandlerSignTransactionParams): Promise; } export type AuthToken = string; export interface GetAuthTokenParams { id: string; password: string; authServer: string; authServerHomeDomains: [string]; authServerKey: string; account?: string; clientDomain?: string; onChallengeTransactionSignature?: (tx: Transaction) => Promise; }