Module: JSON::JWK::JWKizable::EC
- Defined in:
- lib/json/jwk/jwkizable.rb
Instance Method Summary collapse
Instance Method Details
#to_jwk(ex_params = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/json/jwk/jwkizable.rb', line 26 def to_jwk(ex_params = {}) params = { kty: :EC, crv: curve_name, x: Base64.urlsafe_encode64([coordinates[:x]].pack('H*'), padding: false), y: Base64.urlsafe_encode64([coordinates[:y]].pack('H*'), padding: false) }.merge ex_params params[:d] = Base64.urlsafe_encode64([coordinates[:d]].pack('H*'), padding: false) if private_key? JWK.new params end |