@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
104 lines (101 loc) • 2.89 kB
TypeScript
import { ExtKeyNativePtr } from "../api/ExtKeyNative";
import { BaseApi } from "./BaseApi";
export declare class ExtKey extends BaseApi {
private native;
ptr: ExtKeyNativePtr;
private static freeExtKey;
/**
* Creates ExtKey from given seed.
* @param {Uint8Array} seed the seed used to generate Key
* @returns {ExtKey} object
*/
static fromSeed(seed: Uint8Array): Promise<ExtKey>;
/**
* Decodes ExtKey from Base58 format.
*
* @param {string} base58 the ExtKey in Base58
* @returns {ExtKey} object
*/
static fromBase58(base58: string): Promise<ExtKey>;
/**
* Generates a new ExtKey.
*
* @returns {ExtKey} object
*/
static generateRandom(): Promise<ExtKey>;
/**
* //doc-gen:ignore
*/
private constructor();
static fromPtr(ptr: ExtKeyNativePtr): ExtKey;
/**
* Generates child ExtKey from a current ExtKey using BIP32.
*
* @param {number} index number from 0 to 2^31-1
* @returns {ExtKey} object
*/
derive(index: number): Promise<ExtKey>;
/**
* Generates hardened child ExtKey from a current ExtKey using BIP32.
*
* @param {number} index number from 0 to 2^31-1
* @returns {ExtKey} object
*/
deriveHardened(index: number): Promise<ExtKey>;
/**
* Converts ExtKey to Base58 string.
*
* @returns {string} ExtKey in Base58 format
*/
getPrivatePartAsBase58(): Promise<string>;
/**
* Converts the public part of ExtKey to Base58 string.
*
* @returns {string} ExtKey in Base58 format
*/
getPublicPartAsBase58(): Promise<string>;
/**
* Extracts ECC PrivateKey.
*
* @returns {string} ECC key in WIF format
*/
getPrivateKey(): Promise<string>;
/**
* Extracts ECC PublicKey.
*
* @returns {string} ECC key in BASE58DER format
*/
getPublicKey(): Promise<string>;
/**
* Extracts raw ECC PrivateKey.
*
* @returns {Uint8Array} ECC PrivateKey
*/
getPrivateEncKey(): Promise<Uint8Array>;
/**
* Extracts ECC PublicKey Address.
*
* @returns {string} ECC Address in BASE58 format
*/
getPublicKeyAsBase58Address(): Promise<string>;
/**
* Gets the chain code of Extended Key.
*
* @returns {Uint8Array} Raw chain code
*/
getChainCode(): Promise<Uint8Array>;
/**
* Validates a signature of a message.
*
* @param {Uint8Array} message data used on validation
* @param {Uint8Array} signature signature of data to verify
* @returns {boolean} message validation result
*/
verifyCompactSignatureWithHash(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
/**
* Checks if ExtKey is Private.
*
* @returns {boolean} true if ExtKey is private
*/
isPrivate(): Promise<boolean>;
}