Skip to content

Documentation / react-auth / useSignMessage

Function: useSignMessage()

useSignMessage(callbacks?): Object

Use this hook to sign a message using the embedded wallet, and to attach callbacks for success and errors.

Parameters

callbacks?: Object

callbacks.onError?: CallbackError

Callback that will execute in the case of a non-successful signMessage.

Param [PrivyErrorCode]([object Object]) - the corresponding error code

callbacks.onSuccess?: (signature) => void

Callback that will execute once a successful signMessage completes. This will not run in the case of a wallet-based authentication or link flow.

Param the signature (type string) of the embedded wallet used to sign message

Returns

Object

signMessage - prompts the user to sign a message with their embedded wallet

signMessage

signMessage: (message, uiOptions?) => Promise<string>

Parameters

message: string

uiOptions?: SignMessageModalUIOptions

Returns

Promise<string>