35 if (!is_string($data)) {
36 $data = serialize($data);
48 $bytes = hash_hmac($this->algo, $this->data, $this->key,
true);
61 return call_user_func($this->comparator, $expected_token,
$token);
Exception thrown if an argument is not of the expected type.
__construct(protected string $key, callable $comparator, $data, protected string $algo= 'sha256')
Constructor.
matchesToken($token)
Does the MAC match the given token?
getToken()
Get the HMAC token in Base64URL encoding.
Component for creating HMAC tokens.
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
static encode($bytes)
Encode base 64 URL.