50 if (!in_array(
$algo, hash_algos(),
true)) {
51 throw new \InvalidArgumentException(
'Invalid hash algorithm "'.
$algo.
'"');
72 $this->secretSalt .=
'|'.$data;
92 $offset.
':'.floor((
$time - $offset) / ($this->lifetime + $this->skew)).
':'.$this->secretSalt
129 $splittoken = explode(
'-', $token);
130 if (count($splittoken) !== 2) {
133 $offset = intval(hexdec($splittoken[0]));
134 $value = $splittoken[1];
calculateTokenValue($offset, $time=null)
Calculates a token value for a given offset.
static getSecretSalt()
Retrieve the secret salt.
A class that generates and verifies time-limited tokens.
__construct($lifetime=900, $secretSalt=null, $skew=1, $algo='sha1')
Create a new time-limited token.
validate($token)
Validates a token by calculating the token value for the provided offset and comparing it...
addVerificationData($data)
Add some given data to the current token.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
generate()
Generates a token that contains an offset and a token value, using the current offset.