5.0.0 • Published 3 months ago
@neoskop/ethereal-secrets-client
Licence
MIT
Version
5.0.0
Deps
0
Size
36 kB
Vulns
0
Weekly
0
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