paseto 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/paseto.rb +8 -0
- data/lib/paseto/local.rb +8 -0
- data/lib/paseto/public.rb +18 -2
- data/lib/paseto/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9871b9412181a110762916bec00e960682ed826f3c9627facddb1c1f236b4eba
|
4
|
+
data.tar.gz: 702b96ec10333a3f45d203d0aecc9330790292d1ddc03407bbd80447e1ad345e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c0fb8a1393f2065ecedfb76fb752cd2d0cc1fbe542dc45ef3812da37a7fafe60a237c13b42f666c9028bf46e729859ee6c2f524b54e9ab57c5ade277474403
|
7
|
+
data.tar.gz: 2f7bb535cedf9a058815a6550cb6e01897431f95466271e124faacb89611eb6ecf7d9e6ec5988adf8a5a2a6fd7ae2c7573994a71fdcd129927f07b67a08d63d7
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@
|
|
7
7
|
- Rubocop is the law :oncoming_police_car:
|
8
8
|
- Update rake to fix vulnerability CVE-2020-8130
|
9
9
|
|
10
|
+
#### 0.4.1 (Mar 13, 2020)
|
11
|
+
|
12
|
+
- Add hex encoding support [<a href="https://github.com/mguymon/paseto.rb/pull/11">Pull #10</a> by <a href="https://github.com/shaicoleman">shaicoleman</a>]
|
13
|
+
|
10
14
|
### 0.3 (Dec 4, 2018)
|
11
15
|
|
12
16
|
- Use rbnacl instead of rbnacl-libsodium [<a href="https://github.com/mguymon/paseto.rb/pull/6">Pull #3</a> by <a href="https://github.com/smaximov">smaximov</a>]
|
data/lib/paseto.rb
CHANGED
data/lib/paseto/local.rb
CHANGED
@@ -19,6 +19,10 @@ module Paseto
|
|
19
19
|
new(Paseto.decode64(encoded_key))
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.decode_hex(encoded_key)
|
23
|
+
new(Paseto.decode_hex(encoded_key))
|
24
|
+
end
|
25
|
+
|
22
26
|
def initialize(key)
|
23
27
|
@key = key
|
24
28
|
@aead = RbNaCl::AEAD::XChaCha20Poly1305IETF.new(key)
|
@@ -28,6 +32,10 @@ module Paseto
|
|
28
32
|
Paseto.encode64(@key)
|
29
33
|
end
|
30
34
|
|
35
|
+
def encode_hex
|
36
|
+
Paseto.encode_hex(@key)
|
37
|
+
end
|
38
|
+
|
31
39
|
def encrypt(message, footer = EMPTY_FOOTER)
|
32
40
|
# Make a nonce: A single-use value never repeated under the same key
|
33
41
|
nonce = generate_nonce(message)
|
data/lib/paseto/public.rb
CHANGED
@@ -17,18 +17,22 @@ module Paseto
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
# secret-key used for signing and
|
20
|
+
# secret-key used for signing and verifying
|
21
21
|
class SecretKey
|
22
22
|
include Encoder
|
23
23
|
|
24
24
|
def self.generate
|
25
|
-
new(RbNaCl::SigningKey.generate)
|
25
|
+
new(RbNaCl::SigningKey.generate.to_bytes)
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.decode64(encoded_key)
|
29
29
|
new(Paseto.decode64(encoded_key))
|
30
30
|
end
|
31
31
|
|
32
|
+
def self.decode_hex(encoded_key)
|
33
|
+
new(Paseto.decode_hex(encoded_key))
|
34
|
+
end
|
35
|
+
|
32
36
|
def initialize(key)
|
33
37
|
@key = key
|
34
38
|
@nacl = RbNaCl::SigningKey.new(key)
|
@@ -53,6 +57,10 @@ module Paseto
|
|
53
57
|
def encode64
|
54
58
|
Paseto.encode64(@key)
|
55
59
|
end
|
60
|
+
|
61
|
+
def encode_hex
|
62
|
+
Paseto.encode_hex(@key)
|
63
|
+
end
|
56
64
|
end
|
57
65
|
|
58
66
|
# public-key used for signing and verifing
|
@@ -63,6 +71,10 @@ module Paseto
|
|
63
71
|
new(Paseto.decode64(encoded_key))
|
64
72
|
end
|
65
73
|
|
74
|
+
def self.decode_hex(encoded_key)
|
75
|
+
new(Paseto.decode_hex(encoded_key))
|
76
|
+
end
|
77
|
+
|
66
78
|
def initialize(key)
|
67
79
|
@key = key
|
68
80
|
@nacl = RbNaCl::VerifyKey.new(key)
|
@@ -72,6 +84,10 @@ module Paseto
|
|
72
84
|
Paseto.encode64(@key)
|
73
85
|
end
|
74
86
|
|
87
|
+
def encode_hex
|
88
|
+
Paseto.encode_hex(@key)
|
89
|
+
end
|
90
|
+
|
75
91
|
def verify(token, footer = nil)
|
76
92
|
footer ||= token.footer if token.is_a? Paseto::Token
|
77
93
|
footer ||= EMPTY_FOOTER
|
data/lib/paseto/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paseto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Guymon
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-03-
|
12
|
+
date: 2020-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rbnacl
|