Class: MTProto::TL::ReqDHParams
- Inherits:
-
Object
- Object
- MTProto::TL::ReqDHParams
- Includes:
- Binary
- Defined in:
- lib/mtproto/tl/objects/req_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.
-
#p ⇒ Object
readonly
Returns the value of attribute p.
-
#public_key_fingerprint ⇒ Object
readonly
Returns the value of attribute public_key_fingerprint.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
-
#server_nonce ⇒ Object
readonly
Returns the value of attribute server_nonce.
Instance Method Summary collapse
-
#initialize(nonce:, server_nonce:, p:, q:, public_key_fingerprint:, encrypted_data:) ⇒ ReqDHParams
constructor
A new instance of ReqDHParams.
- #serialize ⇒ Object
Methods included from Binary
#b_u32, #b_u64, #u32_b, #u64_b
Constructor Details
#initialize(nonce:, server_nonce:, p:, q:, public_key_fingerprint:, encrypted_data:) ⇒ ReqDHParams
Returns a new instance of ReqDHParams.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mtproto/tl/objects/req_dh_params.rb', line 10 def initialize(nonce:, server_nonce:, p:, q:, public_key_fingerprint:, 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 @p = p @q = q @public_key_fingerprint = public_key_fingerprint @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/req_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/req_dh_params.rb', line 8 def nonce @nonce end |
#p ⇒ Object (readonly)
Returns the value of attribute p.
8 9 10 |
# File 'lib/mtproto/tl/objects/req_dh_params.rb', line 8 def p @p end |
#public_key_fingerprint ⇒ Object (readonly)
Returns the value of attribute public_key_fingerprint.
8 9 10 |
# File 'lib/mtproto/tl/objects/req_dh_params.rb', line 8 def public_key_fingerprint @public_key_fingerprint end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
8 9 10 |
# File 'lib/mtproto/tl/objects/req_dh_params.rb', line 8 def q @q end |
#server_nonce ⇒ Object (readonly)
Returns the value of attribute server_nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/req_dh_params.rb', line 8 def server_nonce @server_nonce end |
Instance Method Details
#serialize ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mtproto/tl/objects/req_dh_params.rb', line 22 def serialize result = u32_b(Constructors::REQ_DH_PARAMS) result += @nonce.bytes result += @server_nonce.bytes result += serialize_tl_bytes(integer_to_bytes(@p)) result += serialize_tl_bytes(integer_to_bytes(@q)) result += u64_b(@public_key_fingerprint) result += serialize_tl_bytes(@encrypted_data.bytes) result end |