revokeAccess method

Future<void> revokeAccess({
  1. required String folderPath,
  2. required MailboxType type,
  3. required PeerId targetPeerId,
})

Revoke access from a peer

Implementation

Future<void> revokeAccess({
  required String folderPath,
  required MailboxType type,
  required PeerId targetPeerId,
}) async {
  _logger.fine('Revoking access from ${targetPeerId.toBase58()} for $folderPath');

  final address = MailboxAddress(
    ownerId: host.id,
    folderPath: folderPath,
    type: type,
  );

  final request = RevokeAccessRequest(
    address: address,
    targetPeerId: targetPeerId,
  );

  final response = await _sendRequest(request);
  if (!response.success) {
    throw MailboxManagementError(
      response.errorMessage ?? 'Failed to revoke access',
    );
  }

  _logger.info('Revoked access from ${targetPeerId.toBase58()} for ${address.fullPath}');
}