diff --git a/docs/source/.conf.py.swp b/docs/source/.conf.py.swp deleted file mode 100644 index 24d0812..0000000 Binary files a/docs/source/.conf.py.swp and /dev/null differ diff --git a/docs/source/conf.py b/docs/source/conf.py index d9027d1..dfbf3f9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -105,7 +105,8 @@ html_theme = 'sphinx_rtd_theme' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['nstatic'] +# html_static_path = ['nstatic'] +# Commented out this option because Sphinx can not find the path # Custom sidebar templates, must be a dictionary that maps document names # to template names. diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 4b958bb..42689b4 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -357,6 +357,25 @@ Recap: Asset Creation & Transfer .then(() => conn.searchAssets('Bicycle Inc.')) .then(assets => console.log('Found assets with serial number Bicycle Inc.:', assets)) +Seed Functionality +------------------ + +BigchainDB JavaScript driver allows you to create a keypair based on a seed. +The constructor accepts a 32 byte seed. One of the ways to create a seed from +a string (e.g. a passphrase) is the one used by ``bip39``, specifically the function ``mnemonicToSeed``. + +Install bip39 with npm: ``npm install bip39`` + +Next, require ``bip39`` in your file like this: ``var bip39 = require('bip39')`` + +At last, we can create the keypair based on a string. The function will transform the string to a byte array. +As our constructor ``Ed25519Keypair()`` only accepts a seed of 32 bytes, we slice the first 32 bytes: ``slice(0,32)``. + +.. code-block:: js + + var keypair = new driver.Ed25519Keypair(bip39.mnemonicToSeed("yourString").slice(0, 32)) + + Divisible Assets ----------------