spark_signMessage
Use the spark_signMessage
method to request a signature from the userโs Spark identity key. This is typically used for authentication, verification, or dApp interactions that require proof of wallet ownership on Spark.
Parameters
message
a string representing the message to be signed by the Spark identity key
compact
โน๏ธ Optional - defaults to false
if true
, the signature is returned in compact format instead of DER.
Example
import { request } from "sats-connect";
try {
const response = await request("spark_signMessage", {
message: "Log in to example.com at 2025-09-08T12:00Z",
compact: true, // optional, defaults to false
});
if ("result" in response) {
console.log("Signature:", response.result.signature);
} else {
console.error("Signing failed:", response.error.message);
}
} catch (error) {
console.error("Unexpected error:", error);
}
What spark_signMessage
does
spark_signMessage
doesWhen called, this method:
Prompts the user in their Xverse wallet to review the message being signed.
Signs the message using their Spark identity key.
Returns the signature in either DER or compact format.
The spark_signMessage
method returns a Promise that resolves to the SparksignMessageResult
object:
signature
a Uint8Array representing the ECDSA signare (DER or compact format)
Last updated