4.0.4 • Published 1 year ago
@ambassify/vault-client v4.0.4
vault-client
A client for storing private information.
Installation
npm install --save @ambassify/vault-clientUsage
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.4
1 year ago
4.0.3
2 years ago
4.0.2
2 years ago
4.0.1
2 years ago
4.0.0
2 years ago
3.0.3
3 years ago
3.0.2
3 years ago
3.0.1
4 years ago
3.0.0
4 years ago
2.1.1
4 years ago
2.1.0
5 years ago
2.0.0
5 years ago
1.2.1
5 years ago
1.2.0
5 years ago
1.1.3
6 years ago
1.1.1
6 years ago
1.1.2
6 years ago
1.1.0
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
8 years ago