secretstore
v1.1.0
Published
EnergyWeb's JS Secret Store client
Downloads
45
Maintainers
Readme
EnergyWeb's Secret Store JS client
Secret Store JS client, an Npm package for interacting with OpenEthereum's Secret Store rpc
and session
modules.
Abstraction layer on top of the official
secretstore RPC API and
secretstore sessions.
Naming conventions follow the underlying APIs'.
Maintainers
Primary: Adam Nagy (@ngyam)
Documentation
https://energywebfoundation.github.io/secretstore-js/index.html
The documentation is for this package and its functions. For more information on how Secret Store works, please refer to the OpenEthereum wiki. Most of the function descriptions have been copied from there.
Quickstart
In your project:
npm install secretstore
or
yarn add secretstore
Then
Javascript
const secretstore = require("secretstore");
// using the OpenEthereum's secretstore rpc module
// should be used on your local node for trust reasons
const sslac = new secretstore.SecretStoreRpcApiClient("http://127.0.0.1:8545");
sslac.<method>...
// using the OpenEthereum's secretstore session module
const sssc = new secretstore.SecretStoreSessionClient("http://127.0.0.1:8090");
sssc.<method>...
Typescript
import {SecretStoreRpcApiClient, SecretStoreSessionClient} from "secretstore";
// using the OpenEthereum's secretstore rpc module
// should be used on your local node for trust reasons
const sslac = new SecretStoreRpcApiClient("http://127.0.0.1:8545");
sslac.<method>...
// using the OpenEthereum's secretstore session module
const sssc = new SecretStoreSessionClient("http://127.0.0.1:8090");
sssc.<method>...
If you wonder how to set up a Secret Store cluster, check out the official config guide and peek into the nodes_ss_dev/ folder.
Note: Non-session Secret Store RPC calls work with a regular Parity client too, which is not compiled with the special secretstore feature.
Examples
- You can see some examples amongst the tests.
- The official Parity Secret Store tutorial was reproduced with this client in this repo: https://github.com/ngyam/tutorial-secretstore-privatetx
Tested with
- Locally compiled Parity client v2.6.8.
Contributing
Please read contributing and our code of conduct for details.
Getting started (as a dev)
Prerequisites
- node, npm
Installing
git clone https://github.com/energywebfoundation/secretstore-js.git
cd secretstore-js
yarn
Running the tests
ACHTUNG: make sure to start the local secret store cluster first.
Your Secret Store enabled Parity/OpenEthereum client binary has to be placed in the root folder of the project with the name parity
. It is shown in the official tutorial how to compile with Secret Store enabled. Use latest master branch preferably.
Then:
- start nodes
yarn start
- run tests
yarn test
- When done fiddling around:
yarn stop
- Optional: if you need to clean up chaindb/secretstore
yarn clear
To fill up the test accounts with some ethers, you can use the nodes_ss_dev/funclocals.sh script.
Versioning
We use SemVer for versioning.
License
This project is licensed under GPL-3.0 - see the LICENSE file for details.
Acknowledgments
- Special thanks to Parity