public function loadAndVerifySignatureUsingKey($input, Object\JWKInterface $jwk, array $allowed_algorithms, &$signature_index = null) { $jwk_set = new Object\JWKSet(); $jwk_set->addKey($jwk); return $this->loadAndVerifySignature($input, $jwk_set, $allowed_algorithms, null, $signature_index); }
/** * Decode a JSON Web Token. * * @param Token $token * @return array * @throws \Tymon\JWTAuth\Exceptions\JWTException */ public function decode($token) { try { $loader = new Loader(); $verifiedJWS = $loader->loadAndVerifySignatureUsingKey((string) $token, $this->signatureKey, [$this->signatureKey->get('alg')]); $jwe = $loader->loadAndDecryptUsingKey($verifiedJWS->getPayload(), $this->encryptionKey, ['dir'], [$this->encryptionKey->get('alg')]); } catch (Exception $e) { throw new TokenInvalidException('Could not decode token: ' . $e->getMessage()); } return $jwe->getPayload(); }