Sha256: 13bb7e4a9beb361822089bcdde64a75142fc46f21046f0a3510727103479fd1a
Contents?: true
Size: 947 Bytes
Versions: 5
Compression:
Stored size: 947 Bytes
Contents
# frozen_string_literal: true require "cose/key/base" require "openssl" module COSE module Key class CurveKey < Base LABEL_CRV = -1 LABEL_X = -2 LABEL_D = -4 attr_reader :crv, :d, :x def self.keyword_arguments_for_initialize(map) { crv: map[LABEL_CRV], x: map[LABEL_X], d: map[LABEL_D] } end def initialize(crv:, x: nil, d: nil, **keyword_arguments) # rubocop:disable Naming/MethodParameterName super(**keyword_arguments) if !crv raise ArgumentError, "Required crv is missing" elsif !x && !d raise ArgumentError, "x and d cannot be missing simultaneously" else @crv = crv @x = x @d = d end end def map super.merge( LABEL_CRV => crv, LABEL_X => x, LABEL_D => d ).compact end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
cose-1.3.1 | lib/cose/key/curve_key.rb |
cose-1.3.0 | lib/cose/key/curve_key.rb |
cose-1.2.1 | lib/cose/key/curve_key.rb |
cose-1.2.0 | lib/cose/key/curve_key.rb |
cose-1.1.0 | lib/cose/key/curve_key.rb |