Add developer guide

This commit is contained in:
Manuel Araoz 2015-02-05 11:26:30 -03:00
parent e5861e7a1f
commit 388c0287a7
1 changed files with 44 additions and 0 deletions

44
docs/index.md Normal file
View File

@ -0,0 +1,44 @@
---
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.
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
var privateKey = PrivateKey.fromWIF('cPBn5A4ikZvBTQ8D7NnvHZYCAxzDZ5Z2TSGW2LkyPiLxqYaJPBW4');
var signature = Message('hello, world').sign(privateKey);
```
To verify a message:
```javascript
var address = 'n1ZCYg9YXtB5XCZazLxSmPDa8iwJRZHhGx';
var signature = 'H/DIn8uA1scAuKLlCx+/9LnAcJtwQQ0PmcPrJUq90aboLv3fH5fFvY+vmbfOSFEtGarznYli6ShPr9RXwY9UrIY=';
var verified = Message('hello, world').verify(address, signature);
```