fetchAuthCode($code))) { * return null; * } * * if (isExpired($authCodeData)) { * return null; * } * * try { * $validateAuthCode($authCodeData); * } catch (IndieAuthException $e) { * $this->deleteAuthCode($code); * throw $e; * } * * return $this->newTokenFromAuthCodeData($authCodeData); * } * ``` * * Refer to reference implementations in the `Taproot\IndieAuth\Storage` namespace for * reference. * * @param string $code The Authorization Code to attempt to exchange. * @param callable $validateAuthCode A callable to perform additional validation if valid auth code data is found. Takes `array $authCodeData`, raises `Taproot\IndieAuth\IndieAuthException` on invalid data, which should be bubbled up to the caller after any clean-up. Returns void. * @return array|null An array of access token data to return to the client on success, null on any error. */ public function exchangeAuthCodeForAccessToken(string $code, callable $validateAuthCode): ?array; /** * Get Access Token * * Fetch access token data identified by the token `$token`, returning * null if it is expired or invalid. */ public function getAccessToken(string $token): ?array; /** * Revoke Access Token * * Revoke the access token identified by `$token`. Return true on success, * or false on error, including if the token did not exist. */ public function revokeAccessToken(string $token): bool; }