/** * Build + sign an S3 presigned-POST policy. * * @example * ```ts * const post = signS3PresignedPost({ * bucket: 'app-uploads', * region: 'us-east-1', * credentials: { accessKeyId, secretAccessKey }, * key: { startsWith: 'avatars/' }, * contentType: { startsWith: 'image/' }, * contentLengthRange: { min: 0, max: 5 * 1024 * 1024 }, * expiresIn: 3600, * }) * * // Browser side: * // const fd = new FormData() * // Object.entries(post.fields).forEach(([k, v]) => fd.append(k, v)) * // fd.append('file', file) // MUST be last * // await fetch(post.url, { method: 'POST', body: fd }) * ``` */ export declare function signS3PresignedPost(input: S3PresignedPostInput): S3PresignedPostResult; /** * Inputs to {@link signS3PresignedPost}. Mirrors the * `presignedUploadPolicy()` adapter call once it's wired up. */ export declare interface S3PresignedPostInput { bucket: string region: string credentials: { accessKeyId: string secretAccessKey: string sessionToken?: string } key: string | { startsWith: string } contentType: string | { startsWith: string } contentLengthRange?: { min: number, max: number } acl?: 'private' | 'public-read' | 'public-read-write' | 'authenticated-read' | 'bucket-owner-read' | 'bucket-owner-full-control' expiresIn: number fields?: Record } /** * What the browser submits. The form is `multipart/form-data` POSTed * to `url`; every key in `fields` becomes a form field with the same * name. The actual file MUST be the LAST field, named `'file'`. */ export declare interface S3PresignedPostResult { url: string fields: Record key: string }