@aws-sdk/cloudfront-signer 3.723.0 → 3.772.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -19,12 +19,12 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
 
21
21
  // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
24
  getSignedCookies: () => getSignedCookies,
25
25
  getSignedUrl: () => getSignedUrl
26
26
  });
27
- module.exports = __toCommonJS(src_exports);
27
+ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/sign.ts
30
30
  var import_crypto = require("crypto");
@@ -235,13 +235,13 @@ var CloudfrontSignBuilder = class {
235
235
  if (!date) {
236
236
  return void 0;
237
237
  }
238
- const parsedDate = Date.parse(date);
239
- return isNaN(parsedDate) ? void 0 : this.epochTime(new Date(parsedDate));
238
+ const parsedDate = new Date(date);
239
+ return isNaN(parsedDate.getTime()) ? void 0 : this.epochTime(parsedDate);
240
240
  }
241
241
  parseDateWindow(expiration, start) {
242
242
  const dateLessThan = this.parseDate(expiration);
243
243
  if (!dateLessThan) {
244
- throw new Error("dateLessThan is invalid. Ensure the date string is compatible with the Date constructor.");
244
+ throw new Error("dateLessThan is invalid. Ensure the date value is compatible with the Date constructor.");
245
245
  }
246
246
  return {
247
247
  dateLessThan,
package/dist-es/sign.js CHANGED
@@ -188,13 +188,13 @@ class CloudfrontSignBuilder {
188
188
  if (!date) {
189
189
  return undefined;
190
190
  }
191
- const parsedDate = Date.parse(date);
192
- return isNaN(parsedDate) ? undefined : this.epochTime(new Date(parsedDate));
191
+ const parsedDate = new Date(date);
192
+ return isNaN(parsedDate.getTime()) ? undefined : this.epochTime(parsedDate);
193
193
  }
194
194
  parseDateWindow(expiration, start) {
195
195
  const dateLessThan = this.parseDate(expiration);
196
196
  if (!dateLessThan) {
197
- throw new Error("dateLessThan is invalid. Ensure the date string is compatible with the Date constructor.");
197
+ throw new Error("dateLessThan is invalid. Ensure the date value is compatible with the Date constructor.");
198
198
  }
199
199
  return {
200
200
  dateLessThan,
@@ -23,9 +23,9 @@ export type CloudfrontSignInputWithParameters = CloudfrontSignerCredentials & {
23
23
  /** The URL string to sign. */
24
24
  url: string;
25
25
  /** The date string for when the signed URL or cookie can no longer be accessed */
26
- dateLessThan: string;
26
+ dateLessThan: string | number | Date;
27
27
  /** The date string for when the signed URL or cookie can start to be accessed. */
28
- dateGreaterThan?: string;
28
+ dateGreaterThan?: string | number | Date;
29
29
  /** The IP address string to restrict signed URL access to. */
30
30
  ipAddress?: string;
31
31
  /**
@@ -8,8 +8,8 @@ export type CloudfrontSignerCredentials = {
8
8
  };
9
9
  export type CloudfrontSignInputWithParameters = CloudfrontSignerCredentials & {
10
10
  url: string;
11
- dateLessThan: string;
12
- dateGreaterThan?: string;
11
+ dateLessThan: string | number | Date;
12
+ dateGreaterThan?: string | number | Date;
13
13
  ipAddress?: string;
14
14
  policy?: never;
15
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/cloudfront-signer",
3
- "version": "3.723.0",
3
+ "version": "3.772.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline cloudfront-signer",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@smithy/url-parser": "^4.0.0",
25
+ "@smithy/url-parser": "^4.0.1",
26
26
  "tslib": "^2.6.2"
27
27
  },
28
28
  "files": [