BSV-ex v0.3.0 BSV.Message View Source

Module to sign and verify messages with Bitcoin keys. Is compatible with ElectrumSV and bsv.js.

Internally uses libsecp256k1 NIF bindings for compact signatures and public key recovery from signatures.

Link to this section Summary

Functions

Creates a signature for the given message, using the given private key.

Verify the given message and signature, using the given Bitcoin address or public key.

Link to this section Functions

Link to this function

sign(message, private_key, options \\ [])

View Source
sign(binary(), BSV.KeyPair.t() | binary(), keyword()) :: binary()

Creates a signature for the given message, using the given private key.

Options

The accepted options are:

  • :encoding - Encode the returned binary with either the :base64 (default) or :hex encoding scheme. Set to false to return binary signature.

Examples

BSV.Message.sign("hello world", private_key)
"Hw9bs6VZ..."
Link to this function

verify(signature, message, public_key, options \\ [])

View Source
verify(binary(), binary(), BSV.KeyPair.t() | binary(), keyword()) :: boolean()

Verify the given message and signature, using the given Bitcoin address or public key.

Options

The accepted options are:

  • :encoding - Decode the given signature with either the :base64 (default) or :hex encoding scheme. Set to false to accept binary signature.

Examples

BSV.Crypto.RSA.verify(signature, message, address)
true