@middy/secrets-manager 4.0.0 → 4.0.2

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.
Files changed (2) hide show
  1. package/README.md +0 -72
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -36,78 +36,6 @@
36
36
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/secrets-manager">https://middy.js.org/docs/middlewares/secrets-manager</a></p>
37
37
  </div>
38
38
 
39
- This middleware fetches secrets from [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html).
40
-
41
- Secrets to fetch can be defined by by name. See AWS docs [here](https://docs.aws.amazon.com/secretsmanager/latest/userguide/tutorials_basic.html).
42
-
43
- Secrets are assigned to the function handler's `context` object.
44
-
45
- The Middleware makes a single [API request](https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html) for each secret as Secrets Manager does not support batch get.
46
-
47
- For each secret, you also provide the name under which its value should be added to `context`.
48
-
49
- ## Install
50
-
51
- To install this middleware you can use NPM:
52
-
53
- ```bash
54
- npm install --save @middy/secrets-manager
55
- ```
56
-
57
- ## Options
58
-
59
- - `AwsClient` (object) (default `SecretsManagerClient`): SecretsManagerClient class constructor (i.e. that has been instrumented with AWS XRay). Must be from `@aws-sdk/client-secrets-manager`.
60
- - `awsClientOptions` (object) (default `undefined`): Options to pass to SecretsManagerClient class constructor.
61
- - `awsClientAssumeRole` (string) (default `undefined`): Internal key where secrets are stored. See [@middy/sts](/packages/sts/README.md) on to set this.
62
- - `awsClientCapture` (function) (default `undefined`): Enable XRay by passing `captureAWSClient` from `aws-xray-sdk` in.
63
- - `fetchData` (object) (required): Mapping of internal key name to API request parameter `SecretId`.
64
- - `disablePrefetch` (boolean) (default `false`): On cold start requests will trigger early if they can. Setting `awsClientAssumeRole` disables prefetch.
65
- - `cacheKey` (string) (default `secrets-manager`): Cache key for the fetched data responses. Must be unique across all middleware.
66
- - `cacheExpiry` (number) (default `-1`): How long fetch data responses should be cached for. `-1`: cache forever, `0`: never cache, `n`: cache for n ms.
67
- - `setToContext` (boolean) (default `false`): Store secrets to `request.context`.
68
-
69
- NOTES:
70
-
71
- - Lambda is required to have IAM permission for `secretsmanager:GetSecretValue`
72
-
73
- ## Sample usage
74
-
75
- ```javascript
76
- import middy from '@middy/core'
77
- import secretsManager from '@middy/secrets-manager'
78
-
79
- const handler = middy((event, context) => {
80
- return {}
81
- })
82
-
83
- handler.use(
84
- secretsManager({
85
- fetchData: {
86
- apiToken: 'dev/api_token'
87
- },
88
- awsClientOptions: {
89
- region: 'us-east-1'
90
- },
91
- setToContext: true
92
- })
93
- )
94
-
95
- // Before running the function handler, the middleware will fetch from Secrets Manager
96
- handler(event, context, (_, response) => {
97
- // assuming the dev/api_token has two keys, 'Username' and 'Password'
98
- t.is(context.apiToken.Username, 'username')
99
- t.is(context.apiToken.Password, 'password')
100
- })
101
- ```
102
-
103
- ## Middy documentation and examples
104
-
105
- For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
106
-
107
- ## Contributing
108
-
109
- Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
110
-
111
39
  ## License
112
40
 
113
41
  Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/secrets-manager",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Secrets Manager middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,13 +60,13 @@
60
60
  },
61
61
  "homepage": "https://middy.js.org",
62
62
  "dependencies": {
63
- "@middy/util": "4.0.0"
63
+ "@middy/util": "4.0.2"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@aws-sdk/client-secrets-manager": "^3.186.0",
67
- "@middy/core": "4.0.0",
67
+ "@middy/core": "4.0.2",
68
68
  "@types/aws-lambda": "^8.10.101",
69
69
  "aws-xray-sdk": "^3.3.3"
70
70
  },
71
- "gitHead": "582286144bcd79968a8c7c2f8867a23c80079a47"
71
+ "gitHead": "c77c9413ecb80999a71b67ff97edac1fed2ca754"
72
72
  }