ecash-lib
Version:
Library for eCash transaction building
32 lines • 1.13 kB
TypeScript
/**
* Messages are prepared in a standard way before signing and verifying
*
* - The raw message (e.g., "Hello, world!") is encoded as a UTF-8 byte array
* - The prefixed message is constructed as:
*
* [prefix][message_length][message]
*
* where message_length is a variable-length integer (varint) encoding the
* byte length of the message
*
* We keep the "magicHash" name used in bitcoinjs-message as we do the same thing here
* with eCash tools
*
* ref https://github.com/bitcoinjs/bitcoinjs-message/blob/master/index.js#L57
*/
export declare const magicHash: (message: string, messagePrefix?: string) => Uint8Array;
/**
* Sign a message
*
* While there is not an official BIP or spec here, there is
* a de facto standard
*
* See implementation in bitcoinjs-lib and electrum
*/
export declare const signMsg: (msg: string, sk: Uint8Array, prefix?: string) => string;
/**
* Verify that a given message and signature
* came from a given address
*/
export declare const verifyMsg: (msg: string, signature: string, address: string, prefix?: string) => boolean;
//# sourceMappingURL=messages.d.ts.map