Class: MTProto::TL::AccountPassword
- Inherits:
-
Object
- Object
- MTProto::TL::AccountPassword
- Defined in:
- lib/mtproto/tl/objects/account_password.rb
Instance Attribute Summary collapse
-
#current_algo ⇒ Object
readonly
Returns the value of attribute current_algo.
-
#has_password ⇒ Object
readonly
Returns the value of attribute has_password.
-
#srp_b ⇒ Object
readonly
Returns the value of attribute srp_b.
-
#srp_id ⇒ Object
readonly
Returns the value of attribute srp_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(has_password:, current_algo: nil, srp_b: nil, srp_id: nil) ⇒ AccountPassword
constructor
A new instance of AccountPassword.
Constructor Details
#initialize(has_password:, current_algo: nil, srp_b: nil, srp_id: nil) ⇒ AccountPassword
Returns a new instance of AccountPassword.
8 9 10 11 12 13 |
# File 'lib/mtproto/tl/objects/account_password.rb', line 8 def initialize(has_password:, current_algo: nil, srp_b: nil, srp_id: nil) @has_password = has_password @current_algo = current_algo @srp_b = srp_b @srp_id = srp_id end |
Instance Attribute Details
#current_algo ⇒ Object (readonly)
Returns the value of attribute current_algo.
6 7 8 |
# File 'lib/mtproto/tl/objects/account_password.rb', line 6 def current_algo @current_algo end |
#has_password ⇒ Object (readonly)
Returns the value of attribute has_password.
6 7 8 |
# File 'lib/mtproto/tl/objects/account_password.rb', line 6 def has_password @has_password end |
#srp_b ⇒ Object (readonly)
Returns the value of attribute srp_b.
6 7 8 |
# File 'lib/mtproto/tl/objects/account_password.rb', line 6 def srp_b @srp_b end |
#srp_id ⇒ Object (readonly)
Returns the value of attribute srp_id.
6 7 8 |
# File 'lib/mtproto/tl/objects/account_password.rb', line 6 def srp_id @srp_id end |
Class Method Details
.deserialize(data) ⇒ Object
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 |
# File 'lib/mtproto/tl/objects/account_password.rb', line 15 def self.deserialize(data) constructor = data[0, 4].unpack1('L<') raise UnexpectedConstructorError, constructor unless constructor == Constructors::ACCOUNT_PASSWORD offset = 4 flags = data[offset, 4].unpack1('L<') offset += 4 has_password = flags.anybits?(1 << 2) return new(has_password: false) unless has_password algo_constructor = data[offset, 4].unpack1('L<') offset += 4 current_algo = nil if algo_constructor == Constructors::PASSWORD_KDF_ALGO_SHA256_MOD_POW salt1, offset = read_tl_bytes(data, offset) salt2, offset = read_tl_bytes(data, offset) g = data[offset, 4].unpack1('l<') offset += 4 p, offset = read_tl_bytes(data, offset) current_algo = { salt1: salt1, salt2: salt2, g: g, p: p } end srp_b, offset = read_tl_bytes(data, offset) srp_id = data[offset, 8].unpack1('Q<') new(has_password: true, current_algo: current_algo, srp_b: srp_b, srp_id: srp_id) end |