4.0.3 • Published 29 days ago
@ambassify/vault-client v4.0.3
vault-client
A client for storing private information.
Installation
npm install --save @ambassify/vault-client
Usage
example
const Vault = require('@ambassify/vault-client');
const vault = new Vault({
baseUrl: 'http://my-vault-instance',
token: 'my super secure access token',
key: 'some-random-generated-key-string'
});
vault.save('my-string')
.then(id => {
console.log('Vault item at id', id);
});
vault.get(someId)
.then(value => {
console.log('Vault item contained', value);
});
API
new Vault()
const vault = new Vault(options);
Creates a new instance of a VaultClient.
- options
- baseUrl The endpoint for the vault service
- token A valid access token to authenticate with the vault service.
- key The password used to encrypt the data.
.save()
vault.save(data, [salt])
Encrypts data
using the specified key
and saves it into the vault instance and returns a promise that resolves to the id
of the vault entry.
- data Any value that can be serialized using
JSON.stringify
. - salt A salt to use in the key generation process, salt is generated if not specified.
.get()
vault.get(id)
Fetches the entry at the specified id
and decrypts it. The returnvalue is a promise that resolves to the original data inserted at id
.
4.0.3
29 days ago
4.0.2
8 months ago
4.0.1
11 months ago
4.0.0
12 months ago
3.0.3
1 year ago
3.0.2
1 year ago
3.0.1
2 years ago
3.0.0
3 years ago
2.1.1
3 years ago
2.1.0
3 years ago
2.0.0
3 years ago
1.2.1
4 years ago
1.2.0
4 years ago
1.1.3
4 years ago
1.1.1
4 years ago
1.1.2
4 years ago
1.1.0
4 years ago
1.0.1
4 years ago
1.0.0
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
7 years ago