/** * {@inheritdoc} */ public function sign($payload, array $signature_protected_headers, Object\JWKInterface $signature_key) { $jws = Factory\JWSFactory::createJWS($payload); $jws = $jws->addSignatureInformation($signature_key, $signature_protected_headers); $this->signer->sign($jws); return $jws->toCompactJSON(0); }
/** * @param array $claims * @param array $protected_headers * * @return string */ public function sign(array $claims, array $protected_headers) { $instruction = new SignatureInstruction($this->signature_key, $protected_headers); return $this->signer->sign($claims, [$instruction], JSONSerializationModes::JSON_COMPACT_SERIALIZATION); }