UNPKG

@kazeblockchain/krypton-js

Version:

Javascript libraries for kaze wallet using https://github.com/kazechainio/kazewallet/blob/master/js/wallet.js as the original source.

36 lines (28 loc) 1.52 kB
export interface ScryptParams { cost: number blockSize: number parallel: number } export function getPublicKeyEncoded(publicKey: string): string export function getPublicKeyUnencoded(publicKey: string): string export function getPrivateKeyFromWIF(wif: string): string export function getWIFFromPrivateKey(privateKey: string): string /** Calculates the public key from a given private key. */ export function getPublicKeyFromPrivateKey(publicKey: string, encode?: boolean): string /** * VerificationScript serves a very niche purpose. * It is attached as part of the signature when signing a transaction. * Thus, the name 'scriptHash' instead of 'keyHash' is because we are hashing the verificationScript and not the PublicKey. */ export function getVerificationScriptFromPublicKey(publicKey: string): string export function getScriptHashFromPublicKey(publicKey: string): string export function getAddressFromScriptHash(scriptHash: string): string export function getScriptHashFromAddress(address: string): string /** Generates a signature of the transaction based on given private key. */ export function generateSignature(hex: string, privateKey: string): string /** Verifies a hexstring is signed by public key. */ export function verifySignature(hex: string, signature: string, publicKey: string): boolean /** Generates a random private key */ export function generatePrivateKey(): string /** Generates a arrayBuffer filled with random bits. */ export function generateRandomArray(length: number): string