ChallengeStore
ChallengeStore
class ChallengeStoreConstants
int
public const int = nullProperties
cache
where records are kept; needs a backend whose remove() reports whether it removed anything (all the built-in ones do), which makes redemption atomic
private CacheAdapter $cacheType: Hazaar\Cache\Adapter
timeout
how long a challenge stays valid, in seconds
private int $timeout = 300Type: int
Methods
__construct
public __construct(CacheAdapter $cache, int $timeout = 300): voidParameters
| Parameter | Type | Description |
|---|---|---|
$cache | Hazaar\Cache\Adapter | where records are kept; needs a backend whose remove() reports whether it removed anything (all the built-in ones do), which makes redemption atomic |
$timeout | int | how long a challenge stays valid, in seconds |
fromConfig
Builds a store from config: backend and options for the cache, and timeout.
public fromConfig(array $config): selfReturns: self
Parameters
| Parameter | Type | Description |
|---|---|---|
$config | array |
timeout
public timeout(): intReturns: int
issue
Issues a new random challenge.
public issue(string $ceremony, ?string $identity, ?string $userHandle, bool $userVerification = true, array $allowCredentials): ChallengeRecordReturns: Hazaar\Auth\WebAuthn\ChallengeRecord
Parameters
| Parameter | Type | Description |
|---|---|---|
$ceremony | string | |
$identity | string | |
$userHandle | string | |
$userVerification | bool | |
$allowCredentials | array | raw credential IDs |
consume
Redeems a challenge. Only one caller ever gets a given challenge back, even when two present it at once.
public consume(string $challenge, string $ceremony): ?ChallengeRecordReturns: Hazaar\Auth\WebAuthn\ChallengeRecord
Parameters
| Parameter | Type | Description |
|---|---|---|
$challenge | string | |
$ceremony | string |
key
32 bytes, so it fits every cache backend (the File backend's default key size is 32). A truncated hash can
private key(string $challenge): stringReturns: string
collide, but consume() compares the full stored challenge, so a collision only ever fails.
Parameters
| Parameter | Type | Description |
|---|---|---|
$challenge | string |
Generated by Hazaar API Doc Generator on Wed, 28 Oct 2026 08:43:30 +0000