diff options
author | Azul <azul@leap.se> | 2012-08-06 12:34:47 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-08-06 12:41:06 +0200 |
commit | 552574bfb0a0160935452b605bb262b5b52c4f67 (patch) | |
tree | 71ec6bba217db018f20a4270eacdcdb02c7a8dbe /lib | |
parent | 8d489f7c431cf24c84ac5fc23be1b9b3531b402b (diff) |
added authenticate! which raises SRP::WrongPassword if it fails, version 0.0.2
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ruby-srp.rb (renamed from lib/srp.rb) | 2 | ||||
-rw-r--r-- | lib/srp/authentication.rb | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/srp.rb b/lib/ruby-srp.rb index a008b82..7cbe06f 100644 --- a/lib/srp.rb +++ b/lib/ruby-srp.rb @@ -10,4 +10,6 @@ $:.unshift File.dirname(__FILE__) module SRP autoload :Client, 'srp/client' autoload :Authentication, 'srp/authentication' + class WrongPassword < StandardError + end end diff --git a/lib/srp/authentication.rb b/lib/srp/authentication.rb index a2431d0..4afe20b 100644 --- a/lib/srp/authentication.rb +++ b/lib/srp/authentication.rb @@ -41,6 +41,10 @@ module SRP return Session.new(aa, verifier) end + def authenticate!(m, session) + authenticate(m, session) || raise(SRP::WrongPassword) + end + def authenticate(m, session) if(m == session.m1(verifier)) return session.m2(m, verifier) |