summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/srp/client.rb13
-rw-r--r--lib/srp/user.rb19
2 files changed, 28 insertions, 4 deletions
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)
diff --git a/lib/srp/user.rb b/lib/srp/user.rb
new file mode 100644
index 0000000..1330de7
--- /dev/null
+++ b/lib/srp/user.rb
@@ -0,0 +1,19 @@
+#
+# SRP User on the server.
+#
+# This will be used in the session instead of the real user record so the
+# session does not get cluttered with the whole user record.
+#
+module SRP
+ class User
+
+ attr_reader :username, :salt, :verifier
+
+ def initialize(user)
+ @username = user.username
+ @salt = user.salt
+ @verifier = user.verifier
+ end
+
+ end
+end