persist() public method

public persist ( Bitpay\KeyInterface $key )
$key Bitpay\KeyInterface
コード例 #1
0
 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);
 }
コード例 #2
0
 public function testPersist()
 {
     $storage = new FilesystemStorage();
     $storage->persist(new \Bitpay\PublicKey(vfsStream::url('tmp/public.key')));
     $this->assertTrue($this->root->hasChild('tmp/public.key'));
 }