How it works
When you callsigner.signMessage(), CCC:
- Encodes the message according to the connected chain’s convention (e.g. EIP-191 for EVM, BIP-322 for BTC).
- Asks the wallet to sign it.
- Returns a
Signatureobject containing the raw signature string, the signer’s identity, and the sign type.
ccc.Signer.verifyMessage() method understands all supported sign types and dispatches to the correct verification function automatically.
Supported sign types
| Sign type | Wallets |
|---|---|
EvmPersonal | MetaMask, OKX (EVM) |
BtcEcdsa | UniSat, OKX (BTC), UTXO Global |
JoyId | JoyID |
NostrEvent | Nostr |
CkbSecp256k1 | CKB native wallets |
DogeEcdsa | Doge wallets |
Sign a message
Callsigner.signMessage() with a string or byte array. The method returns a Signature object.
sign.ts
The Signature object
| Field | Type | Description |
|---|---|---|
signature | string | The raw signature produced by the wallet. |
identity | string | The signer’s address or public key, used to verify ownership. |
signType | SignerSignType | Identifies the signing algorithm so the verifier knows how to check it. |
Verify a signature
Static verification
Use the staticccc.Signer.verifyMessage() method when you have a Signature object and want to check it without a signer instance. This is useful on the server side or when verifying signatures from other users.
Instance verification
Callsigner.verifyMessage() on the signer instance when you want to check that the current signer produced the signature.
Signature object to verify a bare signature string using the current signer’s sign type and identity:
Full example
sign.ts
In a React component
sign-button.tsx
The
Signature object must be serialized and stored if you want to verify it later (for example in a backend or on-chain). Serialize it with JSON.stringify(signature) and restore it with JSON.parse().Next steps
Send CKB
Move beyond signing messages and compose a full transfer transaction.
Connect Wallet
Learn how to set up the wallet connector and retrieve a signer.