protected function __construct($privateKeyFile)
{
if (is_file($privateKeyFile)) {
$this->privateKeyFile = $privateKeyFile;
} else {
$encryptedPrivateKeyFile = $privateKeyFile . '.encrypted';
$this->privateKeyFile = $privateKeyFile . '.unlocked';
if (is_file($encryptedPrivateKeyFile)) {
if (class_exists('\\Vault\\Vault')) {
$vault = new Vault();
$vault->decryptFile($encryptedPrivateKeyFile, $this->privateKeyFile);
chmod($this->privateKeyFile, 0600);
$this->unlocked = true;
} else {
throw new \Exception('Please install aoepeople/vault');
}
} else {
throw new FileNotFoundException('Could not find private key file ' . $privateKeyFile);
}
}
$this->privateKeyFile = realpath($this->privateKeyFile);
}