Class: MTProto::TL::ResPq
- Inherits:
-
Object
- Object
- MTProto::TL::ResPq
- Extended by:
- Binary
- Defined in:
- lib/mtproto/tl/objects/res_pq.rb
Instance Attribute Summary collapse
-
#fingerprints ⇒ Object
readonly
Returns the value of attribute fingerprints.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#pq ⇒ Object
readonly
Returns the value of attribute pq.
-
#server_nonce ⇒ Object
readonly
Returns the value of attribute server_nonce.
Class Method Summary collapse
Methods included from Binary
Instance Attribute Details
#fingerprints ⇒ Object (readonly)
Returns the value of attribute fingerprints.
8 9 10 |
# File 'lib/mtproto/tl/objects/res_pq.rb', line 8 def fingerprints @fingerprints end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/res_pq.rb', line 8 def nonce @nonce end |
#pq ⇒ Object (readonly)
Returns the value of attribute pq.
8 9 10 |
# File 'lib/mtproto/tl/objects/res_pq.rb', line 8 def pq @pq end |
#server_nonce ⇒ Object (readonly)
Returns the value of attribute server_nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/res_pq.rb', line 8 def server_nonce @server_nonce end |
Class Method Details
.deserialize(message) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/mtproto/tl/objects/res_pq.rb', line 10 def self.deserialize() data = .body constructor = b_u32(data[0, 4]) raise "Unexpected constructor: 0x#{constructor.to_s(16)}" unless constructor == Constructors::RES_PQ offset = 4 nonce = data[offset, 16].pack('C*') offset += 16 server_nonce = data[offset, 16].pack('C*') offset += 16 pq_length_byte = data[offset] offset += 1 pq_length = if pq_length_byte == 254 b_u32(data[offset, 3] + [0]) & 0xffffff offset += 3 else pq_length_byte end pq = data[offset, pq_length].pack('C*') offset += pq_length offset += padding_length(pq_length + 1) vector_constructor = b_u32(data[offset, 4]) offset += 4 raise 'Expected vector constructor' unless vector_constructor == Constructors::VECTOR fingerprints_count = b_u32(data[offset, 4]) offset += 4 fingerprints = [] fingerprints_count.times do fingerprints << b_u64(data[offset, 8]) offset += 8 end new( nonce: nonce, server_nonce: server_nonce, pq: pq, fingerprints: fingerprints ) end |