@aws-sdk/dsql-signer 3.1068.0 → 3.1070.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,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var signatureV4 = require('@smithy/signature-v4');
|
|
6
|
-
var runtimeConfig = require('./runtimeConfig');
|
|
1
|
+
const { formatUrl } = require("@aws-sdk/core/util");
|
|
2
|
+
const { HttpRequest } = require("@smithy/core/protocols");
|
|
3
|
+
const { SignatureV4 } = require("@smithy/signature-v4");
|
|
4
|
+
const { getRuntimeConfig } = require("./runtimeConfig");
|
|
7
5
|
|
|
8
6
|
class DsqlSigner {
|
|
9
7
|
credentials;
|
|
@@ -14,7 +12,7 @@ class DsqlSigner {
|
|
|
14
12
|
sha256;
|
|
15
13
|
expiresIn;
|
|
16
14
|
constructor(configuration) {
|
|
17
|
-
const runtimeConfiguration =
|
|
15
|
+
const runtimeConfiguration = getRuntimeConfig(configuration);
|
|
18
16
|
this.credentials = runtimeConfiguration.credentials;
|
|
19
17
|
this.hostname = runtimeConfiguration.hostname;
|
|
20
18
|
this.region = runtimeConfiguration.region;
|
|
@@ -22,13 +20,13 @@ class DsqlSigner {
|
|
|
22
20
|
this.expiresIn = runtimeConfiguration.expiresIn ?? 900;
|
|
23
21
|
}
|
|
24
22
|
async _getAuthToken(action) {
|
|
25
|
-
const signer = new
|
|
23
|
+
const signer = new SignatureV4({
|
|
26
24
|
service: this.service,
|
|
27
25
|
region: this.region,
|
|
28
26
|
credentials: this.credentials,
|
|
29
27
|
sha256: this.sha256,
|
|
30
28
|
});
|
|
31
|
-
const request = new
|
|
29
|
+
const request = new HttpRequest({
|
|
32
30
|
method: "GET",
|
|
33
31
|
protocol: this.protocol,
|
|
34
32
|
hostname: this.hostname,
|
|
@@ -42,7 +40,7 @@ class DsqlSigner {
|
|
|
42
40
|
const presigned = await signer.presign(request, {
|
|
43
41
|
expiresIn: this.expiresIn,
|
|
44
42
|
});
|
|
45
|
-
return
|
|
43
|
+
return formatUrl(presigned).replace(`${this.protocol}//`, "");
|
|
46
44
|
}
|
|
47
45
|
async getDbConnectAuthToken() {
|
|
48
46
|
return this._getAuthToken("DbConnect");
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getRuntimeConfig =
|
|
4
|
-
const sha256_browser_1 = require("@aws-crypto/sha256-browser");
|
|
5
|
-
const client_1 = require("@smithy/core/client");
|
|
6
|
-
const getRuntimeConfig = (config) => {
|
|
1
|
+
const { Sha256 } = require("@aws-crypto/sha256-browser");
|
|
2
|
+
const { invalidProvider } = require("@smithy/core/client");
|
|
3
|
+
exports.getRuntimeConfig = (config) => {
|
|
7
4
|
return {
|
|
8
5
|
runtime: "browser",
|
|
9
|
-
sha256: config?.sha256 ??
|
|
10
|
-
credentials:
|
|
11
|
-
region:
|
|
6
|
+
sha256: config?.sha256 ?? Sha256,
|
|
7
|
+
credentials: invalidProvider("Credential is missing"),
|
|
8
|
+
region: invalidProvider("Region is missing"),
|
|
12
9
|
...config,
|
|
13
10
|
};
|
|
14
11
|
};
|
|
15
|
-
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const config_1 = require("@smithy/core/config");
|
|
6
|
-
const serde_1 = require("@smithy/core/serde");
|
|
7
|
-
const getRuntimeConfig = (config) => {
|
|
1
|
+
const { defaultProvider } = require("@aws-sdk/credential-provider-node");
|
|
2
|
+
const { loadConfig, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } = require("@smithy/core/config");
|
|
3
|
+
const { Hash } = require("@smithy/core/serde");
|
|
4
|
+
exports.getRuntimeConfig = (config) => {
|
|
8
5
|
return {
|
|
9
6
|
runtime: "node",
|
|
10
|
-
sha256: config?.sha256 ??
|
|
11
|
-
credentials: config?.credentials ??
|
|
12
|
-
region: config?.region ??
|
|
7
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
8
|
+
credentials: config?.credentials ?? defaultProvider(),
|
|
9
|
+
region: config?.region ?? loadConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
13
10
|
...config,
|
|
14
11
|
};
|
|
15
12
|
};
|
|
16
|
-
exports.getRuntimeConfig = getRuntimeConfig;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getRuntimeConfig =
|
|
4
|
-
const sha256_js_1 = require("@aws-crypto/sha256-js");
|
|
5
|
-
const client_1 = require("@smithy/core/client");
|
|
6
|
-
const getRuntimeConfig = (config) => {
|
|
1
|
+
const { Sha256 } = require("@aws-crypto/sha256-js");
|
|
2
|
+
const { invalidProvider } = require("@smithy/core/client");
|
|
3
|
+
exports.getRuntimeConfig = (config) => {
|
|
7
4
|
return {
|
|
8
5
|
runtime: "react-native",
|
|
9
|
-
sha256: config?.sha256 ??
|
|
10
|
-
credentials:
|
|
11
|
-
region:
|
|
6
|
+
sha256: config?.sha256 ?? Sha256,
|
|
7
|
+
credentials: invalidProvider("Credential is missing"),
|
|
8
|
+
region: invalidProvider("Region is missing"),
|
|
12
9
|
...config,
|
|
13
10
|
};
|
|
14
11
|
};
|
|
15
|
-
exports.getRuntimeConfig = getRuntimeConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/dsql-signer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1070.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",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
10
10
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
11
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
11
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
12
12
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
13
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
13
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
14
14
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
15
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
15
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
16
16
|
"extract:docs": "api-extractor run --local",
|
|
17
17
|
"test": "yarn g:vitest run",
|
|
18
18
|
"test:watch": "yarn g:vitest watch",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
33
33
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
34
|
-
"@aws-sdk/core": "^3.974.
|
|
35
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
34
|
+
"@aws-sdk/core": "^3.974.21",
|
|
35
|
+
"@aws-sdk/credential-provider-node": "^3.972.56",
|
|
36
36
|
"@smithy/core": "^3.24.6",
|
|
37
37
|
"@smithy/signature-v4": "^5.4.6",
|
|
38
38
|
"@smithy/types": "^4.14.3",
|