RefreshTokenStore
RefreshTokenStore
Default Hazaar\Auth\Interface\DeviceAwareRefreshTokenStore implementation, backed by a single Hazaar\Util\BTree
class RefreshTokenStore implements \Hazaar\Auth\Interface\DeviceAwareRefreshTokenStoreImplements: Hazaar\Auth\Interface\DeviceAwareRefreshTokenStore
file under the application's runtime directory.
Chosen as the framework default over a DBI-backed store because it needs no app-owned schema or migration at all: every application has a runtime directory by definition (Application::bootstrap() requires and initializes it unconditionally), whereas a database table is an app concern the framework has no business assuming. This store is local to one instance/container's runtime dir, so a horizontally-scaled deployment (multiple app instances behind a load balancer) should use Hazaar\Auth\Store\Cache\RefreshTokenStore with a shared cache backend (redis/memcached) instead -- a token minted by instance A won't be redeemable via instance B's local file.
Tokens are hashed with SHA-256 before storage and lookup -- the plaintext value is never persisted, the same way a password would be handled.
Configured via a Hazaar\Auth\Session\Backend\JWT backend's refresh_tokens_options -- see Hazaar\Auth\Store\File\RefreshTokenStore\Options for the available keys.
Constants
KEY_SIZE
private const KEY_SIZE = 65Properties
store
private BTree $storeType: Hazaar\Util\BTree
Methods
__construct
public __construct(array|Options $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array | Hazaar\Auth\Store\File\RefreshTokenStore\Options |
save
public save(RefreshToken $token): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | Hazaar\Auth\RefreshToken |
consume
public consume(string $token): ?RefreshTokenReturns: Hazaar\Auth\RefreshToken
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string |
revoke
public revoke(string $token): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string |
revokeAll
public revokeAll(string $identity): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string |
listDevices
public listDevices(string $identity): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string |
revokeDevice
public revokeDevice(string $identity, string $sessionId): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | |
$sessionId | string |
toRecord
private toRecord(RefreshToken $token): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | Hazaar\Auth\RefreshToken |
fromRecord
private fromRecord(string $token, array $record): RefreshTokenReturns: Hazaar\Auth\RefreshToken
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string | |
$record | array |
hydrateDeviceInfo
private hydrateDeviceInfo(mixed $data): ?DeviceInfoReturns: Hazaar\Auth\DeviceInfo
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed |
tokenKey
private tokenKey(string $token): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$token | string |
indexKey
private indexKey(string $identity): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string |
indexKeys
private indexKeys(string $indexKey): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$indexKey | string |
indexAdd
private indexAdd(string $identity, string $tokenKey): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | |
$tokenKey | string |
indexRemove
private indexRemove(string $identity, string $tokenKey): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | string | |
$tokenKey | string |
Generated by Hazaar API Doc Generator on Sun, 23 Aug 2026 10:49:44 +0000