@aws-sdk/cloudfront-signer 3.1064.0 → 3.1074.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
@@ -1,7 +1,5 @@
1
- 'use strict';
2
-
3
- var protocols = require('@smithy/core/protocols');
4
- var node_crypto = require('node:crypto');
1
+ const { extendedEncodeURIComponent } = require("@smithy/core/protocols");
2
+ const { createSign } = require("node:crypto");
5
3
 
6
4
  function getSignedUrl({ dateLessThan, dateGreaterThan, url, keyPairId, privateKey, ipAddress, policy, passphrase, algorithm, }) {
7
5
  const cloudfrontSignBuilder = new CloudfrontSignBuilder({
@@ -42,7 +40,7 @@ function getSignedUrl({ dateLessThan, dateGreaterThan, url, keyPairId, privateKe
42
40
  }
43
41
  const params = Object.entries(attributes)
44
42
  .filter(([, value]) => value !== undefined)
45
- .map(([key, value]) => `${protocols.extendedEncodeURIComponent(key)}=${protocols.extendedEncodeURIComponent(value)}`)
43
+ .map(([key, value]) => `${extendedEncodeURIComponent(key)}=${extendedEncodeURIComponent(value)}`)
46
44
  .join("&");
47
45
  const urlString = baseUrl + startFlag + params;
48
46
  return getResource(urlString);
@@ -107,7 +105,7 @@ function encodeUrlPath(url) {
107
105
  let encodedQuery = "";
108
106
  if (rawQuery) {
109
107
  for (const [key, value] of new URLSearchParams(rawQuery.slice(1)).entries()) {
110
- encodedQuery += `${encodedQuery ? "&" : "?"}${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
108
+ encodedQuery += `${encodedQuery ? "&" : "?"}${encodeURIComponent(key).replace(/'/g, "%27")}=${encodeURIComponent(value).replace(/'/g, "%27")}`;
111
109
  }
112
110
  }
113
111
  return origin + encodedPath + encodedQuery;
@@ -251,7 +249,7 @@ class CloudfrontSignBuilder {
251
249
  };
252
250
  }
253
251
  signData(data, privateKey, passphrase) {
254
- const sign = node_crypto.createSign(this.algorithm === "SHA256" ? "RSA-SHA256" : "RSA-SHA1");
252
+ const sign = createSign(this.algorithm === "SHA256" ? "RSA-SHA256" : "RSA-SHA1");
255
253
  sign.update(data);
256
254
  return sign.sign({ key: privateKey, passphrase }, "base64");
257
255
  }
package/dist-es/sign.js CHANGED
@@ -104,7 +104,7 @@ function encodeUrlPath(url) {
104
104
  let encodedQuery = "";
105
105
  if (rawQuery) {
106
106
  for (const [key, value] of new URLSearchParams(rawQuery.slice(1)).entries()) {
107
- encodedQuery += `${encodedQuery ? "&" : "?"}${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
107
+ encodedQuery += `${encodedQuery ? "&" : "?"}${encodeURIComponent(key).replace(/'/g, "%27")}=${encodeURIComponent(value).replace(/'/g, "%27")}`;
108
108
  }
109
109
  }
110
110
  return origin + encodedPath + encodedQuery;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aws-sdk/cloudfront-signer",
3
- "version": "3.1064.0",
3
+ "version": "3.1074.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline",
7
- "build:es": "tsc -p tsconfig.es.json",
7
+ "build:es": "premove dist-es && tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
9
- "build:types": "tsc -p tsconfig.types.json",
9
+ "build:types": "premove dist-types && tsc -p tsconfig.types.json",
10
10
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
11
+ "clean": "premove dist-cjs dist-es dist-types",
12
12
  "extract:docs": "api-extractor run --local",
13
13
  "test": "yarn g:vitest run",
14
14
  "test:watch": "yarn g:vitest watch",