trailblazer-endpoint 0.0.2 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +16 -0
  3. data/Appraisals +5 -0
  4. data/CHANGES.md +28 -0
  5. data/README.md +40 -5
  6. data/Rakefile +7 -1
  7. data/gemfiles/rails_app.gemfile +12 -0
  8. data/lib/trailblazer/endpoint.rb +55 -16
  9. data/lib/trailblazer/endpoint/adapter.rb +30 -121
  10. data/lib/trailblazer/endpoint/builder.rb +1 -1
  11. data/lib/trailblazer/endpoint/controller.rb +223 -0
  12. data/lib/trailblazer/endpoint/dsl.rb +31 -0
  13. data/lib/trailblazer/endpoint/options.rb +92 -0
  14. data/lib/trailblazer/endpoint/protocol.rb +7 -11
  15. data/lib/trailblazer/endpoint/protocol/cipher.rb +27 -0
  16. data/lib/trailblazer/endpoint/protocol/controller.rb +93 -0
  17. data/lib/trailblazer/endpoint/protocol/find_process_model.rb +15 -0
  18. data/lib/trailblazer/endpoint/version.rb +1 -1
  19. data/test/adapter/api_test.rb +6 -11
  20. data/test/adapter/web_test.rb +2 -5
  21. data/test/config_test.rb +128 -0
  22. data/test/docs/controller_test.rb +340 -58
  23. data/test/endpoint_test.rb +1 -1
  24. data/test/rails-app/.gitignore +8 -2
  25. data/test/rails-app/.ruby-version +1 -0
  26. data/test/rails-app/Gemfile +21 -9
  27. data/test/rails-app/Gemfile.lock +173 -118
  28. data/test/rails-app/app/concepts/app/api/v1/representer/errors.rb +16 -0
  29. data/test/rails-app/app/concepts/auth/jwt.rb +35 -0
  30. data/test/rails-app/app/concepts/auth/operation/authenticate.rb +32 -0
  31. data/test/rails-app/app/concepts/auth/operation/policy.rb +9 -0
  32. data/test/rails-app/app/concepts/song/cell/create.rb +4 -0
  33. data/test/rails-app/app/concepts/song/cell/new.rb +4 -0
  34. data/test/rails-app/app/concepts/song/operation/create.rb +17 -0
  35. data/test/rails-app/app/concepts/song/operation/show.rb +10 -0
  36. data/test/rails-app/app/concepts/song/representer.rb +5 -0
  37. data/test/rails-app/app/concepts/song/view/create.erb +1 -0
  38. data/test/rails-app/app/concepts/song/view/new.erb +1 -0
  39. data/test/rails-app/app/controllers/api/v1/songs_controller.rb +41 -0
  40. data/test/rails-app/app/controllers/application_controller.rb +8 -1
  41. data/test/rails-app/app/controllers/application_controller/api.rb +107 -0
  42. data/test/rails-app/app/controllers/application_controller/web.rb +45 -0
  43. data/test/rails-app/app/controllers/auth_controller.rb +44 -0
  44. data/test/rails-app/app/controllers/home_controller.rb +5 -0
  45. data/test/rails-app/app/controllers/songs_controller.rb +245 -13
  46. data/test/rails-app/app/models/song.rb +6 -0
  47. data/test/rails-app/app/models/user.rb +7 -0
  48. data/test/rails-app/bin/bundle +114 -0
  49. data/test/rails-app/bin/rails +4 -0
  50. data/test/rails-app/bin/rake +4 -0
  51. data/test/rails-app/bin/setup +33 -0
  52. data/test/rails-app/config/application.rb +26 -3
  53. data/test/rails-app/config/credentials.yml.enc +1 -0
  54. data/test/rails-app/config/database.yml +2 -2
  55. data/test/rails-app/config/environments/development.rb +7 -17
  56. data/test/rails-app/config/environments/production.rb +28 -23
  57. data/test/rails-app/config/environments/test.rb +10 -12
  58. data/test/rails-app/config/initializers/application_controller_renderer.rb +6 -4
  59. data/test/rails-app/config/initializers/cors.rb +16 -0
  60. data/test/rails-app/config/initializers/trailblazer.rb +2 -0
  61. data/test/rails-app/config/locales/en.yml +11 -1
  62. data/test/rails-app/config/master.key +1 -0
  63. data/test/rails-app/config/routes.rb +26 -4
  64. data/test/rails-app/db/schema.rb +15 -0
  65. data/test/rails-app/test/controllers/api_songs_controller_test.rb +87 -0
  66. data/test/rails-app/test/controllers/songs_controller_test.rb +146 -144
  67. data/test/rails-app/test/test_helper.rb +7 -1
  68. data/test/test_helper.rb +0 -2
  69. data/trailblazer-endpoint.gemspec +2 -1
  70. metadata +73 -22
  71. data/test/rails-app/config/initializers/cookies_serializer.rb +0 -5
  72. data/test/rails-app/config/initializers/new_framework_defaults.rb +0 -24
  73. data/test/rails-app/config/initializers/session_store.rb +0 -3
  74. data/test/rails-app/config/secrets.yml +0 -22
  75. data/test/rails-app/test/helpers/.keep +0 -0
  76. data/test/rails-app/test/integration/.keep +0 -0
  77. data/test/rails-app/test/mailers/.keep +0 -0
  78. data/test/rails-app/vendor/assets/javascripts/.keep +0 -0
  79. data/test/rails-app/vendor/assets/stylesheets/.keep +0 -0
