jot-helpers 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/Rakefile +5 -1
- data/lib/jot/configuration.rb +5 -2
- data/lib/jot/version.rb +1 -1
- data/lib/jot.rb +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a587295210595b3561634de5170dc2dc7ce37a47ea1ce61db7ebcede1a7dbad9
|
4
|
+
data.tar.gz: fc9c02f97af24c90ae7150d5f7f1ad945f79a85416220e30d8ec0bb86577529f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca5d28c55edc69017aafddb218b5ccea2287b17a37a7739c07db15f60c98e70fa101a58e71df34168baebaf222d81228a4df8f6a6f79617441b2fd0c4e68c719
|
7
|
+
data.tar.gz: 2acc4fd85f00662e3cf14c6198ec968d1cfd877d4a16b395edd0d75c6c16e6bbc3f3c66866b7f664ce0ff90d753d4b244a20acec06b13f0ea189d4d4d9b416f9
|
data/README.md
CHANGED
@@ -13,6 +13,12 @@ Jot.configure do |config|
|
|
13
13
|
end
|
14
14
|
```
|
15
15
|
|
16
|
+
You may wish to also specify the expiration time for tokens as well. The default is 1 hour, but it can be overridden:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
config.expiration_time_in_seconds = 1500 # 25 minutes
|
20
|
+
```
|
21
|
+
|
16
22
|
## Usage
|
17
23
|
|
18
24
|
Encode a payload:
|
data/Rakefile
CHANGED
data/lib/jot/configuration.rb
CHANGED
data/lib/jot/version.rb
CHANGED
data/lib/jot.rb
CHANGED
@@ -16,7 +16,8 @@ class Jot
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.encode(payload)
|
19
|
-
|
19
|
+
exp = payload[:exp] || Time.now + config.expiration_time_in_seconds
|
20
|
+
JWT.encode(payload.merge(exp: exp.to_i), config.secret, config.algorithm)
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.decode(payload, verify: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jot-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: timecop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Provides helper methods for working with JSON Web Tokens (JWTs)
|
42
56
|
email:
|
43
57
|
- me@ryanbigg.com
|