Function Signature
Description
Signs a message on behalf of a user who has granted delegation permission. This function requires delegation credentials (wallet ID, wallet API key, and key share) that are provided to your webhook endpoint when a user approves delegation. The function returns a base58-encoded Ed25519 signature, which is the standard signature format for Solana.Parameters
Required Parameters
client
(DelegatedSvmWalletClient
) - The delegated client instance created withcreateDelegatedSvmWalletClient()
walletId
(string
) - The wallet ID from the delegation webhookwalletApiKey
(string
) - The wallet-specific API key from the delegation webhookkeyShare
(ServerKeyShare
) - The server key share from the delegation webhookmessage
(string
) - The message to sign
Optional Parameters
isFormatted
(boolean
) - Whether the message is already formatted for signing. Defaults tofalse
Returns
Promise<string>
- A base58-encoded Ed25519 signature
Example
Basic Message Signing
With Formatted Message
Complete Example with Try-Catch
Type Definitions
Common Use Cases
Authentication
Proof of Ownership
Error Handling
The function throws an error if:- Any required parameter is missing or invalid
- The delegation credentials are expired or revoked
- The MPC signing operation fails
- Network communication with Dynamic services fails
Security Considerations
- Credential Validation: Always validate delegation credentials before using them
- Message Validation: Validate message content to prevent signing malicious data
- Audit Logging: Log all signing operations for security auditing
- Credential Storage: Never log or expose wallet API keys or key shares
- Rate Limiting: Implement rate limiting to prevent abuse
Related Functions
createDelegatedSvmWalletClient()
- Create the client for delegated operationsdelegatedSignTransaction()
- Sign transactions instead of messages- Delegated Access Guide - Complete guide on using delegated access