Skip to content

revokeAllAccess

This method allows revoking authorizations granted to a protectedData entity. You may optionally specify application or user addresses for revocation. If you do not specify either of these optional values, this method will revoke all access for all users and applications.

You must be the owner of the protected data.

Under the hood, all granted access will be retrieved and be revoked one by one. If by any chance there were more than 20 granted access to be revoked, you would need to call this revokeAllAccess() method more than once for all granted access to be actually revoked. Use getGrantedAccess() to ensure it is all done.

Usage

ts
const 
revokeAllAccessResult
= await
dataProtectorCore
.
revokeAllAccess
({
protectedData
: '0x123abc...',
authorizedApp
: '0x456def...',
authorizedUser
: '0x789cba...',
});

Parameters

ts
import { type 
RevokeAllAccessParams
} from '@iexec/dataprotector';

protectedData Required *

Type: AddressOrENS

The address of the protectedData subject to access revocation.

ts
const 
revokeAllAccessResult
= await
dataProtectorCore
.
revokeAllAccess
({
protectedData
: '0x123abc...',
});

authorizedApp Optional

Type: AddressOrENS

The application address to be removed from the authorization list for the specified protectedData. If no address is specified, it will revoke all access from the protected data, regardless of the app.

ts
const 
revokeAllAccessResult
= await
dataProtectorCore
.
revokeAllAccess
({
protectedData
: '0x123abc...',
authorizedApp
: '0x456def...',
authorizedUser
: '0x789cba...',
});

authorizedUser Optional

Type: AddressOrENS

The user address to be removed from the authorization list for the specified protectedData. If no address is specified, it will revoke all access from the protected data, regardless of the authorized user.

ts
const 
revokeAllAccessResult
= await
dataProtectorCore
.
revokeAllAccess
({
protectedData
: '0x123abc...',
authorizedApp
: '0x456def...',
authorizedUser
: '0x789cba...',
});

onStatusUpdate Optional

Type: OnStatusUpdateFn<RevokeAllAccessStatuses>

Callback function to be notified at intermediate steps.

ts
const 
revokeAllAccessResult
= await
dataProtectorCore
.
revokeAllAccess
({
protectedData
: '0x123abc...',
authorizedApp
: '0x456def...',
authorizedUser
: '0x789cba...',
onStatusUpdate
: ({
title
,
isDone
}) => {
console
.
log
(
title
,
isDone
);
}, });

You can expect this callback function to be called with the following titles:

ts
'RETRIEVE_ALL_GRANTED_ACCESS';
'REVOKE_ONE_ACCESS';

Once with isDone: false, and then with isDone: true

Result

ts
import { type 
RevokedAccess
} from '@iexec/dataprotector';

RevokedAccess[]