23 lines
577 B
PHP
23 lines
577 B
PHP
<?php
|
|
|
|
namespace Slovocast\Infrastructure\User;
|
|
|
|
use Slovocast\Infrastructure\Api\User\UserAuthorizationInterface;
|
|
|
|
/**
|
|
* This empty class will essentially just check hashed passwords passed into it
|
|
* using the default `password_` functions from PHP.
|
|
*/
|
|
class BasicUserAuthorization implements UserAuthorizationInterface
|
|
{
|
|
public function hash(string $password): string
|
|
{
|
|
return password_hash($password, PASSWORD_BCRYPT);
|
|
}
|
|
|
|
public function verify(string $password, string $hash): bool
|
|
{
|
|
return password_verify($password, $hash);
|
|
}
|
|
}
|