@aws-sdk/cloudfront-signer 3.910.0 → 3.914.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 +13 -2
- package/dist-es/sign.js +13 -2
- package/package.json +3 -2
package/dist-cjs/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var protocols = require('@smithy/core/protocols');
|
|
3
4
|
var crypto = require('crypto');
|
|
4
5
|
|
|
5
6
|
function getSignedUrl({ dateLessThan, dateGreaterThan, url, keyPairId, privateKey, ipAddress, policy, passphrase, }) {
|
|
@@ -36,9 +37,19 @@ function getSignedUrl({ dateLessThan, dateGreaterThan, url, keyPairId, privateKe
|
|
|
36
37
|
const startFlag = baseUrl.includes("?") ? "&" : "?";
|
|
37
38
|
const params = Object.entries(cloudfrontSignBuilder.createCloudfrontAttribute())
|
|
38
39
|
.filter(([, value]) => value !== undefined)
|
|
39
|
-
.map(([key, value]) => `${
|
|
40
|
+
.map(([key, value]) => `${protocols.extendedEncodeURIComponent(key)}=${protocols.extendedEncodeURIComponent(value)}`)
|
|
40
41
|
.join("&");
|
|
41
|
-
|
|
42
|
+
function encodeBaseUrlQuery(url) {
|
|
43
|
+
if (url.includes("?")) {
|
|
44
|
+
const [hostAndPath, query] = url.split("?");
|
|
45
|
+
const params = [...new URLSearchParams(query).entries()]
|
|
46
|
+
.map(([key, value]) => `${protocols.extendedEncodeURIComponent(key)}=${protocols.extendedEncodeURIComponent(value)}`)
|
|
47
|
+
.join("&");
|
|
48
|
+
return `${hostAndPath}?${params}`;
|
|
49
|
+
}
|
|
50
|
+
return url;
|
|
51
|
+
}
|
|
52
|
+
const urlString = encodeBaseUrlQuery(baseUrl) + startFlag + params;
|
|
42
53
|
return getResource(urlString);
|
|
43
54
|
}
|
|
44
55
|
function getSignedCookies({ ipAddress, url, privateKey, keyPairId, dateLessThan, dateGreaterThan, policy, passphrase, }) {
|
package/dist-es/sign.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { extendedEncodeURIComponent } from "@smithy/core/protocols";
|
|
1
2
|
import { createSign } from "crypto";
|
|
2
3
|
export function getSignedUrl({ dateLessThan, dateGreaterThan, url, keyPairId, privateKey, ipAddress, policy, passphrase, }) {
|
|
3
4
|
const cloudfrontSignBuilder = new CloudfrontSignBuilder({
|
|
@@ -33,9 +34,19 @@ export function getSignedUrl({ dateLessThan, dateGreaterThan, url, keyPairId, pr
|
|
|
33
34
|
const startFlag = baseUrl.includes("?") ? "&" : "?";
|
|
34
35
|
const params = Object.entries(cloudfrontSignBuilder.createCloudfrontAttribute())
|
|
35
36
|
.filter(([, value]) => value !== undefined)
|
|
36
|
-
.map(([key, value]) => `${
|
|
37
|
+
.map(([key, value]) => `${extendedEncodeURIComponent(key)}=${extendedEncodeURIComponent(value)}`)
|
|
37
38
|
.join("&");
|
|
38
|
-
|
|
39
|
+
function encodeBaseUrlQuery(url) {
|
|
40
|
+
if (url.includes("?")) {
|
|
41
|
+
const [hostAndPath, query] = url.split("?");
|
|
42
|
+
const params = [...new URLSearchParams(query).entries()]
|
|
43
|
+
.map(([key, value]) => `${extendedEncodeURIComponent(key)}=${extendedEncodeURIComponent(value)}`)
|
|
44
|
+
.join("&");
|
|
45
|
+
return `${hostAndPath}?${params}`;
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
const urlString = encodeBaseUrlQuery(baseUrl) + startFlag + params;
|
|
39
50
|
return getResource(urlString);
|
|
40
51
|
}
|
|
41
52
|
export function getSignedCookies({ ipAddress, url, privateKey, keyPairId, dateLessThan, dateGreaterThan, policy, passphrase, }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/cloudfront-signer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.914.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",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@smithy/
|
|
26
|
+
"@smithy/core": "^3.17.0",
|
|
27
|
+
"@smithy/url-parser": "^4.2.3",
|
|
27
28
|
"tslib": "^2.6.2"
|
|
28
29
|
},
|
|
29
30
|
"files": [
|