///
import * as Bluebird from 'bluebird';
import { BitGo } from '../bitgo';
import { BaseCoin, KeyPair } from './baseCoin';
import { NodeCallback } from './types';
import { Wallet } from './wallet';
import { RequestTracer } from './internal/util';
export interface Keychain {
id: string;
pub: string;
prv?: string;
provider?: string;
encryptedPrv?: string;
derivationPath?: string;
derivedFromParentWithSeed?: string;
}
export interface ChangedKeychains {
[pubkey: string]: string;
}
export interface ListKeychainsResult {
keys: Keychain[];
nextBatchPrevId?: string;
}
export interface GetKeychainOptions {
id: string;
xpub?: string;
ethAddress?: string;
reqId?: RequestTracer;
}
export interface ListKeychainOptions {
limit?: number;
prevId?: string;
}
export interface UpdatePasswordOptions {
oldPassword: string;
newPassword: string;
}
interface UpdateSingleKeychainPasswordOptions {
keychain?: Keychain;
oldPassword?: string;
newPassword?: string;
}
interface AddKeychainOptions {
pub?: string;
encryptedPrv?: string;
type?: string;
source?: string;
originalPasscodeEncryptionCode?: string;
enterprise?: string;
derivedFromParentWithSeed?: any;
disableKRSEmail?: boolean;
provider?: string;
reqId?: RequestTracer;
krsSpecific?: any;
}
export interface CreateBackupOptions {
provider?: string;
source?: string;
disableKRSEmail?: boolean;
krsSpecific?: any;
type?: string;
reqId?: RequestTracer;
}
interface CreateBitGoOptions {
source?: 'bitgo';
enterprise?: string;
reqId?: RequestTracer;
}
interface GetKeysForSigningOptions {
reqId?: RequestTracer;
wallet?: Wallet;
}
export declare enum KeyIndices {
USER = 0,
BACKUP = 1,
BITGO = 2
}
export declare class Keychains {
private readonly bitgo;
private readonly baseCoin;
constructor(bitgo: BitGo, baseCoin: BaseCoin);
/**
* Get a keychain by ID
* @param params
* @param params.id
* @param params.xpub (optional)
* @param params.ethAddress (optional)
* @param params.reqId (optional)
* @param callback
*/
get(params: GetKeychainOptions, callback?: NodeCallback): Bluebird;
/**
* list the users keychains
* @param params
* @param params.limit - Max number of results in a single call.
* @param params.prevId - Continue iterating (provided by nextBatchPrevId in the previous list)
* @param callback
* @returns {*}
*/
list(params?: ListKeychainOptions, callback?: NodeCallback): Bluebird;
/**
* Change the decryption password for all possible keychains associated with a user.
*
* This function iterates through all keys associated with the user, decrypts
* them with the old password and re-encrypts them with the new password.
*
* This should be called when a user changes their login password, and are expecting
* that their wallet passwords are changed to match the new login password.
*
* @param params
* @param params.oldPassword - The old password used for encrypting the key
* @param params.newPassword - The new password to be used for encrypting the key
* @param callback
* @returns changedKeys Object - e.g.:
* {
* xpub1: encryptedPrv,
* ...
* }
*/
updatePassword(params: UpdatePasswordOptions, callback?: NodeCallback): Bluebird;
/**
* Update the password used to decrypt a single keychain
* @param params
* @param params.keychain - The keychain whose password should be updated
* @param params.oldPassword - The old password used for encrypting the key
* @param params.newPassword - The new password to be used for encrypting the key
* @returns {object}
*/
updateSingleKeychainPassword(params?: UpdateSingleKeychainPasswordOptions): Keychain;
/**
* Create a public/private key pair
* @param params.seed
*/
create(params?: {
seed?: Buffer;
}): KeyPair;
/**
* Add a keychain to BitGo's records
* @param params
* @param callback
*/
add(params?: AddKeychainOptions, callback?: NodeCallback): Bluebird;
/**
* Create a BitGo key
* @param params (empty)
* @param callback
*/
createBitGo(params?: CreateBitGoOptions, callback?: NodeCallback): Bluebird;
/**
* Create a backup key
* @param params
* @param params.provider (optional)
* @param callback
*/
createBackup(params?: CreateBackupOptions, callback?: NodeCallback): Bluebird;
/**
* Gets keys for signing from a wallet
* @param params
* @param callback
* @returns {Bluebird[]}
*/
getKeysForSigning(params?: GetKeysForSigningOptions, callback?: NodeCallback): Bluebird;
}
export {};
//# sourceMappingURL=keychains.d.ts.map