friendship ended with social-app. php is my new best friend
at main 1.2 kB view raw
1<?php 2declare(strict_types=1); 3 4namespace Lcobucci\JWT; 5 6use Lcobucci\JWT\Signer\CannotSignPayload; 7use Lcobucci\JWT\Signer\Ecdsa\ConversionFailed; 8use Lcobucci\JWT\Signer\InvalidKeyProvided; 9use Lcobucci\JWT\Signer\Key; 10 11interface Signer 12{ 13 /** 14 * Returns the algorithm id 15 * 16 * @return non-empty-string 17 */ 18 public function algorithmId(): string; 19 20 /** 21 * Creates a hash for the given payload 22 * 23 * @param non-empty-string $payload 24 * 25 * @return non-empty-string 26 * 27 * @throws CannotSignPayload When payload signing fails. 28 * @throws InvalidKeyProvided When issue key is invalid/incompatible. 29 * @throws ConversionFailed When signature could not be converted. 30 */ 31 public function sign(string $payload, Key $key): string; 32 33 /** 34 * Returns if the expected hash matches with the data and key 35 * 36 * @param non-empty-string $expected 37 * @param non-empty-string $payload 38 * 39 * @throws InvalidKeyProvided When issue key is invalid/incompatible. 40 * @throws ConversionFailed When signature could not be converted. 41 */ 42 public function verify(string $expected, string $payload, Key $key): bool; 43}