Skip to content

Commit

Permalink
Add auth.isPubkey(string) === true if the string is a valid public key.
Browse files Browse the repository at this point in the history
close #101
  • Loading branch information
James Calfee committed Mar 14, 2017
1 parent 7cee867 commit 59a7a81
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ Auth.wifToPublic = function (privWif) {
return pubWif;
};

Auth.isPubkey = function(pubkey, address_prefix) {
return PublicKey.fromString(pubkey, address_prefix) != null
}

Auth.signTransaction = function (trx, keys) {
var signatures = [];
if (trx.signatures) {
Expand All @@ -108,4 +112,4 @@ Auth.signTransaction = function (trx, keys) {
return signed_transaction.toObject(Object.assign(trx, { signatures: signatures }))
};

module.exports = Auth;
module.exports = Auth;

0 comments on commit 59a7a81

Please sign in to comment.