bitcore-message adds support for verifying and signing Flux messages in Node.js 24 or newer.
See the main bitcore repo for more information.
npm install @runonflux/bitcore-messageTo sign a message:
var bitcore = require('@runonflux/bitcore-lib');
var Message = require('@runonflux/bitcore-message');
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
var signature = Message('hello, world').sign(privateKey);To verify a message:
var address = 'n1ZCYg9YXtB5XCZazLxSmPDa8iwJRZHhGx';
var signature = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY=';
var verified = Message('hello, world').verify(address, signature);Requires Node.js 24 or later.
npm testnpm test runs every file under test/ in its own mocha process and checks
each outcome against test/inherited-failures.json, the inherited tests that
fail at runonflux/bitcore-message ec2fb0a with bitcore-lib 8f5453f.
test/differential.js checks this package against bitcore-message ec2fb0a
with bitcore-lib 8f5453f, installed as the devDependency
bitcore-message-ec2fb0a: magic hashes, signatures byte for byte with the
random nonce fixed, cross verification, and rejection of wrong addresses and
malformed signatures.
Code released under the MIT license.
Copyright 2013-2015 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.