Once a user has provisioned a session signer, they may also revoke consent to prevent your app from taking any further wallet actions on their behalf.

To revoke all session signers on users wallets automatically, without a revocation screen, use the revokeWallets method from the useHeadlessDelegatedActions hook:

type revokeWallets: async () => Promise<void>

Usage

import {useHeadlessDelegatedActions} from '@privy-io/react-auth';
...
const {revokeWallets} = useHeadlessDelegatedActions();

When invoked, the revokeWallets method will revoke all of the session signers provisioned on all of the user’s wallets

Once a user confirms revocation, your app will no longer be able to take actions on behalf of the user with their wallet unless the user provisions a session signer.

If a user has provisioned multiple session signers, they will all be revoked.

As an example, you might have a button within your app to allow users to revoke session signer provisioned wallets like so:

Example Create Wallet Button
import {usePrivy, useheadlessDelegatedActions, type WalletWithMetadata} from '@privy-io/react-auth';

function RevokeDelegateActionButton() {
  const {user} = usePrivy();
  const {revokeWallets} = useHeadlessDelegatedActions();

  // Check if the user has any delegated wallets by searching the linkedAccounts array for wallets
  // with `delegated: true` set
  const hasDelegatedWallets =
    user.linkedAccounts.filter(
      (account): account is WalletWithMetadata => account.type === 'wallet' && account.delegated
    ).length !== 0;

  const onRevoke = async () => {
    if (!hasDelegatedWallets) return; // Button is disabled to prevent this case
    await revokeWallets();
  };

  return (
    <button disabled={!hasDelegatedWallets} onClick={onRevoke}>
      Revoke permission for this app to transact on my behalf
    </button>
  );
}