Skip to content

Latest commit

 

History

History

client

Ethereal Secrets Client

Usage

To add the library to your project:

$ npm i --save @neoskop/ethereal-secrets-client

Local 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