Class: Rack::Session::EncryptedCookie
- Inherits:
-
Cookie
- Object
- Cookie
- Rack::Session::EncryptedCookie
- Defined in:
- lib/rack/session/encrypted_cookie.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ EncryptedCookie
constructor
A new instance of EncryptedCookie.
Constructor Details
#initialize(app, options = {}) ⇒ EncryptedCookie
Returns a new instance of EncryptedCookie.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rack/session/encrypted_cookie.rb', line 9 def initialize(app, = {}) super @salt = .fetch(:salt, 'encrypted cookie') @signed_salt = .fetch(:signed_salt, 'signed encrypted cookie') @iterations = .fetch(:iterations, 1024) @key_size = .fetch(:key_size, 64) @cipher = OpenSSL::Cipher::Cipher.new(.fetch(:cipher, 'AES-256-CBC')) @cipher_secrets = @secrets.map { |secret| generate_key(secret, @salt) } @secrets.map! { |secret| generate_key(secret, @signed_salt) } end |