Skip to content

Commit

Permalink
Merge pull request #265 from DavidEdwards/fix-buffer-crash
Browse files Browse the repository at this point in the history
Wrap Uint8Array in a Buffer
  • Loading branch information
jernejpregelj committed Nov 6, 2018
2 parents 994c8ef + b7a9c96 commit 561a296
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Ed25519Keypair.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(Buffer.from(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(Buffer.from(keyPair.secretKey.slice(0, 32)))
}

0 comments on commit 561a296

Please sign in to comment.