Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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

  1. Sends a revocation request to the JAW relay
  2. Signs the revocation with the smart account
  3. The permission is invalidated and can no longer be used
  4. 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