An open API service indexing awesome lists of open source software.

https://github.com/bitpay/bitpay-perl-keyutils

Provides required cryptographic functions to use the BitPay 2.0 API
https://github.com/bitpay/bitpay-perl-keyutils

Last synced: 8 months ago
JSON representation

Provides required cryptographic functions to use the BitPay 2.0 API

Awesome Lists containing this project

README

          

BitPay Key Utils version 2.0.0
==============================

This library provides utilities for use with the BitPay API. It enables creating keys, retrieving public keys, creating the SIN that is used in retrieving tokens from BitPay, and signing payloads for the `X-Signature` header in a BitPay API request.

DEPENDENCIES

libssl-dev (OpenSSL 0.9.8+)
SWIG (3.0.5+)
Perl (5.18+)
Make

INSTALLATION

Install from cpan by typing the following:

sudo cpanm BitPay::KeyUtils

or

Clone the github repository and type the following:

perl Makefile.PL
make
make test
make install

USAGE

Use the key utils by including `use BitPay::KeyUtils` in your project. This should give you access to the functions:

my $pem = BitPay::KeyUtils::bpGeneratePem(); #creates ECDSA Keys and sets the value of pem to the PEM encoding of the key
my $pub = BitPay::KeyUtils::bpGetPublicKeyFromPem($pem); #takes a pem string and sets the value of pubkey to the compressed public key extracted from the pem
my $sin = BitPay::KeyUtils::bpGenerateSinFromPem($pem); #gets the base58 unique identifier associated with the pem
my $signature = BitPay::KeyUtils::bpSignMessageWithPem($pem, "He's dead, Jim."); #sets signature to the signature of the sha256 of the message

DEV ENVIRONMENT

Clone the github repository.

To build and install this module type the following:

./clean
./build

API DOCUMENTATION

API Documentation is available on the [BitPay site](https://bitpay.com/api).

RUNNING THE TESTS

To run the tests type the following:

perl test.pl