75 lines
1.5 KiB
PHP
75 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Core\Facades;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* NovaCore Security Facade
|
||
|
|
* Static access to security services
|
||
|
|
*/
|
||
|
|
class Security
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Get security instance
|
||
|
|
*/
|
||
|
|
public static function instance(): \App\Core\Security
|
||
|
|
{
|
||
|
|
return app('security');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Generate CSRF token
|
||
|
|
*/
|
||
|
|
public static function generateCsrfToken(): string
|
||
|
|
{
|
||
|
|
return self::instance()->generateCsrfToken();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Verify CSRF token
|
||
|
|
*/
|
||
|
|
public static function verifyCsrfToken(string $token): bool
|
||
|
|
{
|
||
|
|
return self::instance()->verifyCsrfToken($token);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Sanitize string input
|
||
|
|
*/
|
||
|
|
public static function sanitizeString(string $input): string
|
||
|
|
{
|
||
|
|
return self::instance()->sanitizeString($input);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Encrypt data
|
||
|
|
*/
|
||
|
|
public static function encrypt(string $data): string
|
||
|
|
{
|
||
|
|
return self::instance()->encrypt($data);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Decrypt data
|
||
|
|
*/
|
||
|
|
public static function decrypt(string $encryptedData): string
|
||
|
|
{
|
||
|
|
return self::instance()->decrypt($encryptedData);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Hash password
|
||
|
|
*/
|
||
|
|
public static function hashPassword(string $password): string
|
||
|
|
{
|
||
|
|
return self::instance()->hashPassword($password);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Verify password
|
||
|
|
*/
|
||
|
|
public static function verifyPassword(string $password, string $hash): bool
|
||
|
|
{
|
||
|
|
return self::instance()->verifyPassword($password, $hash);
|
||
|
|
}
|
||
|
|
}
|