This interface is for raw signing over a hash, which primarily applies to Coinbase Smart Wallet integrations, EIP-7702 authorizations and other scenarios requiring basic curve-level signing. For most use cases, such as authenticating to a website or proving ownership, we recommend signing a message.

To sign a raw hash from a wallet using the React SDK use the request method from the wallets EIP1193 provider:

 request: (request: { method: 'secp256k1_sign', params: [hash: Hex] }) => Promise<HexString>

Usage

import {useWallets} from '@privy-io/react-auth';

const {wallets} = useWallets();
const wallet = wallets[0];

const provider = await wallet.getProvider();

// Sign raw hash
const response = await provider.request({
  method: 'secp256k1_sign',
  params: ['0xTheRawHash']
});

Parameters

request.method
'secp256k1_sign'
required

The RPC method executed with the wallet.

request.params
[hash: Hex]
required

The raw hash to sign over.

Returns

response
string

The signature produced by the wallet.