Skip to content

Commit 55d2dd1

Browse files
feat(api): add signed URL options with expiration settings to enhance security features
1 parent 2e7211e commit 55d2dd1

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-a49f0e337789b1a4368194ed004ac4c1b0c0cd2ce4344e14546422632242d897.yml
3-
openapi_spec_hash: a7f3999c6227aac108cd80253ffc7730
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d857341f30517b11df568dd6c5a0e9dea3a854930f7f6583718114d311f2d5ee.yml
3+
openapi_spec_hash: db94bfd556220d6244a1b2bbae9d7d00
44
config_hash: 249ee22f294858ab0971b8379f7cb519

src/resources/shared.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,36 @@ export interface SrcOptions {
185185
*/
186186
urlEndpoint: string;
187187

188+
/**
189+
* When you want the signed URL to expire, specified in seconds. If `expiresIn` is
190+
* anything above 0, the URL will always be signed even if `signed` is set to
191+
* false. If not specified and `signed` is `true`, the signed URL will not expire
192+
* (valid indefinitely).
193+
*
194+
* Example: Setting `expiresIn: 3600` will make the URL expire 1 hour from
195+
* generation time. After the expiry time, the signed URL will no longer be valid
196+
* and ImageKit will return a 401 Unauthorized status code.
197+
*
198+
* [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls).
199+
*/
200+
expiresIn?: number;
201+
188202
/**
189203
* These are additional query parameters that you want to add to the final URL.
190204
* They can be any query parameters and not necessarily related to ImageKit. This
191205
* is especially useful if you want to add a versioning parameter to your URLs.
192206
*/
193207
queryParameters?: { [key: string]: string };
194208

209+
/**
210+
* Whether to sign the URL or not. Set this to `true` if you want to generate a
211+
* signed URL. If `signed` is `true` and `expiresIn` is not specified, the signed
212+
* URL will not expire (valid indefinitely). Note: If `expiresIn` is set to any
213+
* value above 0, the URL will always be signed regardless of this setting.
214+
* [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls).
215+
*/
216+
signed?: boolean;
217+
195218
/**
196219
* An array of objects specifying the transformations to be applied in the URL. If
197220
* more than one transformation is specified, they are applied in the order they

0 commit comments

Comments
 (0)