We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The driver is passing a Uint8Array from nacl into base-x. This is an unexpected datatype and is causing a crash.
Uint8Array
nacl
base-x
/home/david/repo/bigchaindb-test/node_modules/base-x/index.js:29 if (!Buffer.isBuffer(source)) throw new TypeError('Expected Buffer')
The issue begins here in the driver code.
nacl is creating a Uint8Array here.
That is creating the Exception in base-x here.
Dependencies
{ "dependencies": { "bigchaindb-driver": "^4.1.0" } }
const base58 = require('bs58') const nacl = require('tweetnacl') const keyPair = nacl.sign.keyPair() console.log("keyPair.publicKey", keyPair.publicKey); console.log("keyPair.secretKey", keyPair.secretKey); publicKey = base58.encode(keyPair.publicKey) console.log("publicKey", publicKey); privateKey = base58.encode(keyPair.secretKey.slice(0, 32)) console.log("privateKey", privateKey);
If you wrap the Uint8Array in a Buffer, it will work without crashing.
Buffer
const base58 = require('bs58') const nacl = require('tweetnacl') const keyPair = nacl.sign.keyPair() console.log("keyPair.publicKey", keyPair.publicKey); console.log("keyPair.secretKey", keyPair.secretKey); publicKey = base58.encode(new Buffer(keyPair.publicKey)) console.log("publicKey", publicKey); privateKey = base58.encode(new Buffer(keyPair.secretKey.slice(0, 32))) console.log("privateKey", privateKey);
Output
keyPair.publicKey Uint8Array [ 210, 154, ...snip... 87, 91 ] keyPair.secretKey Uint8Array [ 119, 13, ...snip... 87, 91 ] publicKey FB7R29t5wQL5SaxtjMckc1BuKLxGZy56XnC6kvzX5enN privateKey 91jXtHyiCemrZxu2XLtAT2iiMJuqo5EFAL1h3k
The text was updated successfully, but these errors were encountered:
Fixes bigchaindb#264. This wraps the given Uint8Array in a Buffer so …
e4d0efd
…that it doesn't cause a crash in base-x.
No branches or pull requests
The problem
The driver is passing a
Uint8Array
fromnacl
intobase-x
. This is an unexpected datatype and is causing a crash.Where it is
The issue begins here in the driver code.
nacl
is creating aUint8Array
here.That is creating the Exception in
base-x
here.Reproduce
Dependencies
How to fix
If you wrap the
Uint8Array
in aBuffer
, it will work without crashing.Output
The text was updated successfully, but these errors were encountered: