@aws-sdk/s3-presigned-post 3.1045.0 → 3.1046.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,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var clientS3 = require('@aws-sdk/client-s3');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var util = require('@aws-sdk/core/util');
|
|
5
|
+
var endpoints = require('@smithy/core/endpoints');
|
|
6
|
+
var serde = require('@smithy/core/serde');
|
|
6
7
|
var signatureV4 = require('@smithy/signature-v4');
|
|
7
|
-
var utilHexEncoding = require('@smithy/util-hex-encoding');
|
|
8
|
-
var utilUtf8 = require('@smithy/util-utf8');
|
|
9
8
|
|
|
10
9
|
const ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
|
11
10
|
const CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
|
@@ -53,25 +52,25 @@ const createPresignedPost = async (client, { Bucket, Key, Conditions = [], Field
|
|
|
53
52
|
})));
|
|
54
53
|
const signingKey = await signatureV4.getSigningKey(sha256, clientCredentials, shortDate, clientRegion, "s3");
|
|
55
54
|
const signature = await hmac(sha256, signingKey, encodedPolicy);
|
|
56
|
-
const endpoint =
|
|
55
|
+
const endpoint = endpoints.toEndpointV1(await endpoints.getEndpointFromInstructions({ Bucket, Key }, clientS3.PutObjectCommand, {
|
|
57
56
|
...client.config,
|
|
58
57
|
}, {
|
|
59
58
|
logger: client.config.logger,
|
|
60
59
|
}));
|
|
61
60
|
return {
|
|
62
|
-
url:
|
|
61
|
+
url: util.formatUrl(endpoint),
|
|
63
62
|
fields: {
|
|
64
63
|
...fields,
|
|
65
64
|
key: Key,
|
|
66
65
|
Policy: encodedPolicy,
|
|
67
|
-
[SIGNATURE_QUERY_PARAM]:
|
|
66
|
+
[SIGNATURE_QUERY_PARAM]: serde.toHex(signature),
|
|
68
67
|
},
|
|
69
68
|
};
|
|
70
69
|
};
|
|
71
70
|
const iso8601 = (date) => date.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
72
71
|
const hmac = (ctor, secret, data) => {
|
|
73
72
|
const hash = new ctor(secret);
|
|
74
|
-
hash.update(
|
|
73
|
+
hash.update(serde.toUint8Array(data));
|
|
75
74
|
return hash.digest();
|
|
76
75
|
};
|
|
77
76
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { PutObjectCommand } from "@aws-sdk/client-s3";
|
|
2
|
-
import { formatUrl } from "@aws-sdk/util
|
|
3
|
-
import { getEndpointFromInstructions, toEndpointV1 } from "@smithy/
|
|
2
|
+
import { formatUrl } from "@aws-sdk/core/util";
|
|
3
|
+
import { getEndpointFromInstructions, toEndpointV1 } from "@smithy/core/endpoints";
|
|
4
|
+
import { toHex, toUint8Array } from "@smithy/core/serde";
|
|
4
5
|
import { createScope, getSigningKey } from "@smithy/signature-v4";
|
|
5
|
-
import { toHex } from "@smithy/util-hex-encoding";
|
|
6
|
-
import { toUint8Array } from "@smithy/util-utf8";
|
|
7
6
|
import { ALGORITHM_IDENTIFIER, ALGORITHM_QUERY_PARAM, AMZ_DATE_QUERY_PARAM, CREDENTIAL_QUERY_PARAM, SIGNATURE_QUERY_PARAM, TOKEN_QUERY_PARAM, } from "./constants";
|
|
8
7
|
export const createPresignedPost = async (client, { Bucket, Key, Conditions = [], Fields = {}, Expires = 3600 }) => {
|
|
9
8
|
const { systemClockOffset, base64Encoder, utf8Decoder, sha256 } = client.config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/s3-presigned-post",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1046.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 s3-presigned-post",
|
|
@@ -25,14 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aws-sdk/client-s3": "3.
|
|
28
|
+
"@aws-sdk/client-s3": "3.1046.0",
|
|
29
|
+
"@aws-sdk/core": "^3.974.9",
|
|
29
30
|
"@aws-sdk/types": "^3.973.8",
|
|
30
|
-
"@
|
|
31
|
-
"@smithy/
|
|
32
|
-
"@smithy/signature-v4": "^5.3.14",
|
|
31
|
+
"@smithy/core": "^3.24.1",
|
|
32
|
+
"@smithy/signature-v4": "^5.4.1",
|
|
33
33
|
"@smithy/types": "^4.14.1",
|
|
34
|
-
"@smithy/util-hex-encoding": "^4.2.2",
|
|
35
|
-
"@smithy/util-utf8": "^4.2.2",
|
|
36
34
|
"tslib": "^2.6.2"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|