This commit is contained in:
Jon Layton 2018-02-22 15:09:41 -06:00
parent 98a5431924
commit a8d09a571d
9 changed files with 32 additions and 30 deletions

4
.gitignore vendored
View File

@ -3,8 +3,8 @@ coverage
node_modules node_modules
npm-debug.log npm-debug.log
bitcore-message.js bitcore-message-zclassic.js
bitcore-message.min.js bitcore-message-zclassic.min.js
tests.js tests.js
report report

View File

@ -1,5 +1,5 @@
<img src="http://bitcore.io/css/images/module-message.png" alt="bitcore message" height="35"> <img src="http://bitcore.io/css/images/module-message.png" alt="bitcore message" height="35">
# Bitcoin Message Verification and Signing for Bitcore # Zclassic Message Verification and Signing for Bitcore
[![NPM Package](https://img.shields.io/npm/v/bitcore-message.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-message) [![NPM Package](https://img.shields.io/npm/v/bitcore-message.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-message)
@ -13,18 +13,18 @@ See [the main bitcore repo](https://github.com/bitpay/bitcore) for more informat
## Getting Started ## Getting Started
```sh ```sh
npm install bitcore-message npm install bitcore-message-zclassic
``` ```
```sh ```sh
bower install bitcore-message bower install bitcore-message-zclassic
``` ```
To sign a message: To sign a message:
```javascript ```javascript
var bitcore = require('bitcore-lib'); var bitcore = require('bitcore-lib-zclassic');
var Message = require('bitcore-message'); var Message = require('bitcore-message-zclassic');
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4'); var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
var signature = Message('hello, world').sign(privateKey); var signature = Message('hello, world').sign(privateKey);
@ -47,4 +47,3 @@ See [CONTRIBUTING.md](https://github.com/bitpay/bitcore/blob/master/CONTRIBUTING
Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE). Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).
Copyright 2013-2015 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc. Copyright 2013-2015 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.

View File

@ -1,12 +1,13 @@
{ {
"name": "bitcore-message", "name": "bitcore-message-zclassic",
"main": "./bitcore-message.min.js", "main": "./bitcore-message-zclassic.min.js",
"version": "1.0.3", "version": "1.0.3-zclassic",
"homepage": "https://github.com/bitpay/bitcore-message", "homepage": "https://github.com/z-classic/bitcore-message-zclassic",
"authors": [ "authors": [
"The Zclassic Team",
"BitPay" "BitPay"
], ],
"description": "Bitcoin Message Verification and Signing for Bitcore", "description": "Zclassic Message Verification and Signing for Bitcore",
"moduleType": [ "moduleType": [
"globals" "globals"
], ],

View File

@ -1,7 +1,7 @@
# Message Verification and Signing # Message Verification and Signing
Bitcore implementation of [bitcoin message signing and verification](http://bitcoin.stackexchange.com/questions/3337/what-are-the-safety-guidelines-for-using-the-sign-message-feature/3339#3339). This is used to cryptographically prove that a certain message was signed by the holder of an address private key. Bitcore implementation of [bitcoin message signing and verification](http://bitcoin.stackexchange.com/questions/3337/what-are-the-safety-guidelines-for-using-the-sign-message-feature/3339#3339). This is used to cryptographically prove that a certain message was signed by the holder of an address private key.
For more information refer to the [bitcore-message](https://github.com/bitpay/bitcore-message) github repo. For more information refer to the [bitcore-message-zclassic](https://github.com/z-classic/bitcore-message-zclassic) github repo.
## Installation ## Installation
Message Verification and Signing is implemented as a separate module and you must add it to your dependencies: Message Verification and Signing is implemented as a separate module and you must add it to your dependencies:
@ -9,13 +9,13 @@ Message Verification and Signing is implemented as a separate module and you mus
For node projects: For node projects:
```bash ```bash
npm install bitcore-message --save npm install bitcore-message-zclassic --save
``` ```
For client-side projects: For client-side projects:
```bash ```bash
bower install bitcore-message --save bower install bitcore-message-zclassic --save
``` ```
## Example ## Example

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
var gulp = require('gulp'); var gulp = require('gulp');
var bitcoreTasks = require('bitcore-build'); var bitcoreTasks = require('bitcore-build-zclassic');
bitcoreTasks('message'); bitcoreTasks('message');

View File

@ -1,4 +1,4 @@
var bitcore = require('bitcore-lib'); var bitcore = require('bitcore-lib-zclassic');
bitcore.Message = require('./lib/message'); bitcore.Message = require('./lib/message');
module.exports = bitcore.Message; module.exports = bitcore.Message;

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var bitcore = require('bitcore-lib'); var bitcore = require('bitcore-lib-zclassic');
var _ = bitcore.deps._; var _ = bitcore.deps._;
var PrivateKey = bitcore.PrivateKey; var PrivateKey = bitcore.PrivateKey;
var PublicKey = bitcore.PublicKey; var PublicKey = bitcore.PublicKey;
@ -28,7 +28,7 @@ var Message = function Message(message) {
return this; return this;
}; };
Message.MAGIC_BYTES = new Buffer('Bitcoin Signed Message:\n'); Message.MAGIC_BYTES = new Buffer('Zcash Signed Message:\n'); // TODO!!
Message.prototype.magicHash = function magicHash() { Message.prototype.magicHash = function magicHash() {
var prefix1 = BufferWriter.varintBufNum(Message.MAGIC_BYTES.length); var prefix1 = BufferWriter.varintBufNum(Message.MAGIC_BYTES.length);

View File

@ -1,7 +1,7 @@
{ {
"name": "bitcore-message", "name": "bitcore-message-zclassic",
"version": "1.0.3", "version": "1.0.3-zclassic",
"description": "Bitcoin Messages for Bitcore", "description": "Zclassic Messages for Bitcore",
"author": "BitPay <dev@bitpay.com>", "author": "BitPay <dev@bitpay.com>",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -11,8 +11,10 @@
"build": "gulp" "build": "gulp"
}, },
"keywords": [ "keywords": [
"zclasic",
"bitcoin", "bitcoin",
"bitcore", "bitcore",
"zcl",
"btc", "btc",
"satoshi", "satoshi",
"message", "message",
@ -20,13 +22,13 @@
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/bitpay/bitcore-message.git" "url": "https://github.com/z-classic/bitcore-message-zclassic.git"
}, },
"dependencies": { "dependencies": {
"bitcore-lib": "^0.13.7" "bitcore-lib-zclassic": "z-classic/bitcore-lib-zclassic"
}, },
"devDependencies": { "devDependencies": {
"bitcore-build": "bitpay/bitcore-build", "bitcore-build-zclassic": "z-classic/bitcore-build-zclassic",
"brfs": "^1.3.0", "brfs": "^1.3.0",
"chai": "~1.10.0", "chai": "~1.10.0",
"gulp": "^3.8.10" "gulp": "^3.8.10"

View File

@ -4,16 +4,16 @@ var chai = require('chai');
var expect = chai.expect; var expect = chai.expect;
var should = chai.should(); var should = chai.should();
var bitcore = require('bitcore-lib'); var bitcore = require('bitcore-lib-zclassic');
var Address = bitcore.Address; var Address = bitcore.Address;
var Signature = bitcore.crypto.Signature; var Signature = bitcore.crypto.Signature;
var Message = require('../'); var Message = require('../');
describe('Message', function() { describe('Message', function() {
var address = 'n1ZCYg9YXtB5XCZazLxSmPDa8iwJRZHhGx'; var address = 't1gsePJZ6ojJYygj3PWMGJfojPUoMd5AVfU';
var badAddress = 'mmRcrB5fTwgxaFJmVLNtaG8SV454y1E3kC'; var badAddress = 'mmRcrB5fTwgxaFJmVLNtaG8SV454y1E3kC';
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4'); var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4'); //TODO fill out
var text = 'hello, world'; var text = 'hello, world';
var signatureString = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY='; var signatureString = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY=';