@neoskop/ethereal-secrets-client
v4.2.0
Published
## Usage
Readme
Ethereal Secrets Client
Usage
To add the library to your project:
$ npm i --save @neoskop/ethereal-secrets-clientLocal Mode
to store a value bar under the key foo encrypted in the session storage:
const client = new EtherealSecretsClient({
endpoint: 'http://localhost:8080/secrets',
});
await client.saveLocal('foo', 'bar');
await client.getLocal('foo'); // => bar
await client.removeLocal('foo');Remote Mode
To store a value bar encrypted on the server:
const client = new EtherealSecretsClient({
endpoint: 'http://localhost:8080/secrets',
});
const result = await client.saveRemote('foo', 'bar');
await client.getRemote(result.fragmentIdentifier); // => bar
await client.removeRemote(result.fragmentIdentifier);To use a second factor:
const client = new EtherealSecretsClient({
endpoint: 'http://localhost:8080/secrets',
});
const result = await client.saveRemote('foo', 'bar', { secondFactor: 'baz' });
await client.getRemote(result.fragmentIdentifier, { secondFactor: 'baz' }); // => bar
await client.removeRemote(result.fragmentIdentifier, { secondFactor: 'baz' });Test suite
To run integration tests in this repository:
$ docker-compose -f docker-compose.test.yml up --abort-on-container-exit --build