The user's session keypair for authentication
File metadata including reference, fileName, and fileType
The Welshare API environment configuration
Promise containing presignedUrl (S3 PUT URL) and uploadKey (storage path)
import { WelshareApi, resolveEnvironment } from "@welshare/sdk";
const environment = resolveEnvironment("production");
const { presignedUrl, uploadKey } = await WelshareApi.fetchS3WriteDelegation(
keypair,
{
reference: "questionnaire/abc-123/photo",
fileName: "photo.jpg",
fileType: "image/jpeg",
},
environment
);
// Upload encrypted file to S3
await fetch(presignedUrl, {
method: "PUT",
body: encryptedFileData,
headers: { "Content-Type": "application/octet-stream" },
});
Fetch a presigned URL for uploading encrypted files to S3 storage.