Bitpay\Storage\FilesystemStorage::persist PHP Method

persist() public method

public persist ( Bitpay\KeyInterface $key )
$key Bitpay\KeyInterface
    public function persist(\Bitpay\KeyInterface $key)
    {
        $path = $key->getId();
        file_put_contents($path, serialize($key));
    }

Usage Example

 public function createBitPayKeys()
 {
     if (_BIT_PAY_PRODUCTION_) {
         $privateKey = new Bitpay\PrivateKey('/tmp/bitpay.pri');
     } else {
         $privateKey = new Bitpay\PrivateKey('/tmp/bitpaydev.pri');
     }
     $privateKey->generate();
     if (_BIT_PAY_PRODUCTION_) {
         $publicKey = new Bitpay\PublicKey('/tmp/bitpay.pub');
     } else {
         $publicKey = new Bitpay\PublicKey('/tmp/bitpaydev.pub');
     }
     $publicKey->setPrivateKey($privateKey);
     $publicKey->generate();
     $storageEngine = new Bitpay\Storage\FilesystemStorage();
     $storageEngine->persist($privateKey);
     $storageEngine->persist($publicKey);
 }
All Usage Examples Of Bitpay\Storage\FilesystemStorage::persist
FilesystemStorage