Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bitpay/bitcore-message
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.11.0
Choose a base ref
...
head repository: bitpay/bitcore-message
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 16 commits
  • 8 files changed
  • 5 contributors

Commits on Apr 29, 2015

  1. Bump package version to 0.11.0

    maraoz committed Apr 29, 2015
    Copy the full SHA
    44e8ee9 View commit details

Commits on May 27, 2015

  1. Test for uncompressed formats.

    Braydon Fuller committed May 27, 2015
    Copy the full SHA
    4d0ebb2 View commit details
  2. Upgrade bitcore to 0.12.7

    Braydon Fuller committed May 27, 2015
    Copy the full SHA
    8d8b370 View commit details

Commits on Jun 2, 2015

  1. Merge pull request #19 from bitpay/bugs/uncompressed

    Support Uncompressed Pubkeys
    matiu committed Jun 2, 2015
    Copy the full SHA
    e8da2ba View commit details

Commits on Jun 3, 2015

  1. Bump package version to 0.11.1

    Braydon Fuller committed Jun 3, 2015
    Copy the full SHA
    2ca899e View commit details

Commits on Aug 19, 2015

  1. Upgrade to bitcore 0.13

    Braydon Fuller committed Aug 19, 2015
    Copy the full SHA
    a450824 View commit details
  2. Bump package version to 0.12.0

    Braydon Fuller committed Aug 19, 2015
    Copy the full SHA
    895c827 View commit details

Commits on Oct 14, 2015

  1. Bump package version to 0.12.1

    Braydon Fuller committed Oct 14, 2015
    Copy the full SHA
    740fc74 View commit details

Commits on Oct 16, 2015

  1. bitcore -> bitcore-lib

    Jason Dreyzehner committed Oct 16, 2015
    Copy the full SHA
    51718e4 View commit details
  2. Merge pull request #20 from bitjson/master

    bitcore -> bitcore-lib
    braydonf committed Oct 16, 2015
    Copy the full SHA
    dbf3698 View commit details
  3. Bump package version to 1.0.1

    Braydon Fuller committed Oct 16, 2015
    Copy the full SHA
    c58a1da View commit details

Commits on Oct 20, 2015

  1. format

    Jason Dreyzehner committed Oct 20, 2015
    Copy the full SHA
    f960a09 View commit details
  2. Merge pull request #21 from bitjson/master

    format
    braydonf committed Oct 20, 2015
    Copy the full SHA
    16c0c34 View commit details

Commits on Oct 21, 2015

  1. Bump package version to 1.0.2

    Braydon Fuller committed Oct 21, 2015
    Copy the full SHA
    0c0db03 View commit details

Commits on Mar 15, 2017

  1. Bump package version to 1.0.4

    matiu committed Mar 15, 2017
    Copy the full SHA
    c339dbe View commit details
  2. Update .travis.yml

    matiu authored Mar 15, 2017
    Copy the full SHA
    98a5431 View commit details
Showing with 20 additions and 20 deletions.
  1. +2 −1 .travis.yml
  2. +1 −1 README.md
  3. +1 −1 bower.json
  4. +3 −12 docs/index.md
  5. +1 −1 index.js
  6. +1 −1 lib/message.js
  7. +2 −2 package.json
  8. +9 −1 test/message.js
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
node_js:
- '0.10'
- '4'
- '6'
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ bower install bitcore-message
To sign a message:

```javascript
var bitcore = require('bitcore');
var bitcore = require('bitcore-lib');
var Message = require('bitcore-message');

var privateKey = bitcore.PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bitcore-message",
"main": "./bitcore-message.min.js",
"version": "0.10.1",
"version": "1.0.3",
"homepage": "https://github.com/bitpay/bitcore-message",
"authors": [
"BitPay"
15 changes: 3 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
---
title: Message Verification and Signing
description: Bitcoin Message Verification and Signing.
---
# Message Verification and Signing

## Description

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.

## Installation

Message Verification and Signing is implemented as a separate module and you must add it to your dependencies:

For node projects:

```bash
npm install bitcore-message --save
```

For client-side projects:

```bash
bower install bitcore-message --save
```

## Example

To sign a message:

```javascript
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var bitcore = require('bitcore');
var bitcore = require('bitcore-lib');
bitcore.Message = require('./lib/message');

module.exports = bitcore.Message;
2 changes: 1 addition & 1 deletion lib/message.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var bitcore = require('bitcore');
var bitcore = require('bitcore-lib');
var _ = bitcore.deps._;
var PrivateKey = bitcore.PrivateKey;
var PublicKey = bitcore.PublicKey;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bitcore-message",
"version": "0.10.1",
"version": "1.0.3",
"description": "Bitcoin Messages for Bitcore",
"author": "BitPay <dev@bitpay.com>",
"main": "index.js",
@@ -23,7 +23,7 @@
"url": "https://github.com/bitpay/bitcore-message.git"
},
"dependencies": {
"bitcore": "^0.12.0"
"bitcore-lib": "^0.13.7"
},
"devDependencies": {
"bitcore-build": "bitpay/bitcore-build",
10 changes: 9 additions & 1 deletion test/message.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ var chai = require('chai');
var expect = chai.expect;
var should = chai.should();

var bitcore = require('bitcore');
var bitcore = require('bitcore-lib');
var Address = bitcore.Address;
var Signature = bitcore.crypto.Signature;
var Message = require('../');
@@ -100,6 +100,14 @@ describe('Message', function() {
verified.should.equal(false);
});

it('will verify with an uncompressed pubkey', function() {
var privateKey = new bitcore.PrivateKey('5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss');
var message = new Message('This is an example of a signed message.');
var signature = message.sign(privateKey);
var verified = message.verify(privateKey.toAddress(), signature);
verified.should.equal(true);
});

it('can chain methods', function() {
var verified = Message(text).verify(address, signatureString);
verified.should.equal(true);