Function Signature
Description
Signs a message using the EVM wallet identified by the supplied walletMetadata. The SDK is stateless — every call requires walletMetadata. If the wallet was created with backUpToDynamic: true, supply the password so the SDK can recover shares from backup when externalServerKeyShares is omitted.
When you pass externalServerKeyShares (the caller-supplied path), walletMetadata.externalServerKeySharesBackupInfo must also be present — signMessage throws if shares are supplied but backup metadata is missing. The full walletMetadata returned from createWalletAccount / importPrivateKey already includes it; identity-only metadata from fetchWalletMetadata will be rejected.
Parameters
Required Parameters
message (string) - The message to sign
walletMetadata (WalletMetadata) - Non-sensitive wallet metadata persisted from createWalletAccount() / importPrivateKey(). The wallet’s address comes from walletMetadata.accountAddress.
Optional Parameters
password (string) - Required if the wallet was created with backUpToDynamic: true. Used for backup decryption when externalServerKeyShares is not provided.
externalServerKeyShares (ServerKeyShare[]) - Caller-supplied plaintext shares. If omitted, the SDK recovers from backup using password.
Returns
Promise<string> - The serialized signature as a hex string
Example
Error Handling
Security Considerations
- Message Validation: Always validate message content before signing
- Key Share Security: Keep external server key shares secure
- Session Management: Implement proper session management
- Password Protection: Use strong passwords for wallet encryption