Class: Melos::Struct::MLSMessage

Inherits:
Base
  • Object
show all
Defined in:
lib/melos/struct/structs.rb

Constant Summary collapse

STRUCT =
[
  [:version, :uint16], #mls10 = 1
  [:wire_format, :uint16],
  [:public_message,  :select, ->(ctx){ctx[:wire_format] == Melos::Constants::WireFormat::MLS_PUBLIC_MESSAGE}, :class, Melos::Struct::PublicMessage],
  [:private_message, :select, ->(ctx){ctx[:wire_format] == Melos::Constants::WireFormat::MLS_PRIVATE_MESSAGE}, :class, Melos::Struct::PrivateMessage],
  [:welcome,         :select, ->(ctx){ctx[:wire_format] == Melos::Constants::WireFormat::MLS_WELCOME}, :class, Melos::Struct::Welcome],
  [:group_info,      :select, ->(ctx){ctx[:wire_format] == Melos::Constants::WireFormat::MLS_GROUP_INFO}, :class, Melos::Struct::GroupInfo],
  [:key_package,     :select, ->(ctx){ctx[:wire_format] == Melos::Constants::WireFormat::MLS_KEY_PACKAGE}, :class, Melos::Struct::KeyPackage]
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#deserialize_select_elem_with_context, #initialize, #raw

Constructor Details

This class inherits a constructor from Melos::Struct::Base

Instance Attribute Details

#group_infoObject

Returns the value of attribute group_info.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def group_info
  @group_info
end

#key_packageObject

Returns the value of attribute key_package.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def key_package
  @key_package
end

#private_messageObject

Returns the value of attribute private_message.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def private_message
  @private_message
end

#public_messageObject

Returns the value of attribute public_message.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def public_message
  @public_message
end

#versionObject

Returns the value of attribute version.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def version
  @version
end

#welcomeObject

Returns the value of attribute welcome.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def welcome
  @welcome
end

#wire_formatObject

Returns the value of attribute wire_format.



1004
1005
1006
# File 'lib/melos/struct/structs.rb', line 1004

def wire_format
  @wire_format
end

Instance Method Details

#verify(suite, signer_public_key, group_context) ⇒ Object



1015
1016
1017
1018
1019
# File 'lib/melos/struct/structs.rb', line 1015

def verify(suite, signer_public_key, group_context)
  if wire_format == Melos::Constants::WireFormat::MLS_PUBLIC_MESSAGE
    public_message.verify(suite, signer_public_key, version, wire_format, group_context)
  end
end