Class: MTProto::TL::SetClientDHParams
- Inherits:
-
Object
- Object
- MTProto::TL::SetClientDHParams
- Includes:
- Binary
- Defined in:
- lib/mtproto/tl/objects/set_client_dh_params.rb
Instance Attribute Summary collapse
-
#encrypted_data ⇒ Object
readonly
Returns the value of attribute encrypted_data.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#server_nonce ⇒ Object
readonly
Returns the value of attribute server_nonce.
Instance Method Summary collapse
-
#initialize(nonce:, server_nonce:, encrypted_data:) ⇒ SetClientDHParams
constructor
A new instance of SetClientDHParams.
- #serialize ⇒ Object
Methods included from Binary
#b_u32, #b_u64, #u32_b, #u64_b
Constructor Details
#initialize(nonce:, server_nonce:, encrypted_data:) ⇒ SetClientDHParams
Returns a new instance of SetClientDHParams.
10 11 12 13 14 15 16 17 |
# File 'lib/mtproto/tl/objects/set_client_dh_params.rb', line 10 def initialize(nonce:, server_nonce:, encrypted_data:) raise ArgumentError, 'Nonce must be 16 bytes' unless nonce.bytesize == 16 raise ArgumentError, 'Server nonce must be 16 bytes' unless server_nonce.bytesize == 16 @nonce = nonce @server_nonce = server_nonce @encrypted_data = encrypted_data end |
Instance Attribute Details
#encrypted_data ⇒ Object (readonly)
Returns the value of attribute encrypted_data.
8 9 10 |
# File 'lib/mtproto/tl/objects/set_client_dh_params.rb', line 8 def encrypted_data @encrypted_data end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/set_client_dh_params.rb', line 8 def nonce @nonce end |
#server_nonce ⇒ Object (readonly)
Returns the value of attribute server_nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/set_client_dh_params.rb', line 8 def server_nonce @server_nonce end |
Instance Method Details
#serialize ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/mtproto/tl/objects/set_client_dh_params.rb', line 19 def serialize result = u32_b(Constructors::SET_CLIENT_DH_PARAMS) result += @nonce.bytes result += @server_nonce.bytes result += serialize_tl_bytes(@encrypted_data.bytes) result end |