Skip to content

Commit

Permalink
Use the gem specific Base64 methods
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Dec 12, 2020
1 parent 09f53a6 commit 612c8e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/jwt/jwk/ec.rb
Expand Up @@ -70,11 +70,11 @@ def keypair_components(ec_keypair)
end

def encode_octets(octets)
::Base64.urlsafe_encode64(octets, padding: false)
::JWT::Base64.url_encode(octets)
end

def encode_open_ssl_bn(key_part)
::Base64.urlsafe_encode64(key_part.to_s(BINARY), padding: false)
::JWT::Base64.url_encode(key_part.to_s(BINARY))
end

class << self
Expand Down Expand Up @@ -136,11 +136,11 @@ def ec_pkey(jwk_crv, jwk_x, jwk_y, jwk_d)
end

def decode_octets(jwk_data)
::Base64.urlsafe_decode64(jwk_data)
::JWT::Base64.url_decode(jwk_data)
end

def decode_open_ssl_bn(jwk_data)
OpenSSL::BN.new(::Base64.urlsafe_decode64(jwk_data), BINARY)
OpenSSL::BN.new(::JWT::Base64.url_decode(jwk_data), BINARY)
end
end
end
Expand Down

0 comments on commit 612c8e9

Please sign in to comment.