The owner of the file can revoke the access of an encrypted file that was shared by him previously, this code example demonstrates the same.
constrevokeAccess=async () => {try {// CID of the encrypted file that you want to revoke access to// CID is generated by uploading a file with encryption// Only the owner of the file can revoke access to another wallet addressconstcid='YOUR_CID'// Example: "Qma7Na9sEdeM6aQeu6bUFW54HktNnW2k8g226VunXBhrn7";constpublicKey='YOUR_PUBLIC_KEY'// Example: "0xa3c960b3ba29367ecbcaf1430452c6cd7516f588";constsignedMessage="SIGNATURE/JWT"constpublicKeyUserB= ['RECEIVER_PUBLIC_KEY'] // Example: "0x487fc2fE07c593EAb555729c3DD6dF85020B5160";constrevokeResponse=awaitlighthouse.revokeFileAccess( publicKey, publicKeyUserB, cid, signedMessage )console.log(revokeResponse)/* Sample Response { data: { cid: 'QmTsC1UxihvZYBcrA36DGpikiyR8ShosCcygKojHVdjpGd', revokeTo: [ '0x487fc2fE07c593EAb555729c3DD6dF85020B5160' ], status: 'Success' } } */ } catch (error) {console.log(error) }}revokeAccess()