<commit_before>Payment Protocol (BIP70 and related) support for bitcore
=======

[![NPM Package](https://img.shields.io/npm/v/bitcore-payment-protocol.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-payment-protocol)
[![Build Status](https://img.shields.io/travis/bitpay/bitcore-payment-protocol.svg?branch=master&style=flat-square)](https://travis-ci.org/bitpay/bitcore-payment-protocol)
[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcore-payment-protocol.svg?style=flat-square)](https://coveralls.io/r/bitpay/bitcore-payment-protocol)

bitcore-payment-protocol adds support for BIP70 (and other related BIPS) to the bitcore library.

See [the main bitcore repo](https://github.com/bitpay/bitcore) for more information, or the [BIP 70](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki) where the basics are explained.

## Getting Started

This library is distributed in both the npm and bower packaging systems.

```sh
npm install bitcore-payment-protocol
bower install bitcore-payment-protocol
```

## Contributing

See [CONTRIBUTING.md](https://github.com/bitpay/bitcore) on the main bitcore repo for information about how to contribute.

## License

Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).<commit_msg>Add example to README<commit_after>Payment Protocol (BIP70 and related) support for bitcore
=======

[![NPM Package](https://img.shields.io/npm/v/bitcore-payment-protocol.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-payment-protocol)
[![Build Status](https://img.shields.io/travis/bitpay/bitcore-payment-protocol.svg?branch=master&style=flat-square)](https://travis-ci.org/bitpay/bitcore-payment-protocol)
[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcore-payment-protocol.svg?style=flat-square)](https://coveralls.io/r/bitpay/bitcore-payment-protocol)

bitcore-payment-protocol adds support for BIP70 (and other related BIPS) to the bitcore library.

See [the main bitcore repo](https://github.com/bitpay/bitcore) for more information, or the [BIP 70](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki) where the basics are explained.

## Getting Started

This library is distributed in both the npm and bower packaging systems.

```sh
npm install bitcore-payment-protocol
bower install bitcore-payment-protocol
```

There are many examples of how to use it on the developer guide [section for payment protocol](http://bitcore.io/guide/paymentprotocol.html). For example, the following code would verify a payment request:

```javascript
var PaymentProtocol = require('bitcore-payment-protocol');

var body = PaymentProtocol.PaymentRequest.decode(rawbody);
var request = new PaymentProtocol().makePaymentRequest(body);

var version = pr.get('payment_details_version');
var pki_type = pr.get('pki_type');
var pki_data = pr.get('pki_data');
var serializedDetails = pr.get('serialized_payment_details');
var signature = pr.get('signature');

// Verify the signature
var verified = request.verify();
```

## Contributing

See [CONTRIBUTING.md](https://github.com/bitpay/bitcore) on the main bitcore repo for information about how to contribute.

## License

Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).
{'fraction_non_alphanumeric': 0.13727272727272727, 'fraction_numerical': 0.006060606060606061, 'mean_word_length': 5.695740365111562, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2783665', 'n_tokens_mistral': 1040, 'n_tokens_neox': 995, 'n_words': 233}