@aws-sdk/rds-signer 3.181.0 → 3.185.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/CHANGELOG.md +16 -0
- package/dist-es/Signer.js +28 -41
- package/dist-es/runtimeConfig.browser.js +8 -4
- package/dist-es/runtimeConfig.js +8 -4
- package/dist-es/runtimeConfig.native.js +8 -4
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.185.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.184.0...v3.185.0) (2022-10-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/rds-signer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/rds-signer
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [3.181.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.180.0...v3.181.0) (2022-09-29)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @aws-sdk/rds-signer
|
package/dist-es/Signer.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { SignatureV4 } from "@aws-sdk/signature-v4";
|
|
4
3
|
import { formatUrl } from "@aws-sdk/util-format-url";
|
|
5
4
|
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export class Signer {
|
|
6
|
+
constructor(configuration) {
|
|
8
7
|
this.protocol = "https:";
|
|
9
8
|
this.service = "rds-db";
|
|
10
|
-
|
|
9
|
+
const runtimeConfiguration = __getRuntimeConfig(configuration);
|
|
11
10
|
this.credentials = runtimeConfiguration.credentials;
|
|
12
11
|
this.hostname = runtimeConfiguration.hostname;
|
|
13
12
|
this.port = runtimeConfiguration.port;
|
|
@@ -15,41 +14,29 @@ var Signer = (function () {
|
|
|
15
14
|
this.sha256 = runtimeConfiguration.sha256;
|
|
16
15
|
this.username = runtimeConfiguration.username;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
signer = new SignatureV4({
|
|
25
|
-
service: this.service,
|
|
26
|
-
region: this.region,
|
|
27
|
-
credentials: this.credentials,
|
|
28
|
-
sha256: this.sha256,
|
|
29
|
-
});
|
|
30
|
-
request = new HttpRequest({
|
|
31
|
-
method: "GET",
|
|
32
|
-
protocol: this.protocol,
|
|
33
|
-
hostname: this.hostname,
|
|
34
|
-
port: this.port,
|
|
35
|
-
query: {
|
|
36
|
-
Action: "connect",
|
|
37
|
-
DBUser: this.username,
|
|
38
|
-
},
|
|
39
|
-
headers: {
|
|
40
|
-
host: "".concat(this.hostname, ":").concat(this.port),
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
return [4, signer.presign(request, {
|
|
44
|
-
expiresIn: 900,
|
|
45
|
-
})];
|
|
46
|
-
case 1:
|
|
47
|
-
presigned = _a.sent();
|
|
48
|
-
return [2, formatUrl(presigned).replace("".concat(this.protocol, "//"), "")];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
17
|
+
async getAuthToken() {
|
|
18
|
+
const signer = new SignatureV4({
|
|
19
|
+
service: this.service,
|
|
20
|
+
region: this.region,
|
|
21
|
+
credentials: this.credentials,
|
|
22
|
+
sha256: this.sha256,
|
|
51
23
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
24
|
+
const request = new HttpRequest({
|
|
25
|
+
method: "GET",
|
|
26
|
+
protocol: this.protocol,
|
|
27
|
+
hostname: this.hostname,
|
|
28
|
+
port: this.port,
|
|
29
|
+
query: {
|
|
30
|
+
Action: "connect",
|
|
31
|
+
DBUser: this.username,
|
|
32
|
+
},
|
|
33
|
+
headers: {
|
|
34
|
+
host: `${this.hostname}:${this.port}`,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const presigned = await signer.presign(request, {
|
|
38
|
+
expiresIn: 900,
|
|
39
|
+
});
|
|
40
|
+
return formatUrl(presigned).replace(`${this.protocol}//`, "");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
3
2
|
import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export const getRuntimeConfig = (config) => {
|
|
4
|
+
return {
|
|
5
|
+
runtime: "browser",
|
|
6
|
+
sha256: config?.sha256 ?? Sha256,
|
|
7
|
+
credentials: invalidProvider("Credential is missing"),
|
|
8
|
+
region: invalidProvider("Region is missing"),
|
|
9
|
+
...config,
|
|
10
|
+
};
|
|
7
11
|
};
|
package/dist-es/runtimeConfig.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
|
|
3
2
|
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
|
|
4
3
|
import { Hash } from "@aws-sdk/hash-node";
|
|
5
4
|
import { loadConfig } from "@aws-sdk/node-config-provider";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const getRuntimeConfig = (config) => {
|
|
6
|
+
return {
|
|
7
|
+
runtime: "node",
|
|
8
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
9
|
+
credentials: config?.credentials ?? fromNodeProviderChain(),
|
|
10
|
+
region: config?.region ?? loadConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
11
|
+
...config,
|
|
12
|
+
};
|
|
9
13
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
3
2
|
import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export const getRuntimeConfig = (config) => {
|
|
4
|
+
return {
|
|
5
|
+
runtime: "react-native",
|
|
6
|
+
sha256: config?.sha256 ?? Sha256,
|
|
7
|
+
credentials: invalidProvider("Credential is missing"),
|
|
8
|
+
region: invalidProvider("Region is missing"),
|
|
9
|
+
...config,
|
|
10
|
+
};
|
|
7
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/rds-signer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.185.0",
|
|
4
4
|
"description": "RDS utility for generating a password that can be used for IAM authentication to an RDS DB.",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@aws-crypto/sha256-browser": "2.0.0",
|
|
28
28
|
"@aws-crypto/sha256-js": "2.0.0",
|
|
29
|
-
"@aws-sdk/config-resolver": "3.
|
|
30
|
-
"@aws-sdk/credential-providers": "3.
|
|
31
|
-
"@aws-sdk/hash-node": "3.
|
|
32
|
-
"@aws-sdk/invalid-dependency": "3.
|
|
33
|
-
"@aws-sdk/node-config-provider": "3.
|
|
34
|
-
"@aws-sdk/protocol-http": "3.
|
|
35
|
-
"@aws-sdk/signature-v4": "3.
|
|
36
|
-
"@aws-sdk/util-format-url": "3.
|
|
29
|
+
"@aws-sdk/config-resolver": "3.183.0",
|
|
30
|
+
"@aws-sdk/credential-providers": "3.185.0",
|
|
31
|
+
"@aws-sdk/hash-node": "3.183.0",
|
|
32
|
+
"@aws-sdk/invalid-dependency": "3.183.0",
|
|
33
|
+
"@aws-sdk/node-config-provider": "3.183.0",
|
|
34
|
+
"@aws-sdk/protocol-http": "3.183.0",
|
|
35
|
+
"@aws-sdk/signature-v4": "3.183.0",
|
|
36
|
+
"@aws-sdk/util-format-url": "3.183.0",
|
|
37
37
|
"tslib": "^2.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@aws-sdk/types": "3.
|
|
40
|
+
"@aws-sdk/types": "3.183.0",
|
|
41
41
|
"@types/node": "^10.0.0",
|
|
42
42
|
"concurrently": "7.0.0",
|
|
43
43
|
"downlevel-dts": "0.10.1",
|