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

Provides a factory for HMAC objects. More...

Public Member Functions

 __construct (SiteSecret $secret, 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...
 

Protected Attributes

 $site_secret
 
 $crypto
 

Detailed Description

Provides a factory for HMAC objects.

Definition at line 10 of file HmacFactory.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
SiteSecret$secretSite secret
Crypto$cryptoElgg crypto service

Definition at line 30 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 61 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 44 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 78 of file HmacFactory.php.

Member Data Documentation

Elgg\Security\HmacFactory::$crypto
protected

Definition at line 22 of file HmacFactory.php.

Elgg\Security\HmacFactory::$site_secret
protected

Definition at line 17 of file HmacFactory.php.


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