lib/acme/client/jwk/base.rb in acme-client-2.0.4 vs lib/acme/client/jwk/base.rb in acme-client-2.0.5
- old
+ new
@@ -12,13 +12,13 @@
#
# header - A Hash of extra header fields to include.
# payload - A Hash of payload data.
#
# Returns a JSON String.
- def jws(header: {}, payload: {})
+ def jws(header: {}, payload:)
header = jws_header(header)
encoded_header = Acme::Client::Util.urlsafe_base64(header.to_json)
- encoded_payload = Acme::Client::Util.urlsafe_base64(payload.to_json)
+ encoded_payload = Acme::Client::Util.urlsafe_base64(payload.nil? ? '' : payload.to_json)
signature_data = "#{encoded_header}.#{encoded_payload}"
signature = sign(signature_data)
encoded_signature = Acme::Client::Util.urlsafe_base64(signature)