PHP 8.2.30
Preview: Key.php Size: 1.29 KB
/home/byroehnu/easetack.com/vendor/firebase/php-jwt/src/Key.php

<?php

namespace Firebase\JWT;

use InvalidArgumentException;
use OpenSSLAsymmetricKey;
use OpenSSLCertificate;
use TypeError;

class Key
{
    /**
     * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
     * @param string $algorithm
     */
    public function __construct(
        private $keyMaterial,
        private string $algorithm
    ) {
        if (
            !\is_string($keyMaterial)
            && !$keyMaterial instanceof OpenSSLAsymmetricKey
            && !$keyMaterial instanceof OpenSSLCertificate
            && !\is_resource($keyMaterial)
        ) {
            throw new TypeError('Key material must be a string, resource, or OpenSSLAsymmetricKey');
        }

        if (empty($keyMaterial)) {
            throw new InvalidArgumentException('Key material must not be empty');
        }

        if (empty($algorithm)) {
            throw new InvalidArgumentException('Algorithm must not be empty');
        }
    }

    /**
     * Return the algorithm valid for this key
     *
     * @return string
     */
    public function getAlgorithm(): string
    {
        return $this->algorithm;
    }

    /**
     * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate
     */
    public function getKeyMaterial()
    {
        return $this->keyMaterial;
    }
}

Directory Contents

Dirs: 0 × Files: 8

Name Size Perms Modified Actions
357 B lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
7.12 KB lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
353 B lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
11.78 KB lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
23.66 KB lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
396 B lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
1.29 KB lrw-rw-rw- 2025-04-09 20:32:01
Edit Download
102 B lrw-rw-rw- 2025-04-09 20:32:01
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).