account.revokePermission()
Revoke a previously granted permission.
Type: instance async
Signature
async revokePermission(
permissionId: Hex,
paymasterUrlOverride?: string,
paymasterContextOverride?: Record<string, unknown>,
address?: Address
): Promise<RevokePermissionApiResponse>Parameters
permissionId
Type: Hex
The permission ID (hash) to revoke. This is the id field returned from grantPermissions().
paymasterUrlOverride (optional)
Type: string
Custom paymaster URL for gas sponsorship or ERC-20 token payment.
paymasterContextOverride (optional)
Type: Record<string, unknown>
Custom paymaster context.
address (optional)
Type: Address
Target account address to revoke the permission on. The signer must be a registered owner on that account.
Returns
Promise<RevokePermissionApiResponse> - The revocation response.
interface RevokePermissionApiResponse {
/** Whether the revocation was successful */
success: boolean;
/** Transaction hash if on-chain revocation was needed */
transactionHash?: Hex;
}Behavior
- Sends a revocation request to the JAW relay
- Signs the revocation with the smart account
- The permission is invalidated and can no longer be used
- Returns confirmation of the revocation
Example
import { Account } from '@jaw.id/core';
const account = await Account.get({
chainId: 1,
apiKey: 'your-api-key',
});
// Revoke a permission by its ID
const response = await account.revokePermission(
'0x1234567890abcdef...' // Permission ID from grantPermissions()
);
if (response.success) {
console.log('Permission revoked successfully');
} else {
console.log('Revocation failed');
}Related
- account.grantPermissions() - Grant new permissions
- account.getPermission() - Get permission details
- Subscription Payments Guide - Learn about the permission system