diff --git a/_src/_guide/_setup.md b/_src/_guide/_setup.md index d4d2804..f2bb5a3 100644 --- a/_src/_guide/_setup.md +++ b/_src/_guide/_setup.md @@ -25,7 +25,6 @@ Then, include that as a module and connect to any BigchainDB node. You can creat ```js const BigchainDB = require('bigchaindb-driver') -const bip39 = require('bip39') const API_PATH = 'https://test.bigchaindb.com/api/v1/' const conn = new BigchainDB.Connection(API_PATH, { diff --git a/_src/_guide/tutorial-car-telemetry-app.md b/_src/_guide/tutorial-car-telemetry-app.md index 707223c..fe8d8ae 100644 --- a/_src/_guide/tutorial-car-telemetry-app.md +++ b/_src/_guide/tutorial-car-telemetry-app.md @@ -33,7 +33,22 @@ In BigchainDB, users are represented as a private and public key pair. In our ca For Alice, you can generate a key pair from a seed phrase using the BIP39 library, so you will just need to remember this particular seed phrase. The code below illustrates that. ```js -const alice = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0,32)) +const bip39 = require('bip39') + +const seed = bip39.mnemonicToSeed('seedPhrase').slice(0,32) +const alice = new BigchainDB.Ed25519Keypair(seed) +``` + +```python +from bigchaindb_driver.crypto import generate_keypair + +alice = generate_keypair() +``` + +```java +net.i2p.crypto.eddsa.KeyPairGenerator edDsaKpg = new net.i2p.crypto.eddsa.KeyPairGenerator(); + +KeyPair alice = edDsaKpg.generateKeyPair(); ``` # Decentralized Identifier Class diff --git a/_src/_guide/tutorial-piece-of-art.md b/_src/_guide/tutorial-piece-of-art.md index 724a40e..1132dd7 100644 --- a/_src/_guide/tutorial-piece-of-art.md +++ b/_src/_guide/tutorial-piece-of-art.md @@ -36,7 +36,22 @@ Before starting, you need to create a user in BigchainDB. In BigchainDB, users a You can generate a key pair from a seed phrase using the BIP39 library, so you will just need to remember this particular seed phrase. The code below illustrates that. ```js -const alice = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0,32)) +const bip39 = require('bip39') + +const seed = bip39.mnemonicToSeed('seedPhrase').slice(0,32) +const alice = new BigchainDB.Ed25519Keypair(seed) +``` + +```python +from bigchaindb_driver.crypto import generate_keypair + +alice = generate_keypair() +``` + +```java +net.i2p.crypto.eddsa.KeyPairGenerator edDsaKpg = new net.i2p.crypto.eddsa.KeyPairGenerator(); + +KeyPair alice = edDsaKpg.generateKeyPair(); ``` # Digital registration of an asset on BigchainDB diff --git a/_src/_guide/tutorial-rbac.md b/_src/_guide/tutorial-rbac.md index b3697ac..fab6e8c 100644 --- a/_src/_guide/tutorial-rbac.md +++ b/_src/_guide/tutorial-rbac.md @@ -14,6 +14,7 @@ learn: > Hi there! Welcome to our next tutorial about Role-based access controls (RBAC) in BigchainDB. For this tutorial, we assume that you are familiar with the BigchainDB primitives (assets, inputs, outputs, transactions etc.). If you are not, familiarize yourself with the [Key concepts of BigchainDB](../key-concepts-of-bigchaindb/). We also assume that you have completed our [first tutorial](../tutorial-car-telemetry-app/). # About RBAC + Role based access control is a way to restrict the system access to certain users. In BigchainDB this function enables the creation of hierarchies of role and permissions as assets. Furthermore, users can be assigned roles to “act on behalf of” or “represent” other users or groups. In our example use-case scenario for this guide, we have different tribes or groups of users where they have different roles, users belonging to one tribe can create proposal assets and others can create vote assets on the BigchainDB blockchain. @@ -25,7 +26,6 @@ In our example use-case scenario for this guide, we have different tribes or gro Let's create the app. You will create an asset for Admin type which will act as the admin group for the app. Async/await functions will be used in this tutorial ```js - const nameSpace = 'rbac-bdb-tutorial' async function createApp(){ // Generate keypair for admin instance @@ -63,7 +63,8 @@ async function createApp(){ } ``` -The `createNewAsset` function looks like this +The `createNewAsset` function looks like this: + ```js async function createNewAsset(keypair, asset, metadata) {