selfsdk 0.0.126 → 0.0.127
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/jwt_service.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d9d4b995fb2ea36f3e01c5910bf15755797c1afb3ba13c2ab58c8c89ff73e3a
|
4
|
+
data.tar.gz: 1c22b973f561e4c47f5883d91a15409989fa34b192712a7195f391a6d7854b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ae863e903d8ee9f59c74473a44e7f9312f76d2f5a54e14b8959f3ff6e5b36593c5f04eaf0b6718a5868f91ab8e8f3cda6edaaeb3a46787f761362bedcb3691a
|
7
|
+
data.tar.gz: 71fbc1f03e5c7df88bee3d991b3d7fb8ba37797fea605c60af83a9168be89f7aa76df42b9b2680a0082054fe5bd5f0c0cfaf24ca3427a5423d4961147deaff0b
|
data/lib/jwt_service.rb
CHANGED
@@ -5,7 +5,7 @@ require 'json'
|
|
5
5
|
|
6
6
|
module SelfSDK
|
7
7
|
class JwtService
|
8
|
-
attr_reader :id, :key
|
8
|
+
attr_reader :id, :key, :key_id
|
9
9
|
|
10
10
|
# Jwt initializer
|
11
11
|
#
|
@@ -13,7 +13,14 @@ module SelfSDK
|
|
13
13
|
# @param app_key [string] the app api key provided by developer portal.
|
14
14
|
def initialize(app_id, app_key)
|
15
15
|
@id = app_id
|
16
|
-
|
16
|
+
parts = app_key.split(':')
|
17
|
+
if parts.length > 1
|
18
|
+
@key_id = parts[0]
|
19
|
+
@key = parts[1]
|
20
|
+
else
|
21
|
+
@key_id = "1"
|
22
|
+
@key = app_key
|
23
|
+
end
|
17
24
|
end
|
18
25
|
|
19
26
|
# Prepares a jwt object based on an input
|
@@ -85,7 +92,7 @@ module SelfSDK
|
|
85
92
|
private
|
86
93
|
|
87
94
|
def header
|
88
|
-
encode({ alg: "EdDSA", typ: "JWT" }.to_json)
|
95
|
+
encode({ alg: "EdDSA", typ: "JWT", kid: "#{@key_id}" }.to_json)
|
89
96
|
end
|
90
97
|
end
|
91
98
|
end
|