node-vault-client 0.6.0 → 0.6.1
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/package.json +1 -1
- package/src/VaultClient.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-vault-client",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "A Vault Client implemented in pure javascript for HashiCorp Vault. It supports variety of Auth Backends and performs lease renewal for issued auth token.",
|
|
5
5
|
"repository": "github:namecheap/node-vault-client",
|
|
6
6
|
"engines": {
|
package/src/VaultClient.js
CHANGED
|
@@ -165,7 +165,7 @@ class VaultClient {
|
|
|
165
165
|
return vaultConf.populate();
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
getHeaders() {
|
|
168
|
+
getHeaders(token) {
|
|
169
169
|
if (this.__namespace) {
|
|
170
170
|
return {
|
|
171
171
|
'X-Vault-Token': token.getId(),
|
|
@@ -184,7 +184,7 @@ class VaultClient {
|
|
|
184
184
|
read(path) {
|
|
185
185
|
this.__log.debug('read secret %s', path);
|
|
186
186
|
return this.__auth.getAuthToken()
|
|
187
|
-
.then(token => this.__api.makeRequest('GET', path, null, this.getHeaders()))
|
|
187
|
+
.then(token => this.__api.makeRequest('GET', path, null, this.getHeaders(token)))
|
|
188
188
|
.then(res => {
|
|
189
189
|
this.__log.debug('receive secret %s', path);
|
|
190
190
|
return Lease.fromResponse(res);
|
|
@@ -204,7 +204,7 @@ class VaultClient {
|
|
|
204
204
|
list(path) {
|
|
205
205
|
this.__log.debug('list secrets %s', path);
|
|
206
206
|
return this.__auth.getAuthToken()
|
|
207
|
-
.then(token => this.__api.makeRequest('LIST', path, null, this.getHeaders()))
|
|
207
|
+
.then(token => this.__api.makeRequest('LIST', path, null, this.getHeaders(token)))
|
|
208
208
|
.then(res => {
|
|
209
209
|
this.__log.debug('got secrets list %s', path);
|
|
210
210
|
return Lease.fromResponse(res);
|
|
@@ -225,7 +225,7 @@ class VaultClient {
|
|
|
225
225
|
write(path, data) {
|
|
226
226
|
this.__log.debug('write secret %s', path);
|
|
227
227
|
return this.__auth.getAuthToken()
|
|
228
|
-
.then((token) => this.__api.makeRequest('POST', path, data, this.getHeaders()))
|
|
228
|
+
.then((token) => this.__api.makeRequest('POST', path, data, this.getHeaders(token)))
|
|
229
229
|
.then((response) => {
|
|
230
230
|
this.__log.debug('secret %s was written', path);
|
|
231
231
|
return response;
|