API / Minn\Auth / Nonce

Nonce final class

Minn\Auth\Nonce · public/minn/src/Minn/Auth/Nonce.php · 46 lines

The wp_rest nonce: ten characters of HMAC-md5(tick|wp_rest|uid|token) under the nonce salt, accepted for the current tick and the one before.

Constants and properties

privateLIFETIME = 86400

Public

staticlifetime(string|int $action): int#

How long a nonce for an action lives, in seconds (nonce_life, handed the action as the caller gave it; probe filter-inputs-3). A plugin's filter reaches every nonce the engine makes and checks once plugins have loaded; a lifetime under a second keeps the default.

statictick(string|int $action = -1): float#

The current half-life tick a nonce for an action is bound to.

staticcreate(int $userId, string $token, string|int $action = 'wp_rest'): string#

A wp_rest nonce for a user and session token at the current tick.

staticverify(string $nonce, int $userId, string $token, string $action = 'wp_rest'): bool#

Whether a nonce is valid at this tick or the one before.

staticat(float $tick, int $userId, string $token, string $action): string#

The nonce for a given tick.