@aws-sdk/dsql-signer 3.901.0 → 3.906.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 +52 -84
- package/package.json +2 -2
package/dist-cjs/index.js
CHANGED
|
@@ -1,87 +1,55 @@
|
|
|
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
|
-
}
|
|
75
|
-
async getDbConnectAuthToken() {
|
|
76
|
-
return this._getAuthToken("DbConnect");
|
|
77
|
-
}
|
|
78
|
-
async getDbConnectAdminAuthToken() {
|
|
79
|
-
return this._getAuthToken("DbConnectAdmin");
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
-
|
|
84
|
-
0 && (module.exports = {
|
|
85
|
-
DsqlSigner
|
|
86
|
-
});
|
|
8
|
+
class DsqlSigner {
|
|
9
|
+
credentials;
|
|
10
|
+
hostname;
|
|
11
|
+
protocol = "https:";
|
|
12
|
+
region;
|
|
13
|
+
service = "dsql";
|
|
14
|
+
sha256;
|
|
15
|
+
expiresIn;
|
|
16
|
+
constructor(configuration) {
|
|
17
|
+
const runtimeConfiguration = runtimeConfig.getRuntimeConfig(configuration);
|
|
18
|
+
this.credentials = runtimeConfiguration.credentials;
|
|
19
|
+
this.hostname = runtimeConfiguration.hostname;
|
|
20
|
+
this.region = runtimeConfiguration.region;
|
|
21
|
+
this.sha256 = runtimeConfiguration.sha256;
|
|
22
|
+
this.expiresIn = runtimeConfiguration.expiresIn ?? 900;
|
|
23
|
+
}
|
|
24
|
+
async _getAuthToken(action) {
|
|
25
|
+
const signer = new signatureV4.SignatureV4({
|
|
26
|
+
service: this.service,
|
|
27
|
+
region: this.region,
|
|
28
|
+
credentials: this.credentials,
|
|
29
|
+
sha256: this.sha256,
|
|
30
|
+
});
|
|
31
|
+
const request = new protocolHttp.HttpRequest({
|
|
32
|
+
method: "GET",
|
|
33
|
+
protocol: this.protocol,
|
|
34
|
+
hostname: this.hostname,
|
|
35
|
+
query: {
|
|
36
|
+
Action: action,
|
|
37
|
+
},
|
|
38
|
+
headers: {
|
|
39
|
+
host: `${this.hostname}`,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const presigned = await signer.presign(request, {
|
|
43
|
+
expiresIn: this.expiresIn,
|
|
44
|
+
});
|
|
45
|
+
return utilFormatUrl.formatUrl(presigned).replace(`${this.protocol}//`, "");
|
|
46
|
+
}
|
|
47
|
+
async getDbConnectAuthToken() {
|
|
48
|
+
return this._getAuthToken("DbConnect");
|
|
49
|
+
}
|
|
50
|
+
async getDbConnectAdminAuthToken() {
|
|
51
|
+
return this._getAuthToken("DbConnectAdmin");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
87
54
|
|
|
55
|
+
exports.DsqlSigner = DsqlSigner;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/dsql-signer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.906.0",
|
|
4
4
|
"description": "Dsql utility for generating a password token that can be used for IAM authentication to a Dsql Database.",
|
|
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.906.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",
|