Skip to content

signMessage

signMessage(config, params): Promise<SignMessageResponse>

Signs a message with the given address and message. Supports ECDSA and BIP322 protocols

Import

ts
import { signMessage } from "@midl-xyz/midl-js-core";

Example

ts
const signature = await signMessage(config, {
  address: "bc1q...",
  message: "Hello, world!",
});

console.log(signature);

Parameters

NameTypeDescription
configConfigThe configuration object
paramsSignMessageParamsThe parameters for the request

SignMessageParams

NameTypeDescription
addressstringThe address to sign the message with
messagestringThe message to sign
protocolSignMessageProtocolThe protocol to use for signing (optional)

SignMessageProtocol (enum)

NameValue
Ecdsa"ECDSA"
Bip322"BIP322"

Returns

Promise<SignMessageResponse>

The signature response

SignMessageResponse

NameTypeDescription
signaturestringBase64 encoded signature
addressstringThe address that signed the message
protocol?stringThe protocol used to sign the message
messageHash?stringThe message hash