From 71aa21f1434638fc7ac2fd185e7caa005a657271 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 31 Jul 2025 20:51:58 -0400 Subject: [PATCH] init 9 --- protected/src/configs/on_JWT.php | 5 +++++ protected/src/configs/on_security.php | 8 ++++++++ protected/src/controllers/app/cookie_ctrl.php | 3 ++- protected/src/controllers/app/home_ctrl.php | 4 ++++ protected/src/services/off_test_db.php | 2 +- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/protected/src/configs/on_JWT.php b/protected/src/configs/on_JWT.php index 796026c..bef0b32 100644 --- a/protected/src/configs/on_JWT.php +++ b/protected/src/configs/on_JWT.php @@ -10,6 +10,11 @@ declare(strict_types=1); use CodeHydrater\bootstrap\configure as Config; +/** + * From a Linux Terminal run: + * openssl rand -hex 32 + */ + // Your secret key, keep it secure Config::set('JWT', [ 'key' => '0ad1f6d270949857a0d4893ffe02a3d329aa77183ee13183d85c3006e69b204d', diff --git a/protected/src/configs/on_security.php b/protected/src/configs/on_security.php index 81a27b1..f1f9f21 100644 --- a/protected/src/configs/on_security.php +++ b/protected/src/configs/on_security.php @@ -5,5 +5,13 @@ declare(strict_types=1); use CodeHydrater\bootstrap\configure as Config; Config::set('security', array( + // Show Debugging Info (var_dumps) 'show_dumps' => true, + + // For Perrer: $ openssl rand -base64 15 + 'pepper_pwd' => '5e5Tir65C8OBF2FQeGBQ', + // For SALT: $ openssl rand -base64 8 + 'salt_pwd' => 'J+l0enf0y6M=', + 'hash_level' => 'normal', // low, weak, normal, and max + 'hash_algo' => PASSWORD_ARGON2ID, // PASSWORD_BCRYPT or newer PASSWORD_ARGON2ID )); \ No newline at end of file diff --git a/protected/src/controllers/app/cookie_ctrl.php b/protected/src/controllers/app/cookie_ctrl.php index cd57f14..6d9d90d 100644 --- a/protected/src/controllers/app/cookie_ctrl.php +++ b/protected/src/controllers/app/cookie_ctrl.php @@ -12,7 +12,8 @@ namespace Project\controllers\app; class cookie_ctrl { public function __construct() { - \CodeHydrater\session_management::start(); + $options = ['cookie_name' => "prj"]; + \CodeHydrater\session_management::start($options); } public function save() { diff --git a/protected/src/controllers/app/home_ctrl.php b/protected/src/controllers/app/home_ctrl.php index 672385a..2dca10c 100644 --- a/protected/src/controllers/app/home_ctrl.php +++ b/protected/src/controllers/app/home_ctrl.php @@ -65,6 +65,10 @@ class home_ctrl { } } + public function make_hash() { + echo \CodeHydrater\security::do_password_hash("Hello, World"); + } + /** * from Routes * diff --git a/protected/src/services/off_test_db.php b/protected/src/services/off_test_db.php index c64054a..13b307f 100644 --- a/protected/src/services/off_test_db.php +++ b/protected/src/services/off_test_db.php @@ -8,6 +8,6 @@ bootstrap\registry::get('di')->register('db_mocker', function($args) { $conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); return $conn; } catch (\PDOException $e) { - \tts\exceptions\DB_Exception::customMessage($e); + \CodeHydrater\exceptions\DB_Exception::customMessage($e); } }); \ No newline at end of file