From 8ccb8ad70a8b26f6ed124aa0fbcf7175ed9340fd Mon Sep 17 00:00:00 2001 From: Andreas Brekken Date: Thu, 16 Jan 2014 14:02:21 +0700 Subject: [PATCH] Add toBase58, toWif to ECPubKey --- src/eckey.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/eckey.js b/src/eckey.js index adcb57e..bfd028b 100644 --- a/src/eckey.js +++ b/src/eckey.js @@ -148,6 +148,12 @@ ECPubKey.prototype.toBin = function() { return conv.bytesToString(this.toBytes()) } +ECPubKey.prototype.toBase58 = function() { + return base58.checkEncode(this.toBytes(), 128) +} + +ECPubKey.prototype.toWif = ECPubKey.prototype.toBase58 + ECPubKey.prototype.toString = function() { return this.getBitcoinAddress().toString() }