Class: COSE::Key::Symmetric

Inherits:
Base
  • Object
show all
Defined in:
lib/cose/key/symmetric.rb

Constant Summary collapse

K_LABEL =
-1
KTY_SYMMETRIC =
4

Constants inherited from Base

Base::LABEL_KTY

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

deserialize, enforce_type

Constructor Details

#initialize(key_value:) ⇒ Symmetric

Returns a new instance of Symmetric


13
14
15
16
17
18
19
# File 'lib/cose/key/symmetric.rb', line 13

def initialize(key_value:)
  if !key_value
    raise ArgumentError, "Required key value is missing"
  end

  @key_value = key_value
end

Instance Attribute Details

#key_valueObject (readonly)

Returns the value of attribute key_value


11
12
13
# File 'lib/cose/key/symmetric.rb', line 11

def key_value
  @key_value
end

Class Method Details

.from_map(map) ⇒ Object


21
22
23
24
25
# File 'lib/cose/key/symmetric.rb', line 21

def self.from_map(map)
  enforce_type(map, KTY_SYMMETRIC, "Not a Symmetric key")

  new(key_value: map[K_LABEL])
end