Class: COSE::Recipient

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

Constant Summary

Constants inherited from SecurityMessage

SecurityMessage::ZERO_LENGTH_BIN_STRING

Instance Attribute Summary collapse

Attributes inherited from SecurityMessage

#protected_headers, #unprotected_headers

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SecurityMessage

#algorithm, deserialize, deserialize_headers, from_array, #headers

Constructor Details

#initialize(ciphertext:, recipients: nil, **keyword_arguments) ⇒ Recipient

Returns a new instance of Recipient.



19
20
21
22
23
24
# File 'lib/cose/recipient.rb', line 19

def initialize(ciphertext:, recipients: nil, **keyword_arguments)
  super(**keyword_arguments)

  @ciphertext = ciphertext
  @recipients = recipients
end

Instance Attribute Details

#ciphertextObject (readonly)

Returns the value of attribute ciphertext.



7
8
9
# File 'lib/cose/recipient.rb', line 7

def ciphertext
  @ciphertext
end

#recipientsObject (readonly)

Returns the value of attribute recipients.



7
8
9
# File 'lib/cose/recipient.rb', line 7

def recipients
  @recipients
end

Class Method Details

.keyword_arguments_for_initialize(decoded) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/cose/recipient.rb', line 9

def self.keyword_arguments_for_initialize(decoded)
  keyword_arguments = { ciphertext: decoded[0] }

  if decoded[1]
    keyword_arguments[:recipients] = decoded[1].map { |s| COSE::Recipient.deserialize(s) }
  end

  keyword_arguments
end