@welshare/sdk
    Preparing search index...

    Function fetchS3DeleteDelegation

    • Fetch a presigned URL for deleting a binary file from S3 storage.

      This is the delegation approach - it returns a presigned DELETE URL that the client can call directly. For complete deletion (both Nillion and S3), use deleteBinaryFile() instead.

      Parameters

      • keypair: SessionKeypair

        The user's session keypair for authentication

      • binaryFileId: string

        The document ID of the binary file to delete

      • environment: WelshareApiEnvironment

        The Welshare API environment configuration

      Returns Promise<DeleteDelegationResponse>

      Promise containing presignedUrl (S3 DELETE URL), storageKey, and binaryFileId

      import { WelshareApi, resolveEnvironment } from "@welshare/sdk";

      const { presignedUrl } = await WelshareApi.fetchS3DeleteDelegation(
      keypair,
      "abc-123-def-456",
      resolveEnvironment("production")
      );

      // Call the presigned URL to delete from S3
      await fetch(presignedUrl, { method: "DELETE" });

      Side effects:

      • Makes HTTP POST to {apiUrl}/auth/delegate/storage?requestType=delete
      • Creates a self-signed JWT with the binary file ID as subject

      Security notes:

      • Presigned URLs expire after 15 seconds
      • Only the file owner (controller_did) can get a delete delegation
      • This only returns the presigned URL; you must delete from Nillion separately