nexmo-jwt 0.1.0 → 0.1.1
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/README.md +2 -2
- data/lib/nexmo-jwt/jwt.rb +1 -1
- data/lib/nexmo-jwt/jwt_builder.rb +9 -1
- data/lib/nexmo-jwt/version.rb +1 -1
- data/nexmo-jwt.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c834d7bc1f7ab9d28961cd0527c7201cbf3cf798fd53ed8cf128a9786ea8cdde
|
4
|
+
data.tar.gz: cbf42defdddb80441ef33b3649c4822a9c2f89d2e2fdf34063a8d8978586e9b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31fdcd5160ba78ad55eb8db15cf5d42defca71b57db8e5d69738638bce6539f4dad122a5371e5372da385f548da6e5eda290c82a51406d187bbdb5c476f0495c
|
7
|
+
data.tar.gz: d131d09509e39d43b40fa897b2327e2d9c52dd800277372f06c20653a88c86394be7ee51f280efb1447adf2b2d2d0b72a4fa0acab2c91b5ed3a40af68880ef81
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Nexmo JWT Generator for Ruby
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/nexmo-jwt)
|
3
|
+
[](https://badge.fury.io/rb/nexmo-jwt)[](CODE_OF_CONDUCT.md)
|
4
4
|
|
5
5
|
<img src="https://developer.nexmo.com/assets/images/Vonage_Nexmo.svg" height="48px" alt="Nexmo is now known as Vonage" />
|
6
6
|
|
@@ -77,4 +77,4 @@ Nexmo API reference: https://developer.nexmo.com/api
|
|
77
77
|
This library is released under the [MIT License][license]
|
78
78
|
|
79
79
|
[signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=ruby-client-library
|
80
|
-
[license]: LICENSE.txt
|
80
|
+
[license]: LICENSE.txt
|
data/lib/nexmo-jwt/jwt.rb
CHANGED
@@ -42,12 +42,14 @@ module Nexmo
|
|
42
42
|
attr_accessor :application_id, :private_key, :jti, :nbf, :ttl, :exp, :alg, :paths, :subject, :jwt
|
43
43
|
|
44
44
|
def initialize(params = {})
|
45
|
+
Nexmo::JWTBuilder.validate_parameters_not_conflicting(params)
|
46
|
+
|
45
47
|
@application_id = set_application_id(params.fetch(:application_id))
|
46
48
|
@private_key = set_private_key(params.fetch(:private_key))
|
47
49
|
@jti = params.fetch(:jti, SecureRandom.uuid)
|
48
50
|
@nbf = params.fetch(:nbf, nil)
|
49
51
|
@ttl = params.fetch(:ttl, 900)
|
50
|
-
@exp = params.fetch(:exp,
|
52
|
+
@exp = params.fetch(:exp, nil)
|
51
53
|
@alg = params.fetch(:alg, 'RS256')
|
52
54
|
@paths = params.fetch(:paths, nil)
|
53
55
|
@subject = params.fetch(:subject, 'Subject')
|
@@ -56,6 +58,12 @@ module Nexmo
|
|
56
58
|
after_initialize!(self)
|
57
59
|
end
|
58
60
|
|
61
|
+
def self.validate_parameters_not_conflicting(params)
|
62
|
+
if params[:ttl] && params[:exp]
|
63
|
+
raise ArgumentError, "Expected either 'ttl' or 'exp' parameter, preference is to set 'ttl' parameter"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
59
67
|
def after_initialize!(builder)
|
60
68
|
validate_not_before(builder.nbf) if builder.nbf
|
61
69
|
validate_time_to_live(builder.ttl)
|
data/lib/nexmo-jwt/version.rb
CHANGED
data/nexmo-jwt.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
'source_code_uri' => 'https://github.com/Nexmo/nexmo-jwt-ruby',
|
20
20
|
'bug_tracker_uri' => 'https://github.com/Nexmo/nexmo-jwt-ruby/issues',
|
21
21
|
'changelog_uri' => 'https://github.com/Nexmo/nexmo-jwt-ruby/blob/master/CHANGES.md',
|
22
|
-
'documentation_uri' => 'https://
|
22
|
+
'documentation_uri' => 'https://rubydoc.info/github/Nexmo/nexmo-jwt-ruby'
|
23
23
|
}
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexmo-jwt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nexmo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -46,7 +46,7 @@ metadata:
|
|
46
46
|
source_code_uri: https://github.com/Nexmo/nexmo-jwt-ruby
|
47
47
|
bug_tracker_uri: https://github.com/Nexmo/nexmo-jwt-ruby/issues
|
48
48
|
changelog_uri: https://github.com/Nexmo/nexmo-jwt-ruby/blob/master/CHANGES.md
|
49
|
-
documentation_uri: https://
|
49
|
+
documentation_uri: https://rubydoc.info/github/Nexmo/nexmo-jwt-ruby
|
50
50
|
post_install_message:
|
51
51
|
rdoc_options: []
|
52
52
|
require_paths:
|