@aws-sdk/rds-signer 3.901.0 → 3.907.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 +50 -82
- package/package.json +2 -2
package/dist-cjs/index.js
CHANGED
|
@@ -1,85 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
3
|
+
var utilFormatUrl = require('@aws-sdk/util-format-url');
|
|
4
|
+
var protocolHttp = require('@smithy/protocol-http');
|
|
5
|
+
var signatureV4 = require('@smithy/signature-v4');
|
|
6
|
+
var runtimeConfig = require('./runtimeConfig');
|
|
27
7
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
const presigned = await signer.presign(request, {
|
|
75
|
-
expiresIn: 900
|
|
76
|
-
});
|
|
77
|
-
return (0, import_util_format_url.formatUrl)(presigned).replace(`${this.protocol}//`, "");
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
-
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
Signer
|
|
84
|
-
});
|
|
8
|
+
class Signer {
|
|
9
|
+
credentials;
|
|
10
|
+
hostname;
|
|
11
|
+
port;
|
|
12
|
+
protocol = "https:";
|
|
13
|
+
region;
|
|
14
|
+
service = "rds-db";
|
|
15
|
+
sha256;
|
|
16
|
+
username;
|
|
17
|
+
constructor(configuration) {
|
|
18
|
+
const runtimeConfiguration = runtimeConfig.getRuntimeConfig(configuration);
|
|
19
|
+
this.credentials = runtimeConfiguration.credentials;
|
|
20
|
+
this.hostname = runtimeConfiguration.hostname;
|
|
21
|
+
this.port = runtimeConfiguration.port;
|
|
22
|
+
this.region = runtimeConfiguration.region;
|
|
23
|
+
this.sha256 = runtimeConfiguration.sha256;
|
|
24
|
+
this.username = runtimeConfiguration.username;
|
|
25
|
+
}
|
|
26
|
+
async getAuthToken() {
|
|
27
|
+
const signer = new signatureV4.SignatureV4({
|
|
28
|
+
service: this.service,
|
|
29
|
+
region: this.region,
|
|
30
|
+
credentials: this.credentials,
|
|
31
|
+
sha256: this.sha256,
|
|
32
|
+
});
|
|
33
|
+
const request = new protocolHttp.HttpRequest({
|
|
34
|
+
method: "GET",
|
|
35
|
+
protocol: this.protocol,
|
|
36
|
+
hostname: this.hostname,
|
|
37
|
+
port: this.port,
|
|
38
|
+
query: {
|
|
39
|
+
Action: "connect",
|
|
40
|
+
DBUser: this.username,
|
|
41
|
+
},
|
|
42
|
+
headers: {
|
|
43
|
+
host: `${this.hostname}:${this.port}`,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const presigned = await signer.presign(request, {
|
|
47
|
+
expiresIn: 900,
|
|
48
|
+
});
|
|
49
|
+
return utilFormatUrl.formatUrl(presigned).replace(`${this.protocol}//`, "");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
85
52
|
|
|
53
|
+
exports.Signer = Signer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/rds-signer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.907.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",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
33
33
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
34
|
-
"@aws-sdk/credential-providers": "3.
|
|
34
|
+
"@aws-sdk/credential-providers": "3.907.0",
|
|
35
35
|
"@aws-sdk/util-format-url": "3.901.0",
|
|
36
36
|
"@smithy/config-resolver": "^4.3.0",
|
|
37
37
|
"@smithy/hash-node": "^4.2.0",
|