| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Jose\Component\Signature; |
| 6 |
|
| 7 |
use function array_key_exists; |
| 8 |
use InvalidArgumentException; |
| 9 |
use Facile\JoseVerifier\Psalm\PsalmTypes; |
| 10 |
|
| 11 |
/** |
| 12 |
* @psalm-type JWTHeaderType = array{alg?: non-empty-string, |
| 13 |
* enc?: non-empty-string, |
| 14 |
* jku?: non-empty-string, |
| 15 |
* jwk?: non-empty-string, |
| 16 |
* kid?: non-empty-string, |
| 17 |
* x5u?: non-empty-string, |
| 18 |
* x5c?: non-empty-string, |
| 19 |
* x5t?: non-empty-string, |
| 20 |
* "x5t#S256"?: non-empty-string, |
| 21 |
* typ?: non-empty-string, |
| 22 |
* cty?: non-empty-string, |
| 23 |
* crit?: non-empty-string |
| 24 |
* } |
| 25 |
*/ |
| 26 |
class Signature |
| 27 |
{ |
| 28 |
/** |
| 29 |
* @param JWTHeaderType $protectedHeader |
| 30 |
* @param JWTHeaderType $header |
| 31 |
*/ |
| 32 |
public function __construct(string $signature, array $protectedHeader, ?string $encodedProtectedHeader, array $header) |
| 33 |
{ |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* The protected header associated with the signature. |
| 38 |
* |
| 39 |
* @return JWTHeaderType |
| 40 |
*/ |
| 41 |
public function getProtectedHeader(): array |
| 42 |
{ |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* The unprotected header associated with the signature. |
| 47 |
* |
| 48 |
* @return JWTHeaderType |
| 49 |
*/ |
| 50 |
public function getHeader(): array |
| 51 |
{ |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* The protected header associated with the signature. |
| 56 |
*/ |
| 57 |
public function getEncodedProtectedHeader(): ?string |
| 58 |
{ |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Returns the value of the protected header of the specified key. |
| 63 |
* |
| 64 |
* @param string $key The key |
| 65 |
* |
| 66 |
* @throws InvalidArgumentException if the header parameter does not exist |
| 67 |
* |
| 68 |
* @return null|mixed Header value |
| 69 |
*/ |
| 70 |
public function getProtectedHeaderParameter(string $key) |
| 71 |
{ |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Returns true if the protected header has the given parameter. |
| 76 |
* |
| 77 |
* @param string $key The key |
| 78 |
*/ |
| 79 |
public function hasProtectedHeaderParameter(string $key): bool |
| 80 |
{ |
| 81 |
} |
| 82 |
|
| 83 |
/** |
| 84 |
* Returns the value of the unprotected header of the specified key. |
| 85 |
* |
| 86 |
* @param string $key The key |
| 87 |
* |
| 88 |
* @return null|mixed Header value |
| 89 |
* |
| 90 |
* @throws InvalidArgumentException |
| 91 |
*/ |
| 92 |
public function getHeaderParameter(string $key) |
| 93 |
{ |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Returns true if the unprotected header has the given parameter. |
| 98 |
* |
| 99 |
* @param string $key The key |
| 100 |
*/ |
| 101 |
public function hasHeaderParameter(string $key): bool |
| 102 |
{ |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Returns the value of the signature. |
| 107 |
*/ |
| 108 |
public function getSignature(): string |
| 109 |
{ |
| 110 |
} |
| 111 |
} |