diff --git a/app/database_con.php b/app/database_con.php index fe11c14..d609295 100644 --- a/app/database_con.php +++ b/app/database_con.php @@ -8,7 +8,7 @@ class DatabaseCon{ private string $login; private string $password; - function __construct(){ + public function __construct(){ if (getenv("SMDB_HOST") == null || getenv("SMDB_DATABASE") == null || getenv("SMDB_USER") == null || getenv("SMDB_PASSWORD") == null){ throw new PDOException("ENV variables not found"); } @@ -17,7 +17,7 @@ class DatabaseCon{ $this->password = getenv("SMDB_PASSWORD"); } - function connect(): int|Connection { + public function connect(): int|Connection { try { $connection = new Connection($this->dsn,$this->login,$this->password); } catch (PDOException $e){ diff --git a/app/routes.php b/app/routes.php index 8a20fe4..9e8593f 100644 --- a/app/routes.php +++ b/app/routes.php @@ -1,9 +1,9 @@ path_to_key, 'r'); #$this->key = fread($file, filesize($this->path_to_key)); @@ -18,7 +18,7 @@ class Token { } // Return json containing JWT with uuid and exp - function getNewJsonToken(string $uuid) :array { + public function getNewJsonToken(string $uuid) :array { $payload = [ 'uuid' => $uuid, 'exp' => strtotime("+2month", time()) @@ -28,7 +28,7 @@ class Token { } // Verify the JWT authenticity - function verifyToken(string $jwt) :bool { + public function verifyToken(string $jwt) :bool { try { JWT::decode($jwt, new Key($this->key, 'HS256')); } catch (Exception $e) { @@ -39,7 +39,7 @@ class Token { // Get uuid from JWT // Missing error handling on bad JWT - function getUuidFromToken(string $jwt) :string { + public function getUuidFromToken(string $jwt) :string { $decoded = (array) JWT::decode($jwt, new Key($this->key, 'HS256')); return $decoded['uuid']; }