JS DigitalBits Base
The xdb-digitalbits-base library is the lowest-level digitalbits helper library. It consists of classes to read, write, hash, and sign the xdr structures that are used in digitalbits-core. This is an implementation in JavaScript that can be used on either Node.js or web browsers.
Warning! Node version of this package is using
sodium-native
package, a native implementation of Ed25519 in Node.js, as an optional dependency. This means that if for any reason installation of this package fails,xdb-digitalbits-base
will fallback to the much slower implementation contained intweetnacl
.If you are using
xdb-digitalbits-base
in a browser you can ignore this. However, for production backend deployments you should definitely be usingsodium-native
. Ifsodium-native
is successfully installed and workingDigitalBitsBase.FastSigning
variable will be equaltrue
. Otherwise it will befalse
.
Quick start
- Install Bundler
- Use node version >= 12.
Clone repository, install dependencie, compile libs and link directory
git clone https://github.com/xdbfoundation/xdb-digitalbits-base
cd xdb-digitalbits-base
bundle install
yarn
yarn gulp
yarn link
Use yarn to include xdb-digitalbits-base in your own project. Execute in root directory of your project
yarn link xdb-digitalbits-base
Then require/import it in your JavaScript:
var DigitalBitsBase = require('xdb-digitalbits-base');
Usage
For information on how to use xdb-digitalbits-base, take a look at the docs in the docs folder.
Testing
To run all tests:
yarn gulp test
To run a specific set of tests:
yarn gulp test:node
yarn gulp test:browser
You can also run yarn test
for a simpler subset of the test cases.
Documentation
Documentation for this repo lives inside the docs folder.
License
xdb-digitalbits-base is licensed under an Apache-2.0 license. See the LICENSE file for details.