Documentation Index
Fetch the complete documentation index at: https://docs.world.org/llms.txt
Use this file to discover all available pages before exploring further.
Use MiniKit.signMessage() to request a personal signature from the user’s wallet.
Basic Usage
import { MiniKit } from "@worldcoin/minikit-js";
import type {
CommandResultByVia,
MiniAppSignMessageSuccessPayload,
MiniKitSignMessageOptions,
} from "@worldcoin/minikit-js/commands";
export async function signMessage() {
const input = {
message: "Hello world",
} satisfies MiniKitSignMessageOptions;
const result: CommandResultByVia<MiniAppSignMessageSuccessPayload> =
await MiniKit.signMessage(input);
console.log(result.data.signature);
}
Result
type SignMessageResponse =
| {
executedWith: "minikit" | "wagmi";
data: {
status: "success";
version: number;
signature: string;
address: string;
};
}
| {
executedWith: "fallback";
data: unknown;
};
Fallback Behavior
Define a custom fallback in the command payload for support outside mini apps.
Notes
Verify signatures in a trusted environment before using them for sensitive application logic.
Error Codes
| Code | Meaning |
|---|
invalid_message | The message payload is invalid |
user_rejected | The user rejected the request |
generic_error | Unexpected failure |