34 $key = $this->site_secret->get(
true);
37 return new Hmac(
$key, [$this->crypto,
'areEqual'],
$data, $algo);
53 return "{$time}.{$token}";
69 if (!
preg_match(
'~^(\d+)\.([a-zA-Z0-9\-_]+)$~', $code, $matches)) {
73 $time = (int) $matches[1];
Manages a site-specific secret key, encoded as a 32 byte string "secret".
generateInviteCode(string $username)
Generates a unique invite code for a user.
if(!$annotation instanceof ElggAnnotation) $time
trait TimeUsing
Adds methods for setting the current time (for testing)
validateInviteCode(string $username, string $code)
Validate a user's invite code.
getCurrentTime($modifier= '')
Get the (cloned) time.
if(!$entity instanceof\ElggUser) $data
getHmac($data, $algo= 'sha256', $key= '')
Get an HMAC token builder/validator object.
Component for creating HMAC tokens.
__construct(protected SiteSecret $site_secret, protected Crypto $crypto)
Constructor.
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Provides a factory for HMAC objects.