From c3fdb32a13c0028536109c17fb6f75db8708a43f Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 6 Feb 2013 16:05:59 +0100 Subject: changed SRP:Client so it can be used to wrap a user record on the server --- lib/srp/client.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/srp/client.rb') diff --git a/lib/srp/client.rb b/lib/srp/client.rb index 3882f1d..ebe158f 100644 --- a/lib/srp/client.rb +++ b/lib/srp/client.rb @@ -5,11 +5,16 @@ module SRP attr_reader :salt, :verifier, :username - def initialize(username, password, salt = nil) + def initialize(username, options) @username = username - @password = password - @salt = salt || bigrand(4).hex - calculate_verifier + if options[:password] + @password = options[:password] + @salt = options[:salt] || bigrand(4).hex + calculate_verifier + else + @verifier = options[:verifier] + @salt = options[:salt] + end end def authenticate(server) -- cgit v1.2.3