signMessage

Signature#1

Signs a string message with a given private key.

Example

import { signMessage } from "thirdweb/utils";
signMessage({
message: "Hello, world!",
privateKey: "0x...",
});
function signMessage(options: SignMessageOptions): Hex;

Parameters

The options for signing.

Type

let options: { message: Message; privateKey: Hex };

Returns

let returnType: `0x${string}`;

The signature as a hex string

Signature#2

Signs a string message with a given account.

Example

import { signMessage } from "thirdweb/utils";
await signMessage({
message: "Hello, world!",
account,
});
function signMessage(options: {
account: Account;
message: Message;
}): Promise<Hex>;

Parameters

The options for signing.

Type

let options: { account: Account; message: Message };

Returns

let returnType: `0x${string}`;

The signature as a hex string