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