From e4d0efd9676e372ac808665b78bac05de817bc2a Mon Sep 17 00:00:00 2001 From: David Edwards Date: Tue, 6 Nov 2018 10:10:53 +0100 Subject: [PATCH] Fixes #264. This wraps the given Uint8Array in a Buffer so that it doesn't cause a crash in base-x. --- src/Ed25519Keypair.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ed25519Keypair.js b/src/Ed25519Keypair.js index 8c8b9b0..b94d668 100644 --- a/src/Ed25519Keypair.js +++ b/src/Ed25519Keypair.js @@ -15,7 +15,7 @@ import nacl from 'tweetnacl' */ export default function Ed25519Keypair(seed) { const keyPair = seed ? nacl.sign.keyPair.fromSeed(seed) : nacl.sign.keyPair() - this.publicKey = base58.encode(keyPair.publicKey) + this.publicKey = base58.encode(new Buffer(keyPair.publicKey)) // tweetnacl's generated secret key is the secret key + public key (resulting in a 64-byte buffer) - this.privateKey = base58.encode(keyPair.secretKey.slice(0, 32)) + this.privateKey = base58.encode(new Buffer(keyPair.secretKey.slice(0, 32))) }