Sign a message
This method uses Ethereum’s personal_sign
RPC method. If you are looking for a low-level raw signature over a input hash, see secp256k1_sign.
Use the signMessage
method exported from the useSignMessage
hook to sign a message with an Ethereum embedded wallet.
Usage
Parameters
Message to be signed.
Returns
The signature produced by the wallet.
Callbacks
Configure callbacks for Privy’s signMessage
method on the useSignMessage
hook:
As parameters to useSignMessage
, you may include an onSuccess
callback and/or an onError
callback.
While this component is mounted, any invocation of signMessage
will trigger the onSuccess
callback or onError
callback on completion, depending on if the message was successfully signed or not.
onSuccess
If set, the onSuccess
callback will execute after a user has successfully signed the message. Within this callback, you can access a signature
parameter, which is the signature
string value generated by the wallet to sign the message.
onError
If set, the onError
callback will execute after a user attempts to sign a message and there is an error, or if the user exits the signature flow prematurely. Within this callback, you may access an error
code with more information about the error.
Use the signMessage
method exported from the useSignMessage
hook to sign a message with an Ethereum embedded wallet.
Usage
Parameters
Message to be signed.
Returns
The signature produced by the wallet.
Callbacks
Configure callbacks for Privy’s signMessage
method on the useSignMessage
hook:
As parameters to useSignMessage
, you may include an onSuccess
callback and/or an onError
callback.
While this component is mounted, any invocation of signMessage
will trigger the onSuccess
callback or onError
callback on completion, depending on if the message was successfully signed or not.
onSuccess
If set, the onSuccess
callback will execute after a user has successfully signed the message. Within this callback, you can access a signature
parameter, which is the signature
string value generated by the wallet to sign the message.
onError
If set, the onError
callback will execute after a user attempts to sign a message and there is an error, or if the user exits the signature flow prematurely. Within this callback, you may access an error
code with more information about the error.
Request a message signature on the wallets Ethereum provider.
Usage
Parameters
The method for the wallet request. For signing messages, this is 'personal_sign'
.
Returns
The signature produced by the wallet.
Request a message signature on the wallet’s Ethereum provider.
Usage
Parameters
The method for the wallet request. For signing messages, this is 'personal_sign'
.
Returns
The signature produced by the wallet.
HD wallets
Ethereum embedded wallets are hierarchical deterministic (HD) wallets, and a user’s seed entropy can support multiple separate embedded wallets.
HD wallets are only supported on Ethereum. allowAdditional
is not supported for Solana wallets.
Send a request with the new wallet
To send a request to an embedded wallet not at the 0-index, pass the desired wallet address as an optional second parameter to provider.request
.
Usage
Parameters
The method for the wallet request. For signing messages, this is 'personal_sign'
.
Returns
The signature produced by the wallet.
Usage
Parameters
The method for the wallet request. For signing messages, this is 'personal_sign'
.
Returns
The signature produced by the wallet.
Usage
Parameters
The method for the wallet request. For signing messages, this is 'personal_sign'
.
Returns
The RPC method executed with the wallet.
Outputs for the RPC method executed with the wallet.
Use the signMessage
method on the Ethereum client to sign a message with an Ethereum wallet.
Usage
Parameters
Unique ID of the wallet to take actions with.
The string or bytes to sign with the wallet.
Idempotency key to identify a unique request.
Returns
An encoded string serializing the signature produced by the user’s wallet.
The encoding format for the returned signature
. Currently, only 'hex'
is supported for
Ethereum.
To sign a message make a POST request to
Parameters
RPC method to execute with the wallet.
Parameters for the RPC method to execute with the wallet.
Returns
The RPC method executed with the wallet.
Outputs for the RPC method executed with the wallet.