mirror of
https://github.com/itflow-org/itflow
synced 2026-06-26 03:31:05 +00:00
Revert "Add new optional beta email parser thats based on ImapEngine instead of Webklex"
This reverts commit 9cb1ff7330.
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\SerializableClosure\Signers;
|
||||
|
||||
use Laravel\SerializableClosure\Contracts\Signer;
|
||||
|
||||
class Hmac implements Signer
|
||||
{
|
||||
/**
|
||||
* The secret key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $secret;
|
||||
|
||||
/**
|
||||
* Creates a new signer instance.
|
||||
*
|
||||
* @param string $secret
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($secret)
|
||||
{
|
||||
$this->secret = $secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign the given serializable.
|
||||
*
|
||||
* @param string $serialized
|
||||
* @return array
|
||||
*/
|
||||
public function sign($serialized)
|
||||
{
|
||||
return [
|
||||
'serializable' => $serialized,
|
||||
'hash' => base64_encode(hash_hmac('sha256', $serialized, $this->secret, true)),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the given signature.
|
||||
*
|
||||
* @param array{serializable: string, hash: string} $signature
|
||||
* @return bool
|
||||
*/
|
||||
public function verify($signature)
|
||||
{
|
||||
return hash_equals(base64_encode(
|
||||
hash_hmac('sha256', $signature['serializable'], $this->secret, true)
|
||||
), $signature['hash']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user