[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS 4 * 5 * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause 6 */ 7 8 namespace Lcobucci\JWT; 9 10 use Lcobucci\JWT\Signer\Key; 11 12 /** 13 * This class represents a token signature 14 * 15 * @author Luís Otávio Cobucci Oblonczyk <[email protected]> 16 * @since 0.1.0 17 */ 18 class Signature 19 { 20 /** 21 * The resultant hash 22 * 23 * @var string 24 */ 25 protected $hash; 26 27 /** @var string */ 28 private $encoded; 29 30 /** 31 * Initializes the object 32 * 33 * @param string $hash 34 * @param string $encoded 35 */ 36 public function __construct($hash, $encoded = '') 37 { 38 $this->hash = $hash; 39 $this->encoded = $encoded; 40 } 41 42 /** @return self */ 43 public static function fromEmptyData() 44 { 45 return new self('', ''); 46 } 47 48 /** 49 * Verifies if the current hash matches with with the result of the creation of 50 * a new signature with given data 51 * 52 * @param Signer $signer 53 * @param string $payload 54 * @param Key|string $key 55 * 56 * @return boolean 57 */ 58 public function verify(Signer $signer, $payload, $key) 59 { 60 return $signer->verify($this->hash, $payload, $key); 61 } 62 63 /** 64 * Returns the current hash as a string representation of the signature 65 * 66 * @deprecated This method has been removed from the public API in v4 67 * @see Signature::hash() 68 * 69 * @return string 70 */ 71 public function __toString() 72 { 73 return $this->hash; 74 } 75 76 /** @return string */ 77 public function hash() 78 { 79 return $this->hash; 80 } 81 82 /** @return string */ 83 public function toString() 84 { 85 return $this->encoded; 86 } 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |