Elgg  Version 6.1
Public Member Functions | Protected Attributes | List of all members
Elgg\Security\Hmac Class Reference

Component for creating HMAC tokens. More...

Public Member Functions

 __construct (protected string $key, callable $comparator, $data, protected string $algo= 'sha256')
 Constructor. More...
 
 getToken ()
 Get the HMAC token in Base64URL encoding. More...
 
 matchesToken ($token)
 Does the MAC match the given token? More...
 

Protected Attributes

 $comparator
 
string $data
 

Detailed Description

Component for creating HMAC tokens.

Definition at line 10 of file Hmac.php.

Constructor & Destructor Documentation

Elgg\Security\Hmac::__construct ( protected string  $key,
callable  $comparator,
  $data,
protected string  $algo = 'sha256' 
)

Constructor.

Parameters
string$keyHMAC key
callable$comparatorFunction that returns true if given two equal strings, else false
mixed$dataHMAC data string or serializable data
string$algoHash algorithm
Exceptions

Definition at line 29 of file Hmac.php.

Member Function Documentation

Elgg\Security\Hmac::getToken ( )

Get the HMAC token in Base64URL encoding.

Returns
string

Definition at line 47 of file Hmac.php.

Elgg\Security\Hmac::matchesToken (   $token)

Does the MAC match the given token?

Parameters
string$tokenHMAC token in Base64URL encoding
Returns
bool

Definition at line 59 of file Hmac.php.

Member Data Documentation

Elgg\Security\Hmac::$comparator
protected

Definition at line 15 of file Hmac.php.

string Elgg\Security\Hmac::$data
protected

Definition at line 17 of file Hmac.php.


The documentation for this class was generated from the following file: