Skip to content

Commit

Permalink
Relocate into constant
Browse files Browse the repository at this point in the history
  • Loading branch information
julik authored and anakinj committed Jan 29, 2024
1 parent 1ec2e7f commit 6af6de5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/jwt/jwk/ec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class EC < KeyBase # rubocop:disable Metrics/ClassLength
EC_PUBLIC_KEY_ELEMENTS = %i[kty crv x y].freeze
EC_PRIVATE_KEY_ELEMENTS = %i[d].freeze
EC_KEY_ELEMENTS = (EC_PRIVATE_KEY_ELEMENTS + EC_PUBLIC_KEY_ELEMENTS).freeze
ZERO_BYTE = "\0".b.freeze

def initialize(key, params = nil, options = {})
params ||= {}
Expand Down Expand Up @@ -221,7 +222,7 @@ def decode_octets(base64_encoded_coordinate)
# to check for this truncation is thus to check whether the number of bytes
# is odd, and restore the leading 0-byte if it is.
if bytes.bytesize.odd?
"\0".b + bytes
ZERO_BYTE + bytes
else
bytes
end
Expand Down

0 comments on commit 6af6de5

Please sign in to comment.