module JSON::JWK::JWKizable::EC

def coordinates

def coordinates
  unless @coordinates
    hex = public_key.to_bn.to_s(16)
    data_len = hex.length - 2
    hex_x = hex[2, data_len / 2]
    hex_y = hex[2 + data_len / 2, data_len / 2]
    @coordinates = {
      x: hex_x,
      y: hex_y
    }
    @coordinates[:d] = private_key.to_s(16) if private_key?
  end
  @coordinates
end