Check success for directory creation in key store

Resolves #28.
This commit is contained in:
Niklas Keller
2016-06-09 16:50:32 +02:00
parent d04e758598
commit 07f9a03702

View File

@@ -68,7 +68,11 @@ class KeyStore {
try {
// TODO: Replace with async version once available
if (!file_exists(dirname($file))) {
mkdir(dirname($file), 0755, true);
$success = mkdir(dirname($file), 0755, true);
if (!$success) {
throw new KeyStoreException("Could not create key store directory.");
}
}
yield \Amp\File\put($file, $keyPair->getPrivate());