Revoke a public link
The secrecyClient.cloud.deletePublicDataLink method destroys a link from its id. The URL stops resolving immediately, for everybody who received it. The method resolves with the deleted link, so its slug and name remain available for logging or for a confirmation message.
Deleting a link does not delete the data it points at. The uploaded data stays in the cloud and other links targeting it keep working.
share.ts
const revokeLink = async (id: string): Promise<boolean> => {
// First we need to check if the secrecyClient is available
if (!secrecyClient) {
return false;
}
try {
// The deleted link is returned
await secrecyClient.cloud.deletePublicDataLink({ id });
return true;
} catch (error) {
console.error(error);
return false;
}
};Revoking is definitive: a deleted link cannot be restored, and creating a new link on the same data produces a new slug. When you only want to suspend access, or to plan it in advance, set an expireAt date with secrecyClient.cloud.updatePublicDataLink instead — see getting started with transfers.