base-x encode function is expecting Buffer but is being passed Uint8Array which raises error;
/home/bjmacd/node_modules/base-x/index.js:30
if (!Buffer.isBuffer(source)) throw new TypeError('Expected Buffer')
^
TypeError: Expected Buffer
at Object.encode (/home/bjmacd/node_modules/base-x/index.js:30:41)
at new Ed25519Keypair (/home/bjmacd/node_modules/bigchaindb-driver/dist/node/Ed25519Keypair.js:28:33)
at Object. (/home/bjmacd/myKeys/app.js:5:12)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:776:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
Updated function to pass as Buffer;
function Ed25519Keypair(seed) {
var keyPair = seed ? _tweetnacl2.default.sign.keyPair.fromSeed(seed) : _tweetnacl2.default.sign.keyPair();
this.publicKey = _bs2.default.encode(Buffer(keyPair.publicKey));
// tweetnacl's generated secret key is the secret key + public key (resulting in a 64-byte buffer)
this.privateKey = _bs2.default.encode(Buffer(keyPair.secretKey.slice(0, 32)));
base-x encode function is expecting Buffer but is being passed Uint8Array which raises error;
/home/bjmacd/node_modules/base-x/index.js:30 if (!Buffer.isBuffer(source)) throw new TypeError('Expected Buffer') ^
TypeError: Expected Buffer at Object.encode (/home/bjmacd/node_modules/base-x/index.js:30:41) at new Ed25519Keypair (/home/bjmacd/node_modules/bigchaindb-driver/dist/node/Ed25519Keypair.js:28:33) at Object. (/home/bjmacd/myKeys/app.js:5:12)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:776:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
Updated function to pass as Buffer;
function Ed25519Keypair(seed) { var keyPair = seed ? _tweetnacl2.default.sign.keyPair.fromSeed(seed) : _tweetnacl2.default.sign.keyPair(); this.publicKey = _bs2.default.encode(Buffer(keyPair.publicKey)); // tweetnacl's generated secret key is the secret key + public key (resulting in a 64-byte buffer) this.privateKey = _bs2.default.encode(Buffer(keyPair.secretKey.slice(0, 32)));