diff --git a/.gitignore b/.gitignore index e811ed4..d6af236 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ vendor .vscode .phpunit.cache + diff --git a/src/DotenvVault.php b/src/DotenvVault.php index 49372d6..5d02db0 100644 --- a/src/DotenvVault.php +++ b/src/DotenvVault.php @@ -279,69 +279,4 @@ public function _readFromFile(string $path, string $encoding = null) })->success(); }); } - - // public function load() - // { - // $this->dotenv_key = getenv("DOTENV_KEY"); - // if ($this->dotenv_key !== false){ - - // $entries = $this->parser->parse($this->store->read()); - // $this->loader->load($this->repository, $entries); - - // $plaintext = $this->parse_vault(); - - // // parsing plaintext and loading to getenv - // $vault_entries = $this->parser->parse($plaintext); - // return $this->loader->load($this->repository, $vault_entries); - // } - // else { - // $entries = $this->parser->parse($this->store->read()); - - // return $this->loader->load($this->repository, $entries); - // } - // } - - // public function parse_vault() - // { - // $dotenv_keys = explode(',', $this->dotenv_key); - // $keys = array(); - // foreach($dotenv_keys as $key) - // { - // // parse DOTENV_KEY, format is a URI. - // $uri = parse_url(trim($key)); - - // // get encrypted key - // $pass = $uri['pass']; - // - // // Get environment from query params. - // parse_str($uri['query'], $params); - // $vault_environment = $params['environment'] or throw new Exception('INVALID_DOTENV_KEY: Missing environment part.'); - - // # Getting ciphertext from correct environment in .env.vault - // $vault_environment = strtoupper($vault_environment); - // $environment_key = "DOTENV_VAULT_{$vault_environment}"; - - // $ciphertext = getenv("{$environment_key}") or throw new Exception("NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment {$environment_key} in your .env.vault file. Run 'npx dotenv-vault build' to include it."); - // - // array_push($keys, array('encrypted_key' => $pass, 'ciphertext' => $ciphertext)); - // } - // return $this->key_rotation($keys); - // } - - // private function key_rotation($keys){ - // $count = count($keys); - // foreach($keys as $index=>$value) { - // $decrypt = $this->decrypt($value['ciphertext'], $value['encrypted_key']); - - // if ($decrypt == false && $index + 1 >= $count){ - // throw new Exception('INVALID_DOTENV_KEY: Key must be valid.'); - // } - // elseif($decrypt == false){ - // continue; - // } - // else{ - // return $decrypt; - // } - // } - // } }