Skip to content

signMessages

signMessages(config, messages): Promise<SignMessageResponse[]>

Signs multiple messages in a single request. Supports ECDSA and BIP322 protocols.

WARNING

signMessages is currently supported only by the Xverse connector. If the active connector does not support signMessages, the core implementation falls back to signing each message individually using signMessage.

Import

ts
import { signMessages } from "@midl/core";

Example

ts
const signatures = await signMessages(config, [
  { address: "bc1q...", message: "Hello, world!" },
  { address: "bc1q...", message: "Second message" },
]);

console.log(signatures);

Parameters

NameTypeDescription
configConfigThe configuration object
messagesSignMessageParams[]The messages to sign

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 responses

SignMessageResponse

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

Released under the MIT License