snuffleupagus 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5c80cc86ec5c07d58eb1fa6287556951aece8f295df96637b68158ccd2f45c4
4
- data.tar.gz: 73727b009732dd19becd8b9de8445e1479d3e41613256965d18c468bf3d11328
3
+ metadata.gz: 78ba5652942ab4bb945ced5e32696f91a5ca32133294f255ed22e6dc7c7ba5a5
4
+ data.tar.gz: f583416e9b741ee77d84de3f0cdcf0f5df5c71648b3156ee5f2bb0531b77426c
5
5
  SHA512:
6
- metadata.gz: e415b78f8922d193d697206295901e9e17324c480c29451ebd4c5f9b891ab368bda214c4dd3be01cf3c2fe2226cdcad2506f6859f13f6a85f77b4ebf865e5098
7
- data.tar.gz: c78c98c4e9e3f35dec5226e633ea305ee630ab2bb46a3ca237bec82f8ae056cb345c11628aa65010ab73a9a715747962213b6a6453e523e741cb1d8a1c3a4ab0
6
+ metadata.gz: 25c0f294acc08273c4fc62cb203c73fdb539df5d888649a0af985e8d08042b61d755dcf63a31f27b987f85f5fd3cd42ada3e013c366e3f3da008e020a19c284d
7
+ data.tar.gz: 9f01b85aa3dc12dbd4b309773df728386a88dd19649a638b7b5ecbbe7049a6e16dc2970cd7cc2a0ef47030e0b754ddde29dd5d5f1236d2416c42ef2548632add
@@ -3,6 +3,10 @@
3
3
  ## Unreleased
4
4
  - none
5
5
 
6
+ ## [0.1.1](releases/tag/v0.1.1) - 2020-10-21
7
+ ### Updated
8
+ - Use named parameters when creating and validating tokens
9
+
6
10
  ## [0.1.1](releases/tag/v0.1.1) - 2020-10-21
7
11
  ### Added
8
12
  - Add context to the create/check token to avoid replay in different contexts
@@ -27,11 +27,11 @@ module Snuffleupagus
27
27
  @cipher = OpenSSL::Cipher.new('aes-256-cbc')
28
28
  end
29
29
 
30
- def create_token(context)
30
+ def create_token(context:)
31
31
  encode encrypt "#{CONSTANT}#{context}#{Time.now.to_i}"
32
32
  end
33
33
 
34
- def token_valid?(token, context)
34
+ def token_valid?(token:, context:)
35
35
  return false unless token.is_a? String
36
36
 
37
37
  decoded = decrypt decode token
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snuffleupagus
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -7,7 +7,7 @@ describe Snuffleupagus::AuthToken do
7
7
  let(:snuffy) { Snuffleupagus::AuthToken.new('sup3r4w3s0m3p4ssw0rd') }
8
8
 
9
9
  describe '#create_token' do
10
- subject { snuffy.create_token 'my-context' }
10
+ subject { snuffy.create_token context: 'my-context' }
11
11
 
12
12
  it { is_expected.to be_a String }
13
13
  it { expect(subject.length).to eq 96 }
@@ -15,16 +15,16 @@ describe Snuffleupagus::AuthToken do
15
15
  end
16
16
 
17
17
  describe '#token_valid?' do
18
- subject { snuffy.token_valid?(token, 'my-context') }
18
+ subject { snuffy.token_valid?(token: token, context: 'my-context') }
19
19
 
20
20
  context 'with a valid token' do
21
- let(:token) { snuffy.create_token 'my-context' }
21
+ let(:token) { snuffy.create_token context: 'my-context' }
22
22
 
23
23
  it { is_expected.to be_truthy }
24
24
  end
25
25
 
26
26
  context 'when the context doesnt match' do
27
- let(:token) { snuffy.create_token 'another-context' }
27
+ let(:token) { snuffy.create_token context: 'another-context' }
28
28
 
29
29
  it { is_expected.to be_falsey }
30
30
  end
@@ -48,7 +48,7 @@ describe Snuffleupagus::AuthToken do
48
48
  end
49
49
 
50
50
  context 'testing expired tokens' do
51
- let(:token) { snuffy.create_token 'my-context' }
51
+ let(:token) { snuffy.create_token context: 'my-context' }
52
52
 
53
53
  before { token } # pre-load the token
54
54
  after { Timecop.return }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snuffleupagus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
@@ -116,5 +116,5 @@ requirements: []
116
116
  rubygems_version: 3.0.6
117
117
  signing_key:
118
118
  specification_version: 4
119
- summary: snuffleupagus-0.1.1
119
+ summary: snuffleupagus-0.1.2
120
120
  test_files: []