@@ -261,7 +261,7 @@ class EndpointTest < Minitest::Spec
261
261
  class MyApiAdapter < Trailblazer::Endpoint::Adapter::API
262
262
  # example how to add your own step to a certain path
263
263
  # FIXME: :after doesn't work
264
- step :my_401_handler, before: :_401_status, magnetic_to: :_401, Output(:success) => Track(:_401), Output(:failure) => Track(:_401)
264
+ step :my_401_handler, before: :_401_status, magnetic_to: :_401, Output(:success) => Track(:_401)
265
265
 
266
266
  # def render_success(ctx, **)
267
267
  # ctx[:json] = %{#{ctx[:representer]}.new(#{ctx[:model]})}
@@ -10,6 +10,7 @@
10
10
  # Ignore the default SQLite database.
11
11
  /db/*.sqlite3
12
12
  /db/*.sqlite3-journal
13
+ /db/*.sqlite3-*
13
14
 
14
15
  # Ignore all logfiles and tempfiles.
15
16
  /log/*
@@ -17,5 +18,10 @@
17
18
  !/log/.keep
18
19
  !/tmp/.keep
19
20
 
20
- # Ignore Byebug command history file.
21
- .byebug_history
21
+ # Ignore pidfiles, but keep the directory.
22
+ /tmp/pids/*
23
+ !/tmp/pids/
24
+ !/tmp/pids/.keep
25
+
26
+ # Ignore master key for decrypting credentials and more.
27
+ # /config/master.key
@@ -0,0 +1 @@
1
+ ruby-2.5.1
@@ -1,17 +1,29 @@
1
1
  source 'https://rubygems.org'
2
-
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
- gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
5
+ gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
6
6
  # Use sqlite3 as the database for Active Record
7
- gem 'sqlite3'
7
+ gem 'sqlite3', '~> 1.4'
8
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
9
+ # gem 'jbuilder', '~> 2.7'
10
+ # Use Active Model has_secure_password
11
+ # gem 'bcrypt', '~> 3.1.7'
8
12
 
9
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
10
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
13
+ # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
14
+ # gem 'rack-cors'
11
15
 
16
+ gem "trailblazer-operation"
12
17
  gem "trailblazer-endpoint", path: "../../."
13
- gem "trailblazer", path: "../../../trailblazer"
14
- gem "trailblazer-operation", path: "../../../operation"
15
- # gem "trailblazer-rails"
16
-
18
+ gem "jwt"
17
19
  gem "multi_json"
20
+ gem "minitest-line"
21
+ gem "trailblazer-cells"
22
+ gem "cells-erb"
23
+ gem "cells-rails"
24
+
25
+
26
+ # FIXME
27
+ gem "trailblazer-workflow", path: "../../../trailblazer-workflow"
28
+ # gem "trailblazer-activity-dsl-linear", path: "../../../trailblazer-activity-dsl-linear"
29
+ gem "trailblazer-activity-dsl-linear", ">= 0.3.4"
@@ -1,157 +1,212 @@
1
1
  PATH
2
- remote: ../../../operation
2
+ remote: ../../../trailblazer-workflow
3
3
  specs:
4
- trailblazer-operation (0.0.6)
5
- declarative
6
- pipetree (>= 0.0.4, < 0.1.0)
7
- uber (>= 0.1.0, < 0.2.0)
4
+ trailblazer-workflow (0.0.8)
5
+ trailblazer-activity
6
+ trailblazer-activity-implementation
7
+ trailblazer-developer (>= 0.0.10)
8
+ trailblazer-endpoint
8
9
 
9
10
  PATH
10
- remote: ../../../trailblazer
11
+ remote: ../..
11
12
  specs:
12
- trailblazer (2.0.0.beta1)
13
- declarative
14
- reform (>= 2.2.0, < 3.0.0)
15
- trailblazer-operation
16
- uber (>= 0.1.0, < 0.2.0)
17
-
18
- PATH
19
- remote: ../../.
20
- specs:
21
- trailblazer-endpoint (0.0.1)
22
- dry-matcher
13
+ trailblazer-endpoint (0.0.7)
14
+ trailblazer-activity-dsl-linear (>= 0.3.4, < 0.4.0)
23
15
 
24
16
  GEM
25
17
  remote: https://rubygems.org/
26
18
  specs:
27
- actioncable (5.0.0.1)
28
- actionpack (= 5.0.0.1)
29
- nio4r (~> 1.2)
30
- websocket-driver (~> 0.6.1)
31
- actionmailer (5.0.0.1)
32
- actionpack (= 5.0.0.1)
33
- actionview (= 5.0.0.1)
34
- activejob (= 5.0.0.1)
19
+ actioncable (6.0.3.2)
20
+ actionpack (= 6.0.3.2)
21
+ nio4r (~> 2.0)
22
+ websocket-driver (>= 0.6.1)
23
+ actionmailbox (6.0.3.2)
24
+ actionpack (= 6.0.3.2)
25
+ activejob (= 6.0.3.2)
26
+ activerecord (= 6.0.3.2)
27
+ activestorage (= 6.0.3.2)
28
+ activesupport (= 6.0.3.2)
29
+ mail (>= 2.7.1)
30
+ actionmailer (6.0.3.2)
31
+ actionpack (= 6.0.3.2)
32
+ actionview (= 6.0.3.2)
33
+ activejob (= 6.0.3.2)
35
34
  mail (~> 2.5, >= 2.5.4)
36
35
  rails-dom-testing (~> 2.0)
37
- actionpack (5.0.0.1)
38
- actionview (= 5.0.0.1)
39
- activesupport (= 5.0.0.1)
40
- rack (~> 2.0)
41
- rack-test (~> 0.6.3)
36
+ actionpack (6.0.3.2)
37
+ actionview (= 6.0.3.2)
38
+ activesupport (= 6.0.3.2)
39
+ rack (~> 2.0, >= 2.0.8)
40
+ rack-test (>= 0.6.3)
42
41
  rails-dom-testing (~> 2.0)
43
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
44
- actionview (5.0.0.1)
45
- activesupport (= 5.0.0.1)
42
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
+ actiontext (6.0.3.2)
44
+ actionpack (= 6.0.3.2)
45
+ activerecord (= 6.0.3.2)
46
+ activestorage (= 6.0.3.2)
47
+ activesupport (= 6.0.3.2)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (6.0.3.2)
50
+ activesupport (= 6.0.3.2)
46
51
  builder (~> 3.1)
47
- erubis (~> 2.7.0)
52
+ erubi (~> 1.4)
48
53
  rails-dom-testing (~> 2.0)
49
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
50
- activejob (5.0.0.1)
51
- activesupport (= 5.0.0.1)
54
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
+ activejob (6.0.3.2)
56
+ activesupport (= 6.0.3.2)
52
57
  globalid (>= 0.3.6)
53
- activemodel (5.0.0.1)
54
- activesupport (= 5.0.0.1)
55
- activerecord (5.0.0.1)
56
- activemodel (= 5.0.0.1)
57
- activesupport (= 5.0.0.1)
58
- arel (~> 7.0)
59
- activesupport (5.0.0.1)
58
+ activemodel (6.0.3.2)
59
+ activesupport (= 6.0.3.2)
60
+ activerecord (6.0.3.2)
61
+ activemodel (= 6.0.3.2)
62
+ activesupport (= 6.0.3.2)
63
+ activestorage (6.0.3.2)
64
+ actionpack (= 6.0.3.2)
65
+ activejob (= 6.0.3.2)
66
+ activerecord (= 6.0.3.2)
67
+ marcel (~> 0.3.1)
68
+ activesupport (6.0.3.2)
60
69
  concurrent-ruby (~> 1.0, >= 1.0.2)
61
- i18n (~> 0.7)
70
+ i18n (>= 0.7, < 2)
62
71
  minitest (~> 5.1)
63
72
  tzinfo (~> 1.1)
64
- arel (7.1.4)
65
- builder (3.2.2)
66
- concurrent-ruby (1.0.2)
67
- declarative (0.0.8)
68
- uber (>= 0.0.15)
69
- disposable (0.3.2)
70
- declarative (>= 0.0.8, < 1.0.0)
71
- representable (>= 2.4.0, <= 3.1.0)
72
- uber
73
- dry-matcher (0.5.0)
74
- erubis (2.7.0)
75
- globalid (0.3.7)
76
- activesupport (>= 4.1.0)
77
- i18n (0.7.0)
78
- loofah (2.0.3)
73
+ zeitwerk (~> 2.2, >= 2.2.2)
74
+ builder (3.2.4)
75
+ cells (4.1.7)
76
+ declarative-builder (< 0.2.0)
77
+ declarative-option (< 0.2.0)
78
+ tilt (>= 1.4, < 3)
79
+ uber (< 0.2.0)
80
+ cells-erb (0.1.0)
81
+ cells (~> 4.0)
82
+ erbse (>= 0.1.1)
83
+ cells-rails (0.1.1)
84
+ actionpack (>= 5.0)
85
+ cells (>= 4.1.6, < 5.0.0)
86
+ concurrent-ruby (1.1.7)
87
+ crass (1.0.6)
88
+ declarative (0.0.20)
89
+ declarative-builder (0.1.0)
90
+ declarative-option (< 0.2.0)
91
+ declarative-option (0.1.0)
92
+ erbse (0.1.4)
93
+ temple
94
+ erubi (1.9.0)
95
+ globalid (0.4.2)
96
+ activesupport (>= 4.2.0)
97
+ hashie (4.1.0)
98
+ hirb (0.7.3)
99
+ i18n (1.8.5)
100
+ concurrent-ruby (~> 1.0)
101
+ jwt (2.2.2)
102
+ loofah (2.7.0)
103
+ crass (~> 1.0.2)
79
104
  nokogiri (>= 1.5.9)
80
- mail (2.6.4)
81
- mime-types (>= 1.16, < 4)
82
- method_source (0.8.2)
83
- mime-types (3.1)
84
- mime-types-data (~> 3.2015)
85
- mime-types-data (3.2016.0521)
86
- mini_portile2 (2.1.0)
87
- minitest (5.9.1)
88
- multi_json (1.12.1)
89
- nio4r (1.2.1)
90
- nokogiri (1.6.8.1)
91
- mini_portile2 (~> 2.1.0)
92
- pipetree (0.0.4)
93
- rack (2.0.1)
94
- rack-test (0.6.3)
95
- rack (>= 1.0)
96
- rails (5.0.0.1)
97
- actioncable (= 5.0.0.1)
98
- actionmailer (= 5.0.0.1)
99
- actionpack (= 5.0.0.1)
100
- actionview (= 5.0.0.1)
101
- activejob (= 5.0.0.1)
102
- activemodel (= 5.0.0.1)
103
- activerecord (= 5.0.0.1)
104
- activesupport (= 5.0.0.1)
105
- bundler (>= 1.3.0, < 2.0)
106
- railties (= 5.0.0.1)
105
+ mail (2.7.1)
106
+ mini_mime (>= 0.1.1)
107
+ marcel (0.3.3)
108
+ mimemagic (~> 0.3.2)
109
+ method_source (1.0.0)
110
+ mimemagic (0.3.5)
111
+ mini_mime (1.0.2)
112
+ mini_portile2 (2.4.0)
113
+ minitest (5.14.2)
114
+ minitest-line (0.6.5)
115
+ minitest (~> 5.0)
116
+ multi_json (1.15.0)
117
+ nio4r (2.5.2)
118
+ nokogiri (1.10.10)
119
+ mini_portile2 (~> 2.4.0)
120
+ rack (2.2.3)
121
+ rack-test (1.1.0)
122
+ rack (>= 1.0, < 3)
123
+ rails (6.0.3.2)
124
+ actioncable (= 6.0.3.2)
125
+ actionmailbox (= 6.0.3.2)
126
+ actionmailer (= 6.0.3.2)
127
+ actionpack (= 6.0.3.2)
128
+ actiontext (= 6.0.3.2)
129
+ actionview (= 6.0.3.2)
130
+ activejob (= 6.0.3.2)
131
+ activemodel (= 6.0.3.2)
132
+ activerecord (= 6.0.3.2)
133
+ activestorage (= 6.0.3.2)
134
+ activesupport (= 6.0.3.2)
135
+ bundler (>= 1.3.0)
136
+ railties (= 6.0.3.2)
107
137
  sprockets-rails (>= 2.0.0)
108
- rails-dom-testing (2.0.1)
109
- activesupport (>= 4.2.0, < 6.0)
110
- nokogiri (~> 1.6.0)
111
- rails-html-sanitizer (1.0.3)
112
- loofah (~> 2.0)
113
- railties (5.0.0.1)
114
- actionpack (= 5.0.0.1)
115
- activesupport (= 5.0.0.1)
138
+ rails-dom-testing (2.0.3)
139
+ activesupport (>= 4.2.0)
140
+ nokogiri (>= 1.6)
141
+ rails-html-sanitizer (1.3.0)
142
+ loofah (~> 2.3)
143
+ railties (6.0.3.2)
144
+ actionpack (= 6.0.3.2)
145
+ activesupport (= 6.0.3.2)
116
146
  method_source
117
147
  rake (>= 0.8.7)
118
- thor (>= 0.18.1, < 2.0)
119
- rake (11.3.0)
120
- reform (2.2.3)
121
- disposable (>= 0.3.0, < 0.4.0)
122
- representable (>= 2.4.0, < 3.1.0)
123
- uber (>= 0.0.15, < 0.2.0)
124
- representable (3.0.2)
125
- declarative (~> 0.0.5)
126
- uber (>= 0.0.15, < 0.2.0)
127
- sprockets (3.7.0)
148
+ thor (>= 0.20.3, < 2.0)
149
+ rake (13.0.1)
150
+ representable (3.0.4)
151
+ declarative (< 0.1.0)
152
+ declarative-option (< 0.2.0)
153
+ uber (< 0.2.0)
154
+ sprockets (4.0.2)
128
155
  concurrent-ruby (~> 1.0)
129
156
  rack (> 1, < 3)
130
- sprockets-rails (3.2.0)
157
+ sprockets-rails (3.2.1)
131
158
  actionpack (>= 4.0)
132
159
  activesupport (>= 4.0)
133
160
  sprockets (>= 3.0.0)
134
- sqlite3 (1.3.12)
135
- thor (0.19.1)
136
- thread_safe (0.3.5)
137
- tzinfo (1.2.2)
161
+ sqlite3 (1.4.2)
162
+ temple (0.8.2)
163
+ thor (1.0.1)
164
+ thread_safe (0.3.6)
165
+ tilt (2.0.10)
166
+ trailblazer-activity (0.11.3)
167
+ trailblazer-context (>= 0.3.1, < 0.4.0)
168
+ trailblazer-activity-dsl-linear (0.3.4)
169
+ trailblazer-activity (>= 0.11.3, < 1.0.0)
170
+ trailblazer-activity-implementation (0.0.3)
171
+ trailblazer-activity (>= 0.8.0)
172
+ trailblazer-activity-dsl-linear
173
+ trailblazer-cells (0.0.3)
174
+ cells (>= 4.1.0.rc1, < 5.0.0)
175
+ trailblazer-context (0.3.1)
176
+ hashie (~> 4.1)
177
+ trailblazer-developer (0.0.16)
178
+ hirb
179
+ representable
180
+ trailblazer-activity (>= 0.11.0, < 1.0.0)
181
+ trailblazer-activity-dsl-linear
182
+ trailblazer-operation (0.6.5)
183
+ trailblazer-activity (>= 0.11.2, < 1.0.0)
184
+ trailblazer-activity-dsl-linear (>= 0.3.2, < 1.0.0)
185
+ trailblazer-developer (>= 0.0.8)
186
+ tzinfo (1.2.7)
138
187
  thread_safe (~> 0.1)
139
188
  uber (0.1.0)
140
- websocket-driver (0.6.4)
189
+ websocket-driver (0.7.3)
141
190
  websocket-extensions (>= 0.1.0)
142
- websocket-extensions (0.1.2)
191
+ websocket-extensions (0.1.5)
192
+ zeitwerk (2.4.0)
143
193
 
144
194
  PLATFORMS
145
195
  ruby
146
196
 
147
197
  DEPENDENCIES
198
+ cells-erb
199
+ cells-rails
200
+ jwt
201
+ minitest-line
148
202
  multi_json
149
- rails (~> 5.0.0, >= 5.0.0.1)
150
- sqlite3
151
- trailblazer!
203
+ rails (~> 6.0.3, >= 6.0.3.1)
204
+ sqlite3 (~> 1.4)
205
+ trailblazer-activity-dsl-linear (>= 0.3.4)
206
+ trailblazer-cells
152
207
  trailblazer-endpoint!
153
- trailblazer-operation!
154
- tzinfo-data
208
+ trailblazer-operation
209
+ trailblazer-workflow!
155
210
 
156
211
  BUNDLED WITH
157
- 1.12.5
212
+ 2.1.4
@@ -0,0 +1,16 @@
1
+ module App
2
+ module Api
3
+ module V1
4
+ module Representer
5
+ class Errors < Representable::Decorator
6
+ include Representable::JSON
7
+
8
+ self.representation_wrap= :errors
9
+
10
+ property :message
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,35 @@
1
+ require 'date'
2
+ require "jwt"
3
+
4
+ # Thanks to pocketrocket GmbH for providing this sample code.
5
+ module Auth
6
+ class Jwt
7
+ # Generate a JWT from arguments
8
+ def self.generate(encoding_key, encoding_value, payload)
9
+ # expiration_time = Rails.application.credentials[:jwt_expiration_time].hours.from_now.to_i # TODO: show how to inject config options
10
+ expiration_time = 1.hours.from_now.to_i
11
+ payload['exp'] = expiration_time
12
+ jwt = JWT.encode(payload,
13
+ Rails.application.credentials[:secret_key_base], 'HS512',
14
+ { exp: expiration_time, encoding_key.to_sym => encoding_value }
15
+ )
16
+ return jwt
17
+ end
18
+
19
+ # Validate tokens expiration date
20
+ def self.expired?(token)
21
+ decoded_token = JwtService.decode(token)
22
+ expiry_timestamp = decoded_token.first['exp']
23
+ expiration_date = Time.at(expiry_timestamp).to_datetime
24
+ return DateTime.now > expiration_date
25
+ rescue => err
26
+ return true
27
+ end
28
+
29
+ def self.decode(token)
30
+ JWT.decode(token, Rails.application.credentials[:secret_key_base], true, { algorithm: 'HS512'})
31
+ rescue => err # FIXME: is there any way to call {JWT.decode} without an exception?
32
+ nil
33
+ end
34
+ end
35
+ end