Example #1
0
function loadKeys()
{
    $storageEngine = new \Bitpay\Storage\EncryptedFilesystemStorage('YourTopSecretPassword');
    $privateKey = $storageEngine->load('/tmp/bitpay.pri');
    $publicKey = $storageEngine->load('/tmp/bitpay.pub');
    $token_id = file_get_contents('/tmp/token.json');
    return array($privateKey, $publicKey, $token_id);
}
Example #2
0
 * 002 - Pairing
 *
 * Requirements:
 *   - Baisic PHP Knowledge
 *   - Private and Public keys from 001.php
 *   - Account on https://test.bitpay.com
 *   - Pairing code
 */
require __DIR__ . '/../../vendor/autoload.php';
/**
 * To load up keys that you have previously saved, you need to use the same
 * storage engine. You also need to tell it the location of the key you want
 * to load.
 */
$storageEngine = new \Bitpay\Storage\EncryptedFilesystemStorage('YourTopSecretPassword');
$privateKey = $storageEngine->load('/tmp/bitpay.pri');
$publicKey = $storageEngine->load('/tmp/bitpay.pub');
/**
 * Create the client, there's a lot to it and there are some easier ways, I am
 * showing the long form here to show how various things are injected into the
 * client.
 */
$client = new \Bitpay\Client\Client();
/**
 * The network is either livenet or testnet. You can also create your
 * own as long as it implements the NetworkInterface. In this example
 * we will use testnet
 */
$network = new \Bitpay\Network\Testnet();
/**
 * The adapter is what will make the calls to BitPay and return the response