| 1 | <?php |
||
| 10 | class TokenSignatory |
||
| 11 | { |
||
| 12 | protected $key; |
||
| 13 | protected $algo; |
||
| 14 | protected $base64url; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Create a new TokenSignatory. |
||
| 18 | * |
||
| 19 | * @param string $key Shared secret key used for generating token signatures |
||
| 20 | * @param string $algo Name of hashing algorithm. See hash_algos() for a list of supported algorithms |
||
| 21 | */ |
||
| 22 | public function __construct($key, $algo = 'SHA512') |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Sign a Base64Url encoded token payload. |
||
| 35 | * |
||
| 36 | * @param string $tokenPayload The Base64Url encoded token payload |
||
| 37 | * |
||
| 38 | * @return string Base64Url encoded signature |
||
| 39 | */ |
||
| 40 | public function __invoke($tokenPayload) |
||
| 44 | } |
||
| 45 |