Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.38 KB

File metadata and controls

41 lines (28 loc) · 1.38 KB

MessageLib

NPM Package Build Status Coverage Status

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.