jose 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/jose.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'jose/version'
2
2
 
3
3
  require 'base64'
4
- require 'hamster/hash'
4
+ require 'immutable/hash'
5
5
  require 'json'
6
6
  require 'openssl'
7
7
  require 'securerandom'
@@ -28,8 +28,8 @@ module JOSE
28
28
  # @!visibility private
29
29
  MUTEX = Mutex.new
30
30
 
31
- # Immutable Map structure based on `Hamster::Hash`.
32
- class Map < Hamster::Hash; end
31
+ # Immutable Map structure based on `Immutable::Hash`.
32
+ class Map < Immutable::Hash; end
33
33
 
34
34
  @__crypto_fallback__ = ENV['JOSE_CRYPTO_FALLBACK'] ? true : false
35
35
  @__unsecured_signing__ = ENV['JOSE_UNSECURED_SIGNING'] ? true : false
@@ -148,11 +148,31 @@ module JOSE
148
148
  return Base64.strict_encode64(binary).tr('+/', '-_').delete('=')
149
149
  end
150
150
 
151
+ # Gets the current XChaCha20-Poly1305 module used by {JOSE::JWA::XChaCha20Poly1305 JOSE::JWA::XChaCha20Poly1305}, see {.xchacha20poly1305_module=} for default.
152
+ # @return [Module]
153
+ def self.xchacha20poly1305_module
154
+ return JOSE::JWA::XChaCha20Poly1305.__implementation__
155
+ end
156
+
157
+ # Sets the current XChaCha20Poly1305 module used by {JOSE::JWA::XChaCha20Poly1305 JOSE::JWA::XChaCha20Poly1305}.
158
+ #
159
+ # Currently supported XChaCha20Poly1305 modules (first found is used as default):
160
+ #
161
+ # * {https://github.com/cryptosphere/rbnacl `RbNaCl`}
162
+ #
163
+ # Additional modules that implement the functions specified in {JOSE::JWA::XChaCha20Poly1305 JOSE::JWA::XChaCha20Poly1305} may also be used.
164
+ # @param [Module] mod
165
+ # @return [Module]
166
+ def self.xchacha20poly1305_module=(mod)
167
+ JOSE::JWA::XChaCha20Poly1305.__implementation__ = mod
168
+ end
169
+
151
170
  private
152
171
 
153
172
  def self.__config_change__
154
173
  JOSE::JWA::Curve25519.__config_change__
155
174
  JOSE::JWA::Curve448.__config_change__
175
+ JOSE::JWA::XChaCha20Poly1305.__config_change__
156
176
  end
157
177
 
158
178
  def self.sort_maps(term)
metadata CHANGED
@@ -1,17 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bennett
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-21 00:00:00.000000000 Z
11
+ date: 2024-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: hamster
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: immutable-ruby
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
@@ -30,28 +44,28 @@ dependencies:
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '1.16'
47
+ version: '2.5'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '1.16'
54
+ version: '2.5'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '12.3'
61
+ version: '13.1'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '12.3'
68
+ version: '13.1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: rbnacl-libsodium
98
+ name: rbnacl
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -130,10 +144,10 @@ extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
132
146
  - ".editorconfig"
147
+ - ".github/workflows/ci.yml"
133
148
  - ".gitignore"
134
149
  - ".ruby-gemset"
135
150
  - ".ruby-version"
136
- - ".travis.yml"
137
151
  - ".yardopts"
138
152
  - CHANGELOG.md
139
153
  - CODE_OF_CONDUCT.md
@@ -173,17 +187,24 @@ files:
173
187
  - lib/jose/jwa/x25519_cryptorb.rb
174
188
  - lib/jose/jwa/x25519_rbnacl.rb
175
189
  - lib/jose/jwa/x448.rb
190
+ - lib/jose/jwa/xchacha20poly1305.rb
191
+ - lib/jose/jwa/xchacha20poly1305_rbnacl.rb
192
+ - lib/jose/jwa/xchacha20poly1305_unsupported.rb
176
193
  - lib/jose/jwe.rb
177
194
  - lib/jose/jwe/alg.rb
178
195
  - lib/jose/jwe/alg_aes_gcm_kw.rb
179
196
  - lib/jose/jwe/alg_aes_kw.rb
197
+ - lib/jose/jwe/alg_c20p_kw.rb
180
198
  - lib/jose/jwe/alg_dir.rb
181
199
  - lib/jose/jwe/alg_ecdh_es.rb
182
200
  - lib/jose/jwe/alg_pbes2.rb
183
201
  - lib/jose/jwe/alg_rsa.rb
202
+ - lib/jose/jwe/alg_xc20p_kw.rb
184
203
  - lib/jose/jwe/enc.rb
185
204
  - lib/jose/jwe/enc_aes_cbc_hmac.rb
186
205
  - lib/jose/jwe/enc_aes_gcm.rb
206
+ - lib/jose/jwe/enc_c20p.rb
207
+ - lib/jose/jwe/enc_xc20p.rb
187
208
  - lib/jose/jwe/zip.rb
188
209
  - lib/jose/jwe/zip_def.rb
189
210
  - lib/jose/jwk.rb
@@ -213,9 +234,9 @@ files:
213
234
  - lib/jose/version.rb
214
235
  homepage: https://github.com/potatosalad/ruby-jose
215
236
  licenses:
216
- - MPL-2.0
237
+ - MIT
217
238
  metadata: {}
218
- post_install_message:
239
+ post_install_message:
219
240
  rdoc_options: []
220
241
  require_paths:
221
242
  - lib
@@ -230,9 +251,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
251
  - !ruby/object:Gem::Version
231
252
  version: '0'
232
253
  requirements: []
233
- rubyforge_project:
234
- rubygems_version: 2.7.6
235
- signing_key:
254
+ rubygems_version: 3.5.3
255
+ signing_key:
236
256
  specification_version: 4
237
257
  summary: JSON Object Signing and Encryption
238
258
  test_files: []
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- language: ruby
2
-
3
- sudo: required
4
- dist: trusty
5
-
6
- env:
7
- global:
8
- - JOSE_CRYPTO_FALLBACK=true
9
- - RUBYOPT="-W0"
10
-
11
- rvm:
12
- - 2.5.1
13
-
14
- notifications:
15
- email: false
16
-
17
- before_install:
18
- - "gem install bundler -v 1.16.4"