aws-v3-sdk 1.0.4 → 1.0.5

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.
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
2
  Lambda: require('./lambda'),
3
- DynamoDB: require('./dynamoDB')
3
+ DynamoDB: require('./dynamoDB'),
4
+ EnvironmentCredentials: require('./credential')
4
5
  }
@@ -0,0 +1,21 @@
1
+ const { getDefaultRoleAssumerWithWebIdentity } = require('@aws-sdk/client-sts')
2
+ const { defaultProvider } = require('@aws-sdk/credential-provider-node')
3
+
4
+ class EnvironmentCredentials {
5
+ constructor (region) {
6
+ this.region = region
7
+ return this.getCredential.bind(this)()
8
+ }
9
+
10
+ async getCredential () {
11
+ const cred = defaultProvider({
12
+ roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity({
13
+ region: this.region
14
+ })
15
+ })
16
+
17
+ return (await cred())
18
+ }
19
+ }
20
+
21
+ module.exports = EnvironmentCredentials
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-v3-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "AWS v3 SDK Utils",
5
5
  "main": "index.js",
6
6
  "scripts": {