Elgg  Version master
Public Member Functions | List of all members
Elgg\Security\HmacFactory Class Reference

Provides a factory for HMAC objects. More...

Public Member Functions

 __construct (protected SiteSecret $site_secret, protected Crypto $crypto)
 Constructor. More...
 
 getHmac ($data, $algo= 'sha256', $key= '')
 Get an HMAC token builder/validator object. More...
 
 generateInviteCode (string $username)
 Generates a unique invite code for a user. More...
 
 validateInviteCode (string $username, string $code)
 Validate a user's invite code. More...
 

Detailed Description

Provides a factory for HMAC objects.

Definition at line 10 of file HmacFactory.php.

Constructor & Destructor Documentation

Elgg\Security\HmacFactory::__construct ( protected SiteSecret  $site_secret,
protected Crypto  $crypto 
)

Constructor.

Parameters
SiteSecret$site_secretSite secret
Crypto$cryptoElgg crypto service

Definition at line 20 of file HmacFactory.php.

Member Function Documentation

Elgg\Security\HmacFactory::generateInviteCode ( string  $username)

Generates a unique invite code for a user.

Parameters
string$usernameThe username of the user sending the invitation
Returns
string Invite code
See also
self::validateInviteCode()
Since
5.0

Definition at line 49 of file HmacFactory.php.

Elgg\Security\HmacFactory::getHmac (   $data,
  $algo = 'sha256',
  $key = '' 
)

Get an HMAC token builder/validator object.

Parameters
mixed$dataHMAC data or serializable data
string$algoHash algorithm
string$keyOptional key (default uses site secret)
Returns
Hmac

Definition at line 32 of file HmacFactory.php.

Elgg\Security\HmacFactory::validateInviteCode ( string  $username,
string  $code 
)

Validate a user's invite code.

Parameters
string$usernameThe username
string$codeThe invite code
Returns
bool
See also
self::generateInviteCode()
Since
5.0

Definition at line 66 of file HmacFactory.php.


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