nanocurrency
Version:
A toolkit for the Nano cryptocurrency, allowing you to derive keys, generate seeds, hashes, signatures, proofs of work and blocks.
35 lines (34 loc) • 1.23 kB
TypeScript
/**
* Generate a cryptographically secure seed.
*
* @returns Promise fulfilled with seed, in hexadecimal format
*/
export declare function generateSeed(): Promise<string>;
/**
* Derive a secret key from a seed, given an index.
*
* @param seed - The seed to generate the secret key from, in hexadecimal format
* @param index - The index to generate the secret key from
* @returns Secret key, in hexadecimal format
*/
export declare function deriveSecretKey(seed: string, index: number): string;
/**
* Derive a public key from a secret key.
*
* @param secretKeyOrAddress - The secret key or address to generate the public key from, in hexadecimal or address format
* @returns Public key, in hexadecimal format
*/
export declare function derivePublicKey(secretKeyOrAddress: string): string;
/** Derive address params. */
export interface DeriveAddressParams {
/** Whether to use nano_ instead of xrb_ */
useNanoPrefix?: boolean;
}
/**
* Derive address from a public key.
*
* @param publicKey - The public key to generate the address from, in hexadecimal format
* @param params - Parameters
* @returns Address
*/
export declare function deriveAddress(publicKey: string, params?: DeriveAddressParams): string;