ruby-paseto 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/CODE_OF_CONDUCT.md +84 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +549 -0
  6. data/lib/paseto/asn1/algorithm_identifier.rb +17 -0
  7. data/lib/paseto/asn1/curve_private_key.rb +22 -0
  8. data/lib/paseto/asn1/ec_private_key.rb +27 -0
  9. data/lib/paseto/asn1/ecdsa_full_r.rb +26 -0
  10. data/lib/paseto/asn1/ecdsa_sig_value.rb +23 -0
  11. data/lib/paseto/asn1/ecdsa_signature.rb +49 -0
  12. data/lib/paseto/asn1/ed25519_identifier.rb +15 -0
  13. data/lib/paseto/asn1/named_curve.rb +17 -0
  14. data/lib/paseto/asn1/one_asymmetric_key.rb +32 -0
  15. data/lib/paseto/asn1/private_key.rb +17 -0
  16. data/lib/paseto/asn1/private_key_algorithm_identifier.rb +17 -0
  17. data/lib/paseto/asn1/public_key.rb +17 -0
  18. data/lib/paseto/asn1/subject_public_key_info.rb +28 -0
  19. data/lib/paseto/asn1.rb +101 -0
  20. data/lib/paseto/asymmetric_key.rb +100 -0
  21. data/lib/paseto/configuration/box.rb +23 -0
  22. data/lib/paseto/configuration/decode_configuration.rb +68 -0
  23. data/lib/paseto/configuration.rb +18 -0
  24. data/lib/paseto/interface/i_d.rb +23 -0
  25. data/lib/paseto/interface/key.rb +113 -0
  26. data/lib/paseto/interface/pbkd.rb +83 -0
  27. data/lib/paseto/interface/pie.rb +59 -0
  28. data/lib/paseto/interface/pke.rb +86 -0
  29. data/lib/paseto/interface/serializer.rb +19 -0
  30. data/lib/paseto/interface/version.rb +161 -0
  31. data/lib/paseto/interface/wrapper.rb +20 -0
  32. data/lib/paseto/operations/i_d.rb +48 -0
  33. data/lib/paseto/operations/id/i_dv3.rb +20 -0
  34. data/lib/paseto/operations/id/i_dv4.rb +20 -0
  35. data/lib/paseto/operations/pbkd/p_b_k_dv3.rb +85 -0
  36. data/lib/paseto/operations/pbkd/p_b_k_dv4.rb +94 -0
  37. data/lib/paseto/operations/pbkw.rb +73 -0
  38. data/lib/paseto/operations/pke/p_k_ev3.rb +97 -0
  39. data/lib/paseto/operations/pke/p_k_ev4.rb +95 -0
  40. data/lib/paseto/operations/pke.rb +57 -0
  41. data/lib/paseto/operations/wrap.rb +29 -0
  42. data/lib/paseto/paserk.rb +55 -0
  43. data/lib/paseto/paserk_types.rb +46 -0
  44. data/lib/paseto/protocol/version3.rb +100 -0
  45. data/lib/paseto/protocol/version4.rb +99 -0
  46. data/lib/paseto/result.rb +9 -0
  47. data/lib/paseto/serializer/optional_json.rb +30 -0
  48. data/lib/paseto/serializer/raw.rb +23 -0
  49. data/lib/paseto/sodium/curve_25519.rb +46 -0
  50. data/lib/paseto/sodium/safe_ed25519_loader.rb +19 -0
  51. data/lib/paseto/sodium/stream/base.rb +82 -0
  52. data/lib/paseto/sodium/stream/x_cha_cha20_xor.rb +31 -0
  53. data/lib/paseto/sodium.rb +5 -0
  54. data/lib/paseto/symmetric_key.rb +119 -0
  55. data/lib/paseto/token.rb +127 -0
  56. data/lib/paseto/token_types.rb +29 -0
  57. data/lib/paseto/util.rb +105 -0
  58. data/lib/paseto/v3/local.rb +63 -0
  59. data/lib/paseto/v3/public.rb +204 -0
  60. data/lib/paseto/v4/local.rb +56 -0
  61. data/lib/paseto/v4/public.rb +169 -0
  62. data/lib/paseto/validator.rb +154 -0
  63. data/lib/paseto/verifiers/footer.rb +30 -0
  64. data/lib/paseto/verifiers/payload.rb +42 -0
  65. data/lib/paseto/verify.rb +48 -0
  66. data/lib/paseto/version.rb +6 -0
  67. data/lib/paseto/versions.rb +25 -0
  68. data/lib/paseto/wrappers/pie/pie_v3.rb +72 -0
  69. data/lib/paseto/wrappers/pie/pie_v4.rb +72 -0
  70. data/lib/paseto/wrappers/pie.rb +71 -0
  71. data/lib/paseto.rb +99 -0
  72. data/paseto.gemspec +58 -0
  73. data/sorbet/config +3 -0
  74. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  75. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  76. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  77. data/sorbet/rbi/gems/docile@1.4.0.rbi +376 -0
  78. data/sorbet/rbi/gems/ffi@1.15.5.rbi +1994 -0
  79. data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
  80. data/sorbet/rbi/gems/irb@1.5.1.rbi +342 -0
  81. data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
  82. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +267 -0
  83. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  84. data/sorbet/rbi/gems/oj@3.13.23.rbi +603 -0
  85. data/sorbet/rbi/gems/openssl@3.0.1.rbi +1735 -0
  86. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  87. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +407 -0
  88. data/sorbet/rbi/gems/rake@13.0.6.rbi +3021 -0
  89. data/sorbet/rbi/gems/rbnacl@7.1.1.rbi +3218 -0
  90. data/sorbet/rbi/gems/regexp_parser@2.6.1.rbi +3481 -0
  91. data/sorbet/rbi/gems/reline@0.3.1.rbi +8 -0
  92. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
  93. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10887 -0
  94. data/sorbet/rbi/gems/rspec-expectations@3.12.0.rbi +8090 -0
  95. data/sorbet/rbi/gems/rspec-mocks@3.12.0.rbi +5300 -0
  96. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1617 -0
  97. data/sorbet/rbi/gems/rspec@3.12.0.rbi +88 -0
  98. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1239 -0
  99. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +219 -0
  100. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +2135 -0
  101. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
  102. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  103. data/sorbet/rbi/gems/timecop@0.9.6.rbi +350 -0
  104. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +48 -0
  105. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2555 -0
  106. data/sorbet/rbi/gems/yard-sorbet@0.7.0.rbi +391 -0
  107. data/sorbet/rbi/gems/yard@0.9.28.rbi +17816 -0
  108. data/sorbet/rbi/gems/zeitwerk@2.6.6.rbi +950 -0
  109. data/sorbet/rbi/shims/multi_json.rbi +19 -0
  110. data/sorbet/rbi/shims/openssl.rbi +111 -0
  111. data/sorbet/rbi/shims/rbnacl.rbi +65 -0
  112. data/sorbet/rbi/shims/zeitwerk.rbi +6 -0
  113. data/sorbet/rbi/todo.rbi +7 -0
  114. data/sorbet/tapioca/config.yml +30 -0
  115. data/sorbet/tapioca/require.rb +12 -0
  116. metadata +376 -0
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `io-console` gem.
5
+ # Please instead update this file by running `bin/tapioca gem io-console`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
@@ -0,0 +1,342 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `irb` gem.
5
+ # Please instead update this file by running `bin/tapioca gem irb`.
6
+
7
+ # An output formatter used internally by the lexer.
8
+ #
9
+ # source://irb//lib/irb/notifier.rb#17
10
+ module IRB::Notifier
11
+ private
12
+
13
+ # Define a new Notifier output source, returning a new CompositeNotifier
14
+ # with the given +prefix+ and +output_method+.
15
+ #
16
+ # The optional +prefix+ will be appended to all objects being inspected
17
+ # during output, using the given +output_method+ as the output source. If
18
+ # no +output_method+ is given, StdioOutputMethod will be used, and all
19
+ # expressions will be sent directly to STDOUT without any additional
20
+ # formatting.
21
+ #
22
+ # source://irb//lib/irb/notifier.rb#37
23
+ def def_notifier(prefix = T.unsafe(nil), output_method = T.unsafe(nil)); end
24
+
25
+ class << self
26
+ # Define a new Notifier output source, returning a new CompositeNotifier
27
+ # with the given +prefix+ and +output_method+.
28
+ #
29
+ # The optional +prefix+ will be appended to all objects being inspected
30
+ # during output, using the given +output_method+ as the output source. If
31
+ # no +output_method+ is given, StdioOutputMethod will be used, and all
32
+ # expressions will be sent directly to STDOUT without any additional
33
+ # formatting.
34
+ #
35
+ # source://irb//lib/irb/notifier.rb#37
36
+ def def_notifier(prefix = T.unsafe(nil), output_method = T.unsafe(nil)); end
37
+ end
38
+ end
39
+
40
+ # An abstract class, or superclass, for CompositeNotifier and
41
+ # LeveledNotifier to inherit. It provides several wrapper methods for the
42
+ # OutputMethod object used by the Notifier.
43
+ #
44
+ # source://irb//lib/irb/notifier.rb#45
45
+ class IRB::Notifier::AbstractNotifier
46
+ # Creates a new Notifier object
47
+ #
48
+ # @return [AbstractNotifier] a new instance of AbstractNotifier
49
+ #
50
+ # source://irb//lib/irb/notifier.rb#47
51
+ def initialize(prefix, base_notifier); end
52
+
53
+ # Execute the given block if notifications are enabled.
54
+ #
55
+ # @yield [@base_notifier]
56
+ #
57
+ # source://irb//lib/irb/notifier.rb#105
58
+ def exec_if; end
59
+
60
+ # A wrapper method used to determine whether notifications are enabled.
61
+ #
62
+ # Defaults to +true+.
63
+ #
64
+ # @return [Boolean]
65
+ #
66
+ # source://irb//lib/irb/notifier.rb#59
67
+ def notify?; end
68
+
69
+ # Same as #ppx, except it uses the #prefix given during object
70
+ # initialization.
71
+ # See OutputMethod#ppx for more detail.
72
+ #
73
+ # source://irb//lib/irb/notifier.rb#88
74
+ def pp(*objs); end
75
+
76
+ # Same as #pp, except it concatenates the given +prefix+ with the #prefix
77
+ # given during object initialization.
78
+ #
79
+ # See OutputMethod#ppx for more detail.
80
+ #
81
+ # source://irb//lib/irb/notifier.rb#98
82
+ def ppx(prefix, *objs); end
83
+
84
+ # The +prefix+ for this Notifier, which is appended to all objects being
85
+ # inspected during output.
86
+ #
87
+ # source://irb//lib/irb/notifier.rb#54
88
+ def prefix; end
89
+
90
+ # See OutputMethod#print for more detail.
91
+ #
92
+ # source://irb//lib/irb/notifier.rb#64
93
+ def print(*opts); end
94
+
95
+ # See OutputMethod#printf for more detail.
96
+ #
97
+ # source://irb//lib/irb/notifier.rb#74
98
+ def printf(format, *opts); end
99
+
100
+ # See OutputMethod#printn for more detail.
101
+ #
102
+ # source://irb//lib/irb/notifier.rb#69
103
+ def printn(*opts); end
104
+
105
+ # See OutputMethod#puts for more detail.
106
+ #
107
+ # source://irb//lib/irb/notifier.rb#79
108
+ def puts(*objs); end
109
+ end
110
+
111
+ # A class that can be used to create a group of notifier objects with the
112
+ # intent of representing a leveled notification system for irb.
113
+ #
114
+ # This class will allow you to generate other notifiers, and assign them
115
+ # the appropriate level for output.
116
+ #
117
+ # The Notifier class provides a class-method Notifier.def_notifier to
118
+ # create a new composite notifier. Using the first composite notifier
119
+ # object you create, sibling notifiers can be initialized with
120
+ # #def_notifier.
121
+ #
122
+ # source://irb//lib/irb/notifier.rb#122
123
+ class IRB::Notifier::CompositeNotifier < ::IRB::Notifier::AbstractNotifier
124
+ # Create a new composite notifier object with the given +prefix+, and
125
+ # +base_notifier+ to use for output.
126
+ #
127
+ # @return [CompositeNotifier] a new instance of CompositeNotifier
128
+ #
129
+ # source://irb//lib/irb/notifier.rb#123
130
+ def initialize(prefix, base_notifier); end
131
+
132
+ # Creates a new LeveledNotifier in the composite #notifiers group.
133
+ #
134
+ # The given +prefix+ will be assigned to the notifier, and +level+ will
135
+ # be used as the index of the #notifiers Array.
136
+ #
137
+ # This method returns the newly created instance.
138
+ #
139
+ # source://irb//lib/irb/notifier.rb#139
140
+ def def_notifier(level, prefix = T.unsafe(nil)); end
141
+
142
+ # Returns the leveled notifier for this object
143
+ #
144
+ # source://irb//lib/irb/notifier.rb#146
145
+ def level; end
146
+
147
+ # Sets the leveled notifier for this object.
148
+ #
149
+ # When the given +value+ is an instance of AbstractNotifier,
150
+ # #level_notifier is set to the given object.
151
+ #
152
+ # When an Integer is given, #level_notifier is set to the notifier at the
153
+ # index +value+ in the #notifiers Array.
154
+ #
155
+ # If no notifier exists at the index +value+ in the #notifiers Array, an
156
+ # ErrUndefinedNotifier exception is raised.
157
+ #
158
+ # An ErrUnrecognizedLevel exception is raised if the given +value+ is not
159
+ # found in the existing #notifiers Array, or an instance of
160
+ # AbstractNotifier
161
+ #
162
+ # source://irb//lib/irb/notifier.rb#163
163
+ def level=(value); end
164
+
165
+ # Returns the leveled notifier for this object
166
+ #
167
+ # source://irb//lib/irb/notifier.rb#146
168
+ def level_notifier; end
169
+
170
+ # Sets the leveled notifier for this object.
171
+ #
172
+ # When the given +value+ is an instance of AbstractNotifier,
173
+ # #level_notifier is set to the given object.
174
+ #
175
+ # When an Integer is given, #level_notifier is set to the notifier at the
176
+ # index +value+ in the #notifiers Array.
177
+ #
178
+ # If no notifier exists at the index +value+ in the #notifiers Array, an
179
+ # ErrUndefinedNotifier exception is raised.
180
+ #
181
+ # An ErrUnrecognizedLevel exception is raised if the given +value+ is not
182
+ # found in the existing #notifiers Array, or an instance of
183
+ # AbstractNotifier
184
+ #
185
+ # source://irb//lib/irb/notifier.rb#163
186
+ def level_notifier=(value); end
187
+
188
+ # List of notifiers in the group
189
+ #
190
+ # source://irb//lib/irb/notifier.rb#131
191
+ def notifiers; end
192
+ end
193
+
194
+ # source://irb//lib/irb/notifier.rb#18
195
+ class IRB::Notifier::ErrUndefinedNotifier < ::StandardError
196
+ # @return [ErrUndefinedNotifier] a new instance of ErrUndefinedNotifier
197
+ #
198
+ # source://irb//lib/irb/notifier.rb#19
199
+ def initialize(val); end
200
+ end
201
+
202
+ # source://irb//lib/irb/notifier.rb#23
203
+ class IRB::Notifier::ErrUnrecognizedLevel < ::StandardError
204
+ # @return [ErrUnrecognizedLevel] a new instance of ErrUnrecognizedLevel
205
+ #
206
+ # source://irb//lib/irb/notifier.rb#24
207
+ def initialize(val); end
208
+ end
209
+
210
+ # A leveled notifier is comparable to the composite group from
211
+ # CompositeNotifier#notifiers.
212
+ #
213
+ # source://irb//lib/irb/notifier.rb#181
214
+ class IRB::Notifier::LeveledNotifier < ::IRB::Notifier::AbstractNotifier
215
+ include ::Comparable
216
+
217
+ # Create a new leveled notifier with the given +base+, and +prefix+ to
218
+ # send to AbstractNotifier.new
219
+ #
220
+ # The given +level+ is used to compare other leveled notifiers in the
221
+ # CompositeNotifier group to determine whether or not to output
222
+ # notifications.
223
+ #
224
+ # @return [LeveledNotifier] a new instance of LeveledNotifier
225
+ #
226
+ # source://irb//lib/irb/notifier.rb#190
227
+ def initialize(base, level, prefix); end
228
+
229
+ # Compares the level of this notifier object with the given +other+
230
+ # notifier.
231
+ #
232
+ # See the Comparable module for more information.
233
+ #
234
+ # source://irb//lib/irb/notifier.rb#203
235
+ def <=>(other); end
236
+
237
+ # The current level of this notifier object
238
+ #
239
+ # source://irb//lib/irb/notifier.rb#197
240
+ def level; end
241
+
242
+ # Whether to output messages to the output method, depending on the level
243
+ # of this notifier object.
244
+ #
245
+ # @return [Boolean]
246
+ #
247
+ # source://irb//lib/irb/notifier.rb#209
248
+ def notify?; end
249
+ end
250
+
251
+ # NoMsgNotifier is a LeveledNotifier that's used as the default notifier
252
+ # when creating a new CompositeNotifier.
253
+ #
254
+ # This notifier is used as the +zero+ index, or level +0+, for
255
+ # CompositeNotifier#notifiers, and will not output messages of any sort.
256
+ #
257
+ # source://irb//lib/irb/notifier.rb#220
258
+ class IRB::Notifier::NoMsgNotifier < ::IRB::Notifier::LeveledNotifier
259
+ # Creates a new notifier that should not be used to output messages.
260
+ #
261
+ # @return [NoMsgNotifier] a new instance of NoMsgNotifier
262
+ #
263
+ # source://irb//lib/irb/notifier.rb#221
264
+ def initialize; end
265
+
266
+ # Ensures notifications are ignored, see AbstractNotifier#notify? for
267
+ # more information.
268
+ #
269
+ # @return [Boolean]
270
+ #
271
+ # source://irb//lib/irb/notifier.rb#229
272
+ def notify?; end
273
+ end
274
+
275
+ # An abstract output class for IO in irb. This is mainly used internally by
276
+ # IRB::Notifier. You can define your own output method to use with Irb.new,
277
+ # or Context.new
278
+ #
279
+ # source://irb//lib/irb/output-method.rb#17
280
+ class IRB::OutputMethod
281
+ # Returns an array of the given +format+ and +opts+ to be used by
282
+ # Kernel#sprintf, if there was a successful Regexp match in the given
283
+ # +format+ from #printf
284
+ #
285
+ # %
286
+ # <flag> [#0- +]
287
+ # <minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*)
288
+ # <precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)?
289
+ # #<length modifier>(hh|h|l|ll|L|q|j|z|t)
290
+ # <conversion specifier>[diouxXeEfgGcsb%]
291
+ #
292
+ # source://irb//lib/irb/output-method.rb#54
293
+ def parse_printf_format(format, opts); end
294
+
295
+ # Prints the given +objs+ calling Object#inspect on each.
296
+ #
297
+ # See #puts for more detail.
298
+ #
299
+ # source://irb//lib/irb/output-method.rb#70
300
+ def pp(*objs); end
301
+
302
+ # Prints the given +objs+ calling Object#inspect on each and appending the
303
+ # given +prefix+.
304
+ #
305
+ # See #puts for more detail.
306
+ #
307
+ # source://irb//lib/irb/output-method.rb#78
308
+ def ppx(prefix, *objs); end
309
+
310
+ # Open this method to implement your own output method, raises a
311
+ # NotImplementedError if you don't define #print in your own class.
312
+ #
313
+ # @raise [NotImplementedError]
314
+ #
315
+ # source://irb//lib/irb/output-method.rb#26
316
+ def print(*opts); end
317
+
318
+ # Extends IO#printf to format the given +opts+ for Kernel#sprintf using
319
+ # #parse_printf_format
320
+ #
321
+ # source://irb//lib/irb/output-method.rb#37
322
+ def printf(format, *opts); end
323
+
324
+ # Prints the given +opts+, with a newline delimiter.
325
+ #
326
+ # source://irb//lib/irb/output-method.rb#31
327
+ def printn(*opts); end
328
+
329
+ # Calls #print on each element in the given +objs+, followed by a newline
330
+ # character.
331
+ #
332
+ # source://irb//lib/irb/output-method.rb#60
333
+ def puts(*objs); end
334
+ end
335
+
336
+ # source://irb//lib/irb/output-method.rb#18
337
+ class IRB::OutputMethod::NotImplementedError < ::StandardError
338
+ # @return [NotImplementedError] a new instance of NotImplementedError
339
+ #
340
+ # source://irb//lib/irb/output-method.rb#19
341
+ def initialize(val); end
342
+ end