Свойство | Type | Description | |
---|---|---|---|
$methods |
Méthode | Description | |
---|---|---|
decode ( string $jwt, string | Array | null $key = null, boolean $verify = true ) : object | Decodes a JWT string into a PHP object. | |
encode ( object | array $payload, string $key, string $algo = 'HS256', $keyId = null ) : string | Converts and signs a PHP object or array into a JWT string. | |
jsonDecode ( string $input ) : object | Decode a JSON string into a PHP object. | |
jsonEncode ( object | array $input ) : string | Encode a PHP object into a JSON string. | |
sign ( string $msg, string | resource $key, string $method = 'HS256' ) : string | Sign a string with a given key and algorithm. | |
urlsafeB64Decode ( string $input ) : string | Decode a string with URL-safe Base64. | |
urlsafeB64Encode ( string $input ) : string | Encode a string with URL-safe Base64. | |
verify ( string $msg, string $signature, string | resource $key, string $method = 'HS256' ) : boolean | Verify a signature with the mesage, key and method. Not all methods are symmetric, so we must have a separate verify and sign method. |
Méthode | Description | |
---|---|---|
handleJsonError ( integer $errno ) : void | Helper method to create a JSON error. |
public static jsonDecode ( string $input ) : object | ||
$input | string | JSON string |
Résultat | object | Object representation of JSON string |
public static sign ( string $msg, string | resource $key, string $method = 'HS256' ) : string | ||
$msg | string | The message to sign |
$key | string | resource | The secret key |
$method | string | The signing algorithm. Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256' |
Résultat | string | An encrypted message |
public static urlsafeB64Decode ( string $input ) : string | ||
$input | string | A Base64 encoded string |
Résultat | string | A decoded string |
public static urlsafeB64Encode ( string $input ) : string | ||
$input | string | The string you want encoded |
Résultat | string | The base64 encode of what you passed in |
public static verify ( string $msg, string $signature, string | resource $key, string $method = 'HS256' ) : boolean | ||
$msg | string | the original message |
$signature | string | |
$key | string | resource | for HS*, a string key works. for RS*, must be a resource of an openssl public key |
$method | string | |
Résultat | boolean |