@owstack/message-lib
v0.0.8
Published
Message verification and signing.
Downloads
20
Readme
MessageLib
Adds support for verifying and signing messages in Node.js and web browsers.
Getting Started
npm install @owstack/message-lib
Example
To sign a message:
const {PrivateKey} = require('@owstack/key-lib');
const Message = require('@owstack/message-lib');
const privateKey = PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
const signature = new Message('hello, world', 'btc').sign(privateKey);
To verify a message:
const Message = require('@owstack/message-lib');
const address = 'n1ZCYg9YXtB5XCZazLxSmPDa8iwJRZHhGx';
const signature = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY=';
const verified = new Message('hello, world', 'btc').verify(address, signature);
License
Code released under the MIT license.
Copyright 2019 Open Wallet Stack.