expirable-token 0.0.2 → 0.0.3
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 +4 -4
- data/lib/expirable_token.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852137fa7d833654be65cf81ebc90aa6c86ddc39
|
4
|
+
data.tar.gz: a3e465813547d78e4be3f5c5c4c1a33b5c9b9b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc80556416ba04aecb4d0d7a0a8a1cdb7696099607079719e9144dd4e346196499b708c5f2fb61f75fa0b710ca8177ffeac8cd349cac8350d7d1f99bd28db186
|
7
|
+
data.tar.gz: dbdcd38e386e9c5103ffd2a1b98e6d8412166f882a985452101984bdebaa072fa2bd577ba270bb962dce1b8c7ba6b8628521996cd5418a5bcf6aa2c87948a24a
|
data/lib/expirable_token.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'time'
|
2
2
|
require 'json'
|
3
3
|
require 'base64'
|
4
|
+
require 'uri'
|
4
5
|
|
5
6
|
class ExpirableToken
|
6
7
|
|
@@ -26,7 +27,7 @@ class ExpirableToken
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def encode
|
29
|
-
Base64.encode64(
|
30
|
+
URI::encode(Base64.encode64(
|
30
31
|
JSON.generate(
|
31
32
|
{
|
32
33
|
0 => @id,
|
@@ -36,11 +37,11 @@ class ExpirableToken
|
|
36
37
|
4 => @expire_on
|
37
38
|
}
|
38
39
|
)
|
39
|
-
).chomp.chomp('=').chomp('=')
|
40
|
+
).chomp.chomp('=').chomp('='))
|
40
41
|
end
|
41
42
|
|
42
43
|
def decode(token)
|
43
|
-
a = JSON.parse(Base64.decode64(token+"==\n"))
|
44
|
+
a = JSON.parse(Base64.decode64(URI::decode(token)+"==\n"))
|
44
45
|
@id = a['0']
|
45
46
|
@extra = a['1']
|
46
47
|
@diff = a['2']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expirable-token
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseluis Laso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A generic class to convert simple information in a hard to understand
|
14
14
|
hash that can be used in a URL for instance
|