To add the library to your project:
$ npm i --save @neoskop/ethereal-secrets-client
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');
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' });
To run integration tests in this repository:
$ docker-compose -f docker-compose.test.yml up --abort-on-container-exit --build