PluginProbe
Media Cloud Sync / trunk
Media Cloud Sync vtrunk
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / google / firebase / php-jwt / src / Key.php

Key.php in Media Cloud Sync trunk, at includes/sdk/google/firebase/php-jwt/src/Key.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\GCP\Firebase\JWT;
4
5 use InvalidArgumentException;
6 use OpenSSLAsymmetricKey;
7 use OpenSSLCertificate;
8 use TypeError;
9 class Key
10 {
11 /**
12 * @param string|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
13 * @param string $algorithm
14 */
15 public function __construct(#[\SensitiveParameter] private $keyMaterial, private string $algorithm)
16 {
17 if (!\is_string($keyMaterial) && !$keyMaterial instanceof OpenSSLAsymmetricKey && !$keyMaterial instanceof OpenSSLCertificate) {
18 throw new TypeError('Key material must be a string, OpenSSLCertificate, or OpenSSLAsymmetricKey');
19 }
20 if (empty($keyMaterial)) {
21 throw new InvalidArgumentException('Key material must not be empty');
22 }
23 if (empty($algorithm)) {
24 throw new InvalidArgumentException('Algorithm must not be empty');
25 }
26 }
27 /**
28 * Return the algorithm valid for this key
29 *
30 * @return string
31 */
32 public function getAlgorithm() : string
33 {
34 return $this->algorithm;
35 }
36 /**
37 * @return string|OpenSSLAsymmetricKey|OpenSSLCertificate
38 */
39 public function getKeyMaterial()
40 {
41 return $this->keyMaterial;
42 }
43 }
44