You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
938 B
32 lines
938 B
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @author Robert Strutts <Bob_586@Yahoo.com>
|
|
* @copyright (c) 2025, Robert Strutts
|
|
* @license MIT
|
|
*/
|
|
|
|
// A more secure class is: \CodeHydrater\services\sodium_storage
|
|
|
|
use CodeHydrater\bootstrap\registry as Reg;
|
|
|
|
Reg::get('di')->register('session_encryption', function($args) {
|
|
try {
|
|
if (! \CodeHydrater\bootstrap\configure::has('sessions', 'session_key')) {
|
|
|
|
$testing = new \CodeHydrater\services\encryption();
|
|
echo "Here is a Key to use: " . $testing->generate_valid_key();
|
|
die("Please assign the config for sessions, session_key!");
|
|
}
|
|
|
|
$enc = new \CodeHydrater\services\encryption(
|
|
\CodeHydrater\bootstrap\configure::get('sessions', 'session_key')
|
|
);
|
|
$enc->change_security_level("lighting"); // Quickest but not secure...
|
|
return $enc;
|
|
} catch (\Exception $e) {
|
|
|
|
}
|
|
}); |