public static createJWEToCompactJSON ( $payload, Jose\Object\JWKInterface $recipient_key, array $shared_protected_headers ) | ||
$recipient_key | Jose\Object\JWKInterface | |
$shared_protected_headers | array |
/** * Create a JSON Web Token. * * @param array $payload * @return string * @throws JWTException */ public function encode(array $payload) { try { $token = JWEFactory::createJWEToCompactJSON($payload, $this->encryptionKey, ['alg' => 'dir', 'enc' => $this->encryptionKey->get('alg'), 'zip' => 'DEF']); return JWSFactory::createJWSToCompactJSON($token, $this->signatureKey, ['alg' => $this->signatureKey->get('alg'), 'zip' => 'DEF']); } catch (Exception $e) { throw new JWTException('Could not create token: ' . $e->getMessage()); } }