CoreFiles by mySites.guru
None.php41 lines, 825 bytes, from Joomla_5.2.6-Stable-Full_Package.zip
Raw History Compare with 5.2.5
md5
e3270524f6ba68bdcfc14777154cf699
sha1
ecd5c78c5d3d0c150fe70322b78f8b69135ba633
sha256
c26b004d749117b367ded0ff93fc72e473848617934102ab30e2aa5c99ec5575
<?php

declare(strict_types=1);

namespace Jose\Component\Signature\Algorithm;

use InvalidArgumentException;
use Jose\Component\Core\JWK;
use function in_array;

final class None implements SignatureAlgorithm
{
    public function allowedKeyTypes(): array
    {
        return ['none'];
    }

    public function sign(JWK $key, string $input): string
    {
        $this->checkKey($key);

        return '';
    }

    public function verify(JWK $key, string $input, string $signature): bool
    {
        return $signature === '';
    }

    public function name(): string
    {
        return 'none';
    }

    private function checkKey(JWK $key): void
    {
        if (! in_array($key->get('kty'), $this->allowedKeyTypes(), true)) {
            throw new InvalidArgumentException('Wrong key type.');
        }
    }
}

The same content is in 136 releases, Joomla 5.1.0-beta1 to 6.3.0-alpha1. See them all, or every version of this file.