signMessage
signMessage(message: string, opts: { address: string }) -> <Promise<{ signedMessage: string | null; signerAddress: string; } & { error?: string; }>>
The signed message from the response is a base64 encoded string of the signature. Verification Example:
const kp = <signing key pair>
const message = "hi";
const res = await stellarApi.signMessage(message, { networkPassphrase: SorobanClient.Networks.TESTNET });
const SIGN_MESSAGE_PREFIX = "Stellar Signed Message:\n";
const messageHash = SHA256(SIGN_MESSAGE_PREFIX + message);
const passes = kp.verify(Buffer.from(messageHash, "base64"), res.signedMessage); // true
signMessage
method:
Enter message to sign:
Enter network passphrase (optional):
Request signature from specific public key (optional):
Result:Signer address: