Skip to content

Jwt

See Also:

  • https://github.com/F21/jwt -

Methods

encode

public encode(mixed $payload, mixed $key, string $algo = 'HS256'): string

Parameters:

Parameter Type Description
$payload mixed
$key mixed
$algo string

decode

public decode(string $jwt, null $key = null, array|bool $allowedAlgorithms = true): bool|mixed

Parameters:

Parameter Type Description
$jwt string
$key null
$allowedAlgorithms array|bool

verifySignature

private verifySignature(mixed $signature, mixed $input, mixed $key, string $algo = 'HS256'): bool

Parameters:

Parameter Type Description
$signature mixed
$input mixed
$key mixed
$algo string

Throws:


sign

private sign(mixed $input, mixed $key, string $algo = 'HS256'): string

Parameters:

Parameter Type Description
$input mixed
$key mixed
$algo string

Throws:


generateRSASignature

private generateRSASignature(mixed $input, mixed $key, string $algo): mixed

Parameters:

Parameter Type Description
$input mixed
$key mixed
$algo string

Throws:


urlSafeB64Encode

public urlSafeB64Encode(string $data): string

Parameters:

Parameter Type Description
$data string

urlSafeB64Decode

public urlSafeB64Decode(string $b64): mixed|string

Parameters:

Parameter Type Description
$b64 string

generateJwtHeader

Override to create a custom header

protected generateJwtHeader(mixed $payload, mixed $algorithm): mixed

Parameters:

Parameter Type Description
$payload mixed
$algorithm mixed

hash_equals

protected hash_equals(string $a, string $b): bool

Parameters:

Parameter Type Description
$a string
$b string


Automatically generated on 2025-03-18