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

To remove all the session signers on the wallet,, use the removeSessionSigners method from the useSessionSigners hook:

removeSessionSigners: async ({address: string}) => Promise<{user: User}>

Usage

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

When invoked, the removeSessionSigners method will remove all the session signers on the wallet, so only the user can transact on the wallet.

After this action, your app will no longer be able to take actions on behalf of the user with their wallet unless the user adds more session signers.

Parameters

The removeSessionSigners method accepts a params object with the following fields:

address
string
required

Address of the embedded wallet to delegate.

As an example, you might have a button within your app to allow users to remove all session signers like so:

Example remove session signers button
import {usePrivy, useSessionSigners, type WalletWithMetadata} from '@privy-io/react-auth';

function RemoveSessionSignersButton() {
  const {user} = usePrivy();
  const {removeSessionSigners} = useSessionSigners();

  // Check if the user's wallets already has session signers 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 removeSessionSigners();
  };

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