Class: Rack::Session::CookieStore::Signer
- Inherits:
-
Object
- Object
- Rack::Session::CookieStore::Signer
- Defined in:
- lib/rack/session/cookie_store.rb
Instance Method Summary collapse
Instance Method Details
#sign(data, secret) ⇒ Object
11 12 13 |
# File 'lib/rack/session/cookie_store.rb', line 11 def sign(data, secret) "s:#{data}.#{digest(data, secret)}" end |
#unsign(data, secret) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rack/session/cookie_store.rb', line 15 def unsign(data, secret) return nil unless data && data[0..1] == 's:' str = data[2..-1] str = str[0...str.rindex('.')] return nil unless sign(str, secret) == data str end |