rack-session-encryptedcookie 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88da01a5a217498d7c85e09c54d4127b7c9fe670
4
- data.tar.gz: 8143a13110ad0028dbce5cbf0c94cc95f596f196
3
+ metadata.gz: 75afd9e596f1a7ab8caf49d3a3a690010b565d59
4
+ data.tar.gz: 5182c264b5d0de603858cc647ca1b7b75f16ea15
5
5
  SHA512:
6
- metadata.gz: 8057d5797182d3978bd46c514858b32ce8b9e209fcde3f9e2b2b278223786671f6a52ad624134eb97564f7f87b23e08e37f88cee5c74efa6334e2b841daa3793
7
- data.tar.gz: f4b7cd5a7d5921b3a84e79a1c8236d098192361303916c57c7189acade9fd3da643cd05c9675b8825e8c4c6b8666a397dc62e3fe4ab24d8a2891b194456b0cab
6
+ metadata.gz: 41e88e571e77d8e20f7de844af405c5c64acfd2a287c8a48783471bc02be858db75865d8b977fa8c23dd5857702d28ea777b106341998eb89211ea02b524484f
7
+ data.tar.gz: 7f3a25d3187c81b2f083df825c5c2c6c5e54d288c80eeb1d13a6be32fc9a64ac32b51f5ed509f75634743f9581e294c77bca7f432c2e492bd0a65132d90a3bee
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Rack::Session::EncryptedCookie - Encrypted session middleware for Rack
3
3
  #
4
- # Copyright (C) 2013 - 2017 Tim Hentenaar. All Rights Reserved.
4
+ # Copyright (C) 2013 - 2018 Tim Hentenaar. All Rights Reserved.
5
5
  #
6
6
  # Licensed under the Simplified BSD License.
7
7
  # See the LICENSE file for details.
@@ -17,28 +17,30 @@ module Session
17
17
  NOT_FOUND = [ 404, {}, [ 'Not found' ]].freeze
18
18
 
19
19
  # @param [Hash] opts Session options
20
- # @option opts [String] :cookie_name Cookie name
21
- # @option opts [String] :domain Domain for the cookie
22
- # @option opts [Boolean] :http_only HttpOnly for the cookie
23
- # @option opts [Integer] :expires Cookie expiry (in seconds)
24
- # @option opts [String] :cipher OpenSSL cipher to use
25
- # @option opts [String] :salt Salt for the IV
26
- # @optons opts [Integer] :rounds Number of salting rounds
27
- # @option opts [String] :key Encryption key for the data
28
- # @option opts [Integer] :tag_len Tag length (for GCM/CCM ciphers)
20
+ # @option opts [String] :cookie_name Cookie name
21
+ # @option opts [String] :domain Domain for the cookie
22
+ # @option opts [Boolean] :http_only HttpOnly for the cookie
23
+ # @option opts [Integer] :expires Cookie expiry (in seconds)
24
+ # @option opts [String] :cipher OpenSSL cipher to use
25
+ # @option opts [String] :salt Salt for the IV
26
+ # @optons opts [Integer] :rounds Number of salting rounds
27
+ # @option opts [String] :key Encryption key for the data
28
+ # @option opts [Integer] :tag_len Tag length (for GCM/CCM ciphers)
29
+ # @option opts [Boolean] :clear_cookies Clear response cookies
29
30
  def initialize(app, opts={})
30
31
  @app = app
31
32
  @hash = {}
32
33
  @opts = {
33
- cookie_name: 'rack.session',
34
- domain: nil,
35
- http_only: false,
36
- expires: (15 * 60),
37
- cipher: 'aes-256-cbc',
38
- salt: '3@bG>B@J5vy-FeXJ',
39
- rounds: 2000,
40
- key: 'r`*BqnG:c^;AL{k97=KYN!#',
41
- tag_len: 16
34
+ cookie_name: 'rack.session',
35
+ domain: nil,
36
+ http_only: false,
37
+ expires: (15 * 60),
38
+ cipher: 'aes-256-cbc',
39
+ salt: '3@bG>B@J5vy-FeXJ',
40
+ rounds: 2000,
41
+ key: 'r`*BqnG:c^;AL{k97=KYN!#',
42
+ tag_len: 16,
43
+ clear_cookies: false
42
44
  }.merge(opts)
43
45
  end
44
46
 
@@ -99,6 +101,7 @@ module Session
99
101
  c[:expires] = Time.at(Time.now + @opts[:expires])
100
102
  end
101
103
 
104
+ r[1]['Set-Cookie'] = nil if @opts[:clear_cookies]
102
105
  r[1]['Set-Cookie'] = Rack::Utils.add_cookie_to_header(
103
106
  r[1]['Set-Cookie'], @opts[:cookie_name], c
104
107
  ) unless data.nil?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-session-encryptedcookie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Hentenaar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-18 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,8 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
- description: |2
56
- Rack middleware that persists session data in an encrypted cookie
55
+ description: " Rack middleware that persists session data in an encrypted cookie\n"
57
56
  email: tim.hentenaar@gmail.com
58
57
  executables: []
59
58
  extensions: []