Class: SRP::Client
Constant Summary
Constants included from Util
Util::BIG_PRIME_N, Util::GENERATOR, Util::PRIME_N
Instance Attribute Summary collapse
-
#salt ⇒ Object
readonly
Returns the value of attribute salt.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#verifier ⇒ Object
readonly
Returns the value of attribute verifier.
Instance Method Summary collapse
- #authenticate(server) ⇒ Object
-
#initialize(username, options) ⇒ Client
constructor
A new instance of Client.
- #private_key ⇒ Object
Methods included from Util
#bigrand, #hn_xor_hg, #modpow, #multiplier, #sha256_hex, #sha256_int, #sha256_str
Constructor Details
#initialize(username, options) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/srp/client.rb', line 8 def initialize(username, ) @username = username if [:password] @password = [:password] @salt = [:salt] || bigrand(4).hex calculate_verifier else @verifier = [:verifier] @salt = [:salt] end end |
Instance Attribute Details
#salt ⇒ Object (readonly)
Returns the value of attribute salt.
6 7 8 |
# File 'lib/srp/client.rb', line 6 def salt @salt end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/srp/client.rb', line 6 def username @username end |
#verifier ⇒ Object (readonly)
Returns the value of attribute verifier.
6 7 8 |
# File 'lib/srp/client.rb', line 6 def verifier @verifier end |
Instance Method Details
#authenticate(server) ⇒ Object
20 21 22 23 24 |
# File 'lib/srp/client.rb', line 20 def authenticate(server) @session = SRP::Session.new(self) @session.handshake(server) @session.validate(server) end |
#private_key ⇒ Object
26 27 28 |
# File 'lib/srp/client.rb', line 26 def private_key @private_key ||= calculate_private_key end |