Class: COSE::Mac

Inherits:
SecurityMessage show all
Defined in:
lib/cose/mac.rb

Instance Attribute Summary collapse

Attributes inherited from SecurityMessage

#protected_headers, #unprotected_headers

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SecurityMessage

deserialize

Constructor Details

#initialize(payload:, tag:, recipients:, **keyword_arguments) ⇒ Mac


16
17
18
19
20
21
22
# File 'lib/cose/mac.rb', line 16

def initialize(payload:, tag:, recipients:, **keyword_arguments)
  super(**keyword_arguments)

  @payload = payload
  @tag = tag
  @recipients = recipients
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload


6
7
8
# File 'lib/cose/mac.rb', line 6

def payload
  @payload
end

#recipientsObject (readonly)

Returns the value of attribute recipients


6
7
8
# File 'lib/cose/mac.rb', line 6

def recipients
  @recipients
end

#tagObject (readonly)

Returns the value of attribute tag


6
7
8
# File 'lib/cose/mac.rb', line 6

def tag
  @tag
end

Class Method Details

.keyword_arguments_for_initialize(decoded) ⇒ Object


8
9
10
11
12
13
14
# File 'lib/cose/mac.rb', line 8

def self.keyword_arguments_for_initialize(decoded)
  {
    payload: CBOR.decode(decoded[0]),
    tag: decoded[1],
    recipients: decoded[2].map { |s| COSE::Recipient.deserialize(s) }
  }
end