diff --git a/doc/README.md b/doc/README.md index 2c2deab00d248ed32e8ff8e4bb84be27bd17c8d5..fe1efe3cefbb676d8f0f9486f30e4138cebedb98 100644 --- a/doc/README.md +++ b/doc/README.md @@ -2289,6 +2289,11 @@ hive.auth.wifToPublic(privWif); hive.auth.signTransaction(trx, keys); ``` +### Sign a message +```js +hive.auth.signMessage(message, privateKey) +``` + # Formatter ### Amount diff --git a/package.json b/package.json index da7c89110fca53168b0188d36bde1d6e15c35ce7..cf538cf865ccf2687b9592812302d3a92b8cbaa3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hiveio/hive-js", - "version": "2.0.6", + "version": "2.0.7", "description": "Hive.js the JavaScript API for Hive blockchain", "main": "lib/index.js", "scripts": { diff --git a/src/auth/index.js b/src/auth/index.js index 7b417ac107c1473001cbbc25430e23c4a11bdec7..4e178ae7a655b0deb53eaac8d1e12e9122c0f445 100644 --- a/src/auth/index.js +++ b/src/auth/index.js @@ -98,9 +98,13 @@ Auth.wifToPublic = function (privWif) { return pubWif; }; -Auth.isPubkey = function(pubkey, address_prefix) { +Auth.isPubkey = function (pubkey, address_prefix) { return PublicKey.fromString(pubkey, address_prefix) != null -} +}; + +Auth.signMessage = function (msg, privWif) { + return Signature.sign(msg, privWif).toHex(); +}; Auth.signTransaction = function (trx, keys) { var signatures = [];