diff --git a/src/Stores/CertificateStore.php b/src/Stores/CertificateStore.php index c3ce458..42f6033 100644 --- a/src/Stores/CertificateStore.php +++ b/src/Stores/CertificateStore.php @@ -2,6 +2,7 @@ namespace Kelunik\AcmeClient\Stores; +use Amp\CoroutineResult; use Amp\File\FilesystemException; use InvalidArgumentException; use Kelunik\Certificate\Certificate; @@ -26,7 +27,8 @@ class CertificateStore { Assert::string($name, "Name must be a string. Got: %s"); try { - return yield \Amp\File\get($this->root . "/" . $name . "/cert.pem"); + $contents = (yield \Amp\File\get($this->root . "/" . $name . "/cert.pem")); + yield new CoroutineResult($contents); } catch (FilesystemException $e) { throw new CertificateStoreException("Failed to load certificate.", 0, $e); } @@ -88,4 +90,4 @@ class CertificateStore { yield \Amp\File\rmdir($this->root . "/" . $name); } -} \ No newline at end of file +}