ZCLify
This commit is contained in:
parent
98a5431924
commit
a8d09a571d
|
@ -3,8 +3,8 @@ coverage
|
|||
node_modules
|
||||
|
||||
npm-debug.log
|
||||
bitcore-message.js
|
||||
bitcore-message.min.js
|
||||
bitcore-message-zclassic.js
|
||||
bitcore-message-zclassic.min.js
|
||||
tests.js
|
||||
|
||||
report
|
||||
|
|
11
README.md
11
README.md
|
@ -1,5 +1,5 @@
|
|||
<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)
|
||||
|
@ -13,18 +13,18 @@ See [the main bitcore repo](https://github.com/bitpay/bitcore) for more informat
|
|||
## Getting Started
|
||||
|
||||
```sh
|
||||
npm install bitcore-message
|
||||
npm install bitcore-message-zclassic
|
||||
```
|
||||
|
||||
```sh
|
||||
bower install bitcore-message
|
||||
bower install bitcore-message-zclassic
|
||||
```
|
||||
|
||||
To sign a message:
|
||||
|
||||
```javascript
|
||||
var bitcore = require('bitcore-lib');
|
||||
var Message = require('bitcore-message');
|
||||
var bitcore = require('bitcore-lib-zclassic');
|
||||
var Message = require('bitcore-message-zclassic');
|
||||
|
||||
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
|
||||
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).
|
||||
|
||||
Copyright 2013-2015 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
|
||||
|
||||
|
|
11
bower.json
11
bower.json
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
"name": "bitcore-message",
|
||||
"main": "./bitcore-message.min.js",
|
||||
"version": "1.0.3",
|
||||
"homepage": "https://github.com/bitpay/bitcore-message",
|
||||
"name": "bitcore-message-zclassic",
|
||||
"main": "./bitcore-message-zclassic.min.js",
|
||||
"version": "1.0.3-zclassic",
|
||||
"homepage": "https://github.com/z-classic/bitcore-message-zclassic",
|
||||
"authors": [
|
||||
"The Zclassic Team",
|
||||
"BitPay"
|
||||
],
|
||||
"description": "Bitcoin Message Verification and Signing for Bitcore",
|
||||
"description": "Zclassic Message Verification and Signing for Bitcore",
|
||||
"moduleType": [
|
||||
"globals"
|
||||
],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# 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.
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
```bash
|
||||
npm install bitcore-message --save
|
||||
npm install bitcore-message-zclassic --save
|
||||
```
|
||||
|
||||
For client-side projects:
|
||||
|
||||
```bash
|
||||
bower install bitcore-message --save
|
||||
bower install bitcore-message-zclassic --save
|
||||
```
|
||||
|
||||
## Example
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var bitcoreTasks = require('bitcore-build');
|
||||
var bitcoreTasks = require('bitcore-build-zclassic');
|
||||
|
||||
bitcoreTasks('message');
|
||||
|
||||
|
|
4
index.js
4
index.js
|
@ -1,4 +1,4 @@
|
|||
var bitcore = require('bitcore-lib');
|
||||
var bitcore = require('bitcore-lib-zclassic');
|
||||
bitcore.Message = require('./lib/message');
|
||||
|
||||
module.exports = bitcore.Message;
|
||||
module.exports = bitcore.Message;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var bitcore = require('bitcore-lib');
|
||||
var bitcore = require('bitcore-lib-zclassic');
|
||||
var _ = bitcore.deps._;
|
||||
var PrivateKey = bitcore.PrivateKey;
|
||||
var PublicKey = bitcore.PublicKey;
|
||||
|
@ -28,7 +28,7 @@ var Message = function Message(message) {
|
|||
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() {
|
||||
var prefix1 = BufferWriter.varintBufNum(Message.MAGIC_BYTES.length);
|
||||
|
|
14
package.json
14
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "bitcore-message",
|
||||
"version": "1.0.3",
|
||||
"description": "Bitcoin Messages for Bitcore",
|
||||
"name": "bitcore-message-zclassic",
|
||||
"version": "1.0.3-zclassic",
|
||||
"description": "Zclassic Messages for Bitcore",
|
||||
"author": "BitPay <dev@bitpay.com>",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -11,8 +11,10 @@
|
|||
"build": "gulp"
|
||||
},
|
||||
"keywords": [
|
||||
"zclasic",
|
||||
"bitcoin",
|
||||
"bitcore",
|
||||
"zcl",
|
||||
"btc",
|
||||
"satoshi",
|
||||
"message",
|
||||
|
@ -20,13 +22,13 @@
|
|||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bitpay/bitcore-message.git"
|
||||
"url": "https://github.com/z-classic/bitcore-message-zclassic.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"bitcore-lib": "^0.13.7"
|
||||
"bitcore-lib-zclassic": "z-classic/bitcore-lib-zclassic"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bitcore-build": "bitpay/bitcore-build",
|
||||
"bitcore-build-zclassic": "z-classic/bitcore-build-zclassic",
|
||||
"brfs": "^1.3.0",
|
||||
"chai": "~1.10.0",
|
||||
"gulp": "^3.8.10"
|
||||
|
|
|
@ -4,16 +4,16 @@ var chai = require('chai');
|
|||
var expect = chai.expect;
|
||||
var should = chai.should();
|
||||
|
||||
var bitcore = require('bitcore-lib');
|
||||
var bitcore = require('bitcore-lib-zclassic');
|
||||
var Address = bitcore.Address;
|
||||
var Signature = bitcore.crypto.Signature;
|
||||
var Message = require('../');
|
||||
|
||||
describe('Message', function() {
|
||||
|
||||
var address = 'n1ZCYg9YXtB5XCZazLxSmPDa8iwJRZHhGx';
|
||||
var address = 't1gsePJZ6ojJYygj3PWMGJfojPUoMd5AVfU';
|
||||
var badAddress = 'mmRcrB5fTwgxaFJmVLNtaG8SV454y1E3kC';
|
||||
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
|
||||
var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4'); //TODO fill out
|
||||
var text = 'hello, world';
|
||||
var signatureString = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY=';
|
||||
|
||||
|
|
Loading…
Reference in New Issue