UNPKG

@ecash/lib

Version:

Library for eCash transaction building

128 lines (127 loc) 2.68 kB
/* tslint:disable */ /* eslint-disable */ /** * Calculate SHA512(data). * @param {Uint8Array} data * @returns {Uint8Array} */ export function sha512(data: Uint8Array): Uint8Array; /** * Calculate SHA256(SHA256(data)). * @param {Uint8Array} data * @returns {Uint8Array} */ export function sha256d(data: Uint8Array): Uint8Array; /** * Calculate SHA256(data). * @param {Uint8Array} data * @returns {Uint8Array} */ export function sha256(data: Uint8Array): Uint8Array; /** * Calculate RIPEMD160(SHA256(data)), commonly used as address hash. * @param {Uint8Array} data * @returns {Uint8Array} */ export function shaRmd160(data: Uint8Array): Uint8Array; /** * ECC signatures with libsecp256k1. */ export class Ecc { free(): void; /** * Create a new Ecc instance. */ constructor(); /** * Derive a public key from secret key. * @param {Uint8Array} seckey * @returns {Uint8Array} */ derivePubkey(seckey: Uint8Array): Uint8Array; /** * Sign an ECDSA signature. * @param {Uint8Array} seckey * @param {Uint8Array} msg * @returns {Uint8Array} */ ecdsaSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array; /** * Sign a Schnorr signature. * @param {Uint8Array} seckey * @param {Uint8Array} msg * @returns {Uint8Array} */ schnorrSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array; /** * Return whether the given secret key is valid, i.e. whether is of correct * length (32 bytes) and is on the curve. * @param {Uint8Array} seckey * @returns {boolean} */ isValidSeckey(seckey: Uint8Array): boolean; /** * Add a scalar to a secret key. * @param {Uint8Array} a * @param {Uint8Array} b * @returns {Uint8Array} */ seckeyAdd(a: Uint8Array, b: Uint8Array): Uint8Array; /** * Add a scalar to a public key (adding G*b). * @param {Uint8Array} a * @param {Uint8Array} b * @returns {Uint8Array} */ pubkeyAdd(a: Uint8Array, b: Uint8Array): Uint8Array; } /** * Instance to calculate SHA256 in a streaming fashion */ export class Sha256H { free(): void; /** * Create new hasher instance */ constructor(); /** * Feed bytes into the hasher * @param {Uint8Array} data */ update(data: Uint8Array): void; /** * Finalize the hash and return the result * @returns {Uint8Array} */ finalize(): Uint8Array; /** * Clone the hasher * @returns {Sha256H} */ clone(): Sha256H; } /** * Instance to calculate SHA512 in a streaming fashion */ export class Sha512H { free(): void; /** * Create new hasher instance */ constructor(); /** * Feed bytes into the hasher * @param {Uint8Array} data */ update(data: Uint8Array): void; /** * Finalize the hash and return the result * @returns {Uint8Array} */ finalize(): Uint8Array; /** * Clone the hasher * @returns {Sha512H} */ clone(): Sha512H; }