Class: Dropzone::Communication

Inherits:
MessageBase show all
Defined in:
lib/dropzone/communication.rb

Defined Under Namespace

Classes: NoSymmKey, Validator

Constant Summary

Constants inherited from MessageBase

MessageBase::DEFAULT_TIP

Instance Attribute Summary collapse

Attributes inherited from MessageBase

#block_height, #message_type, #receiver_addr, #sender_addr, #txid

Instance Method Summary collapse

Methods inherited from MessageBase

attr_message, attr_message_int, attr_message_pkey, #data_to_hash, #data_to_hex, find, #initialize, is_attr_int?, is_attr_pkey?, message_attribs, message_type, new_message_from, #save!, #to_transaction, types_include?

Methods inherited from RecordBase

#blockchain, #errors, #valid?

Constructor Details

This class inherits a constructor from Dropzone::MessageBase

Instance Attribute Details

#symm_keyObject

Returns the value of attribute symm_key.



9
10
11
# File 'lib/dropzone/communication.rb', line 9

def symm_key
  @symm_key
end

Instance Method Details

#contents_plainObject

Raises:



11
12
13
14
15
16
17
18
19
20
# File 'lib/dropzone/communication.rb', line 11

def contents_plain
  raise NoSymmKey unless symm_key

  aes = OpenSSL::Cipher::Cipher.new Session::CIPHER_ALGORITHM
  aes.decrypt
  aes.key = symm_key
  aes.iv = iv

  aes.update(contents) + aes.final
end

#is_auth?Boolean

Returns:

  • (Boolean)


23
# File 'lib/dropzone/communication.rb', line 23

def is_auth?; !session_pkey.nil?; end

#is_init?Boolean

Returns:

  • (Boolean)


22
# File 'lib/dropzone/communication.rb', line 22

def is_init?; (der && session_pkey); end