Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ed25519Keypair() Error #268

Open
hyungnoh opened this issue Nov 23, 2018 · 9 comments
Open

Ed25519Keypair() Error #268

hyungnoh opened this issue Nov 23, 2018 · 9 comments
Assignees
Labels

Comments

@hyungnoh
Copy link

Hi guys.

I have installed bigchaindb-driver using command below.
npm install bigchaindb-driver

and I have executed following program code.

const driver = require('bigchaindb-driver')
const API_PATH = 'http://localhost:9984/api/v1/'
const alice = new driver.Ed25519Keypair()

then An error occurred as follows.

TypeError: Expected Buffer
at Object.encode (/home/hyung/node_modules/base-x/index.js:29:41)
at Object.Ed25519Keypair (/home/hyung/node_modules/bigchaindb-driver/dist/node/Ed25519Keypair.js:28:33)

is there anybody knowing this errors?
any suggestions are appreciated.

@pboueke
Copy link

pboueke commented Nov 23, 2018

I had the same problem, the version I got from NPM has a bug in this file:

https://github.com/bigchaindb/js-bigchaindb-driver/blob/master/src/Ed25519Keypair.js

In the NPM package the keys are not transformed to Buffers. You can copy the file to your dev environment and it will work.

@ttmc
Copy link
Contributor

ttmc commented Nov 24, 2018

In other words, the dev version (master branch) of the JavaScript driver doesn't have this issue.

I'll see about getting a new release into npm. BigchainDB is in a transition phase right now, so that's not as trivial as it sounds.

@OzanAlpay
Copy link

Any news on this topic?, I still get this error, when I am trying to use it bcdb-driver from npm

@hyungnoh
Copy link
Author

Hi Ozan
To resolve the error

  1. mv bigchaindb-driver/dist/node
  2. vi Ed25519Keypair.js
  3. Edit codes
    this.publicKey = _bs2.default.encode(Buffer.from(keyPair.publicKey));
    this.privateKey = _bs2.default.encode(Buffer.from(keyPair.secretKey.slice(0, 32)));

@OzanAlpay
Copy link

Hi hyungnoh,

Thanks for your help, btw I am using the solution which described in: #265, but I think someone should update npm package, since just changing node files manually is not the best solution(I guess?).

@scottpaulin
Copy link

This might be caused by the base-x package being updated. bigchaindb-driver (or one of its dependencies) currently pulls in base-x version 3.0.5. Specifying version 3.0.4 seems to be a workaround for now. e.g.

  "dependencies": {
    "bigchaindb-driver": "^4.1.0",
    "bip39": "^2.5.0",
    "base-x": "3.0.4"
  }

@abhisheq6u
Copy link

abhisheq6u commented Jan 4, 2019

Hi Ozan
To resolve the error

1. mv   bigchaindb-driver/dist/node

2. vi  Ed25519Keypair.js

3. Edit codes
   this.publicKey = _bs2.default.encode(**Buffer.from(keyPair.publicKey)**);
   this.privateKey = _bs2.default.encode(**Buffer.from(keyPair.secretKey.slice(0, 32))**);

Worked for me! Thanks.

@julianrodriguezcasas
Copy link

Could you make a new release with the version that is in master branch ????

@ttmc
Copy link
Contributor

ttmc commented Apr 12, 2019

The process to transition the governance of all BigchainDB software to the IPDB Foundation is moving along. I anticipate that they will be able to take care of this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants