summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2013-02-25 15:33:48 +0100
committerAzul <azul@riseup.net>2013-02-25 15:35:12 +0100
commit80958380cbb7a492d0ef7586714f2cfe8885603b (patch)
tree7ebb04410dd8daa0cd11cc65cdf68410ba44ee1a
parent9ca93d71df0eac0983947766646a1abbab49e824 (diff)
version 0.1.6 - added SRP::Session#to_hash
-rw-r--r--lib/srp/session.rb12
-rw-r--r--ruby-srp.gemspec2
-rw-r--r--test/session_test.rb1
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/srp/session.rb b/lib/srp/session.rb
index f4b7430..38c9722 100644
--- a/lib/srp/session.rb
+++ b/lib/srp/session.rb
@@ -30,17 +30,21 @@ module SRP
end
end
- def to_json(options={})
+ def to_hash
if @m2
- { :M2 => @m2.to_s(16) }.to_json(options)
+ { :M2 => @m2.to_s(16) }
else
{ :B => bb.to_s(16),
-# :b => @b.to_s(16), # only use for debugging
+# :b => @b.to_s(16), # only use for debugging
:salt => @user.salt.to_s(16)
- }.to_json(options)
+ }
end
end
+ def to_json(options={})
+ to_hash.to_json(options)
+ end
+
protected
diff --git a/ruby-srp.gemspec b/ruby-srp.gemspec
index 64d2a68..1c7e333 100644
--- a/ruby-srp.gemspec
+++ b/ruby-srp.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "ruby-srp"
- s.version = "0.1.5"
+ s.version = "0.1.6"
s.platform = Gem::Platform::RUBY
s.authors = ["Azul"]
s.email = ["azul@leap.se"]
diff --git a/test/session_test.rb b/test/session_test.rb
index a6e72a0..df117dc 100644
--- a/test/session_test.rb
+++ b/test/session_test.rb
@@ -26,6 +26,7 @@ class SessionTest < Test::Unit::TestCase
assert_equal bb.to_s(16), session.bb.to_s(16)
assert_equal self, session.authenticate(m)
assert_equal({'M2' => m2.to_s(16)}.to_json, session.to_json)
+ assert_equal({:M2 => m2.to_s(16)}, session.to_hash)
end
def test_zero_padded_salt