account.revokePermission()
Revoke a previously granted permission.
Type: instance async
Signature
async revokePermission(permissionId: Hex): Promise<RevokePermissionApiResponse>Parameters
permissionId
Type: Hex
The permission ID (hash) to revoke. This is the id field returned from grantPermissions().
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