@@ -148,106 +148,93 @@ export interface SignedPostPolicyV4Output {
148148 url : string ;
149149 fields : PolicyFields ;
150150}
151-
152151export interface GetSignedUrlConfig
153152 extends Pick < SignerGetSignedUrlConfig , 'host' | 'signingEndpoint' > {
153+
154154 /**
155- * The date and time when the signed URL becomes active/usable.
156- * Maps to the `X-Goog-Date` query parameter in V4 signed URLs.
157- * If not specified, the current time is used by default. This is useful for pre-generating
158- * URLs that are only valid starting at a future point in time, or for pinning a static date
159- * to ensure consistent URL generation across identical calls (beneficial for caching).
155+ * The action to permit with the signed URL.
156+ * - `'read'`: Allows downloading/viewing the file (HTTP GET).
157+ * - `'write'`: Allows uploading/overwriting the file (HTTP PUT).
158+ * - `'delete'`: Allows removing the file (HTTP DELETE).
159+ * - `'resumable'`: Allows resumable uploads (HTTP POST).
160+ * Note: When using `'resumable'`, the header `X-Goog-Resumable: start` must be sent in the client request.
160161 */
161- accessibleAt ?: string | number | Date ;
162+ action : 'read' | 'write' | 'delete' | 'resumable' ;
162163
163164 /**
164- * The action/operation permitted by the signed URL.
165- * Supported values are:
166- * - `'read'`: Allows retrieving file data (HTTP GET method).
167- * - `'write'`: Allows uploading or overwriting file data (HTTP PUT method).
168- * - `'delete'`: Allows deleting the file (HTTP DELETE method).
169- * - `'resumable'`: Allows starting or resuming a resumable upload (HTTP POST method).
165+ * The signing version to use.
166+ * @default 'v2'
170167 */
171- action : 'read ' | 'write' | 'delete' | 'resumable ';
168+ version ? : 'v2 ' | 'v4 ' ;
172169
173170 /**
174- * The Custom Domain Name (CNAME) to use instead of the default GCS hostname.
175- * If you have configured a custom domain for your bucket, specifying this option
176- * will format the generated URL with your custom domain.
171+ * Use virtual hosted-style URLs (e.g., `https://mybucket.storage.googleapis.com/...`)
172+ * instead of path-style URLs (e.g., `https://storage.googleapis.com/mybucket/...`).
173+ * Virtual hosted-style URLs are generally preferred.
174+ * @default false
175+ */
176+ virtualHostedStyle ?: boolean ;
177+
178+ /**
179+ * The custom domain name (CNAME) mapped to this bucket (e.g., `"https://cdn.example.com"`).
177180 */
178181 cname ?: string ;
179182
180183 /**
181- * The MD5 digest of the content as a base64-encoded string.
182- * Required if you want to enforce integrity checking on upload. The client
183- * must send the exact matching `Content-MD5` header when using the signed URL.
184+ * The MD5 digest value in base64. If provided, the client request **must** * include an identical `Content-MD5` HTTP header.
185+ * If omitted, the client request must not include this header.
184186 */
185187 contentMd5 ?: string ;
186188
187189 /**
188- * The expected MIME type (Content-Type) of the file.
189- * Useful when using `'write'` or `'resumable'` actions to enforce that the client upload
190- * carries a specific `Content-Type` header matching this value.
190+ * The expected Content-Type of the file. If provided, the client request **must** * include an identical `Content-Type` HTTP header.
191+ * If omitted, the client request must not include this header.
191192 */
192193 contentType ?: string ;
193194
194195 /**
195- * The expiration date/time when the signed URL will no longer be valid .
196- * The value can be a JavaScript `Date` object, an epoch timestamp (number of milliseconds),
197- * or a date string. The maximum validity period is 7 days for V4 signed URLs .
196+ * The expiration timestamp for the link. Any provided value is passed directly to `new Date()` .
197+ * * @throws { Error } If an expiration timestamp from the past is given.
198+ * @note `'v4'` signing supports a maximum duration of 7 days (604,800 seconds) from the creation time .
198199 */
199200 expires : string | number | Date ;
200201
201202 /**
202- * Custom HTTP extension headers to be included as signed headers in the signed URL .
203- * Keys must be header names (e.g., `x-goog-meta-custom`) and values must be their expected values.
204- * The user must send these exact headers when making the HTTP request using the signed URL .
203+ * The timestamp when this link becomes usable. Any provided value is passed directly to `new Date()` .
204+ * @default Date.now()
205+ * @note Only supported/applicable when `version` is set to `'v4'` .
205206 */
206- extensionHeaders ?: http . OutgoingHttpHeaders ;
207+ accessibleAt ?: string | number | Date ;
207208
208209 /**
209- * A convenience option to prompt the browser to save the downloaded file with a specific filename .
210- * This is a friendly shortcut that automatically formats the `responseDisposition` parameter
211- * under the hood to `attachment; filename="<filename>"` .
212- * Note: If both `promptSaveAs` and `responseDisposition` are specified, `promptSaveAs` takes precedence
213- * and overrides `responseDisposition` .
210+ * Canonical extension headers that the server will validate against the client's request .
211+ * * Requirements:
212+ * - Header names must be prefixed with `x-goog-` and must be entirely lowercase .
213+ * - Multi-valued headers passed as an array are converted into a comma-separated string (no spaces).
214+ * The client must format them identically to prevent signature mismatches .
214215 */
215- promptSaveAs ?: string ;
216+ extensionHeaders ?: http . OutgoingHttpHeaders ;
216217
217218 /**
218- * Additional query parameters to append to the final signed URL.
219- * Note: For V4 signed URLs, only query parameters starting with `x-goog-` are included in the signature
220- * (and thus protected against tampering). Other custom query parameters are appended to the URL but not signed.
219+ * The filename to prompt the browser/user to save the file as upon access.
220+ * Note: This option is ignored if `responseDisposition` is explicitly set.
221221 */
222- queryParams ?: Query ;
222+ promptSaveAs ?: string ;
223223
224224 /**
225- * Overrides the `Content-Disposition` response header returned by GCS on download.
226- * For example, setting this to `attachment; filename="new-name.png"` forces the browser
227- * to download the file with the specified filename.
228- * Note: This option will be overridden if `promptSaveAs` is also specified.
225+ * Maps to the `response-content-disposition` query parameter in the signed URL.
229226 */
230227 responseDisposition ?: string ;
231228
232229 /**
233- * Overrides the `Content-Type` response header returned by GCS on download.
234- * Useful if you want GCS to serve a file with a specific MIME type when accessed
235- * via this signed URL, overriding its stored metadata.
230+ * Maps to the `response-content-type` query parameter in the signed URL.
236231 */
237232 responseType ?: string ;
238233
239234 /**
240- * The signature version to use when generating the signed URL.
241- * - `'v4'`: Google's recommended SHA256-based signing mechanism (default).
242- * - `'v2'`: The legacy SHA1-based signing mechanism.
243- */
244- version ?: 'v2' | 'v4' ;
245-
246- /**
247- * If true, uses virtual hosted-style URLs (e.g. `https://bucket-name.storage.googleapis.com/object-name`)
248- * instead of path-style URLs (e.g. `https://storage.googleapis.com/bucket-name/object-name`).
235+ * Additional query parameters to include natively in the generated signed URL.
249236 */
250- virtualHostedStyle ?: boolean ;
237+ queryParams ?: Query ;
251238}
252239
253240export interface GetFileMetadataOptions {
0 commit comments