tinytokenauth-rails 0.1.5 → 0.1.6

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
  SHA256:
3
- metadata.gz: 82d81a75b0bbc6caea554a6bfc8ada102b75d61eb033d69566ab30069a50f01a
4
- data.tar.gz: 06c397f8ce6c8d65b4eb1b36096d021f18c8f78f8b7ffa344e497de1924287af
3
+ metadata.gz: a51cd8dbe7faddbd28aa43eab713a841bb3ea8b629d4753c949e522e09627048
4
+ data.tar.gz: 35168279b0cb122da90c5a56502adb804e15f3f05b5bfe96a2a238dd7179ca53
5
5
  SHA512:
6
- metadata.gz: 4e157d5631eeafcaa5f5155879cfe4c6ea6873b173f17fdd225b07b9d57c3a602824722976f523577da36e875652bbf5d966f72f0034c32c9cdaf3a74fb4b4f7
7
- data.tar.gz: bf36b14bdb08c99bbbb6d159fb4a4825f13d5060cc0cb15a47be1cda8fe7f1fc437906b87480590935e84441c2f73e70bec0b9a92f8b55ce0604a43e6dff0890
6
+ metadata.gz: '08f62d165b73b1b0e0e9517643b143e708e40600dfdf7bdbbbb1fe4cb6daa02d53c808bac82c5feaef1d3d8a71831ffbbac55f9c08ef0ba80f9e6a6161ae29b2'
7
+ data.tar.gz: 5cb15b86e8d527860b646155a49f7dc318346f6d96a3a91876c53e6fdf5b9d18b8275661e96aceef537cc01943b868e6837089f325351efd4446fa760cd8212a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tinytokenauth-rails (0.1.4)
4
+ tinytokenauth-rails (0.1.6)
5
5
  jwt (~> 2.7)
6
6
  rails (>= 6.0)
7
7
 
@@ -0,0 +1,22 @@
1
+ require 'jwt'
2
+
3
+ module Tinytokenauth
4
+ class JsonWebToken
5
+ # def self.encode(payload, exp = 24.hours.from_now, secret = Rails.application.credentials.secret_key_base)
6
+ def self.encode(payload, options = {})
7
+ exp = options[:exp]
8
+ secret = options[:secret]
9
+ puts exp
10
+ puts exp.to_i
11
+ puts payload
12
+ payload[:exp] = exp.to_i
13
+ JWT.encode(payload, secret)
14
+ end
15
+
16
+ def self.decode(token, options = {})
17
+ secret = options[:secret]
18
+ decoded = JWT.decode(token, secret)[0]
19
+ HashWithIndifferentAccess.new decoded
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tinytokenauth
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinytokenauth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kim Laplume
@@ -56,6 +56,7 @@ files:
56
56
  - lib/tinytokenauth.rb
57
57
  - lib/tinytokenauth/authorizable.rb
58
58
  - lib/tinytokenauth/configuration.rb
59
+ - lib/tinytokenauth/json_web_token.rb
59
60
  - lib/tinytokenauth/railtie.rb
60
61
  - lib/tinytokenauth/version.rb
61
62
  - lib/tinytokenauth/view_helpers.rb