@owstack/message-lib

0.0.8 • Public • Published

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.

Package Sidebar

Install

npm i @owstack/message-lib

Weekly Downloads

0

Version

0.0.8

License

MIT

Unpacked Size

19 kB

Total Files

9

Last publish

Collaborators

  • ajp8164
  • niahmiah