pq_crypto-jwt 0.1.2 → 0.2.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.
data/lib/pq_crypto/jwt.rb CHANGED
@@ -23,53 +23,27 @@ module PQCrypto
23
23
 
24
24
  SIGNING_ALGORITHMS = [JWA::MLDSA44, JWA::MLDSA65, JWA::MLDSA87].freeze
25
25
  KEM_ALGORITHMS = [].freeze
26
- ALGORITHMS = SIGNING_ALGORITHMS.freeze
27
- ALGORITHMS_BY_JOSE = ALGORITHMS.to_h { |algorithm| [algorithm.alg, algorithm] }.freeze
26
+ ALGORITHMS_BY_JOSE = SIGNING_ALGORITHMS.to_h { |algorithm| [algorithm.alg, algorithm] }.freeze
28
27
 
29
- class << self
30
- def algorithms
31
- ALGORITHMS
32
- end
33
-
34
- def signing_algorithms
35
- SIGNING_ALGORITHMS
36
- end
28
+ REGISTRATION_MUTEX = Monitor.new
37
29
 
38
- # Kept as an explicit empty list so callers can branch safely.
39
- # ML-KEM/JWE is intentionally not part of the first stable release.
40
- def kem_algorithms
41
- KEM_ALGORITHMS
42
- end
43
-
44
- def algorithm_for(alg_string)
45
- ALGORITHMS_BY_JOSE[alg_string]
46
- end
30
+ class << self
31
+ def algorithms = SIGNING_ALGORITHMS
32
+ def signing_algorithms = SIGNING_ALGORITHMS
33
+ def kem_algorithms = KEM_ALGORITHMS
34
+ def algorithm_for(alg_string) = ALGORITHMS_BY_JOSE[alg_string]
35
+ def registered? = @registered == true
47
36
 
48
37
  def register!
49
- registration_monitor.synchronize do
38
+ REGISTRATION_MUTEX.synchronize do
50
39
  return true if registered?
51
40
 
52
41
  SIGNING_ALGORITHMS.each { |algorithm| ::JWT::JWA.register_algorithm(algorithm) }
53
- ensure_akp_jwk_registered!
42
+ ::JWT::JWK.classes << ::JWT::JWK::AKP unless ::JWT::JWK.classes.include?(::JWT::JWK::AKP)
54
43
  @registered = true
55
44
  end
56
45
  true
57
46
  end
58
-
59
- def registered?
60
- @registered == true
61
- end
62
-
63
- private
64
-
65
- def registration_monitor
66
- @registration_monitor ||= Monitor.new
67
- end
68
-
69
- def ensure_akp_jwk_registered!
70
- classes = ::JWT::JWK.classes
71
- classes << ::JWT::JWK::AKP unless classes.include?(::JWT::JWK::AKP)
72
- end
73
47
  end
74
48
  end
75
49
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pq_crypto-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Haydarov
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-05-20 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: pq_crypto
@@ -15,14 +16,14 @@ dependencies:
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
- version: 0.5.3
19
+ version: 0.6.1
19
20
  type: :runtime
20
21
  prerelease: false
21
22
  version_requirements: !ruby/object:Gem::Requirement
22
23
  requirements:
23
24
  - - "~>"
24
25
  - !ruby/object:Gem::Version
25
- version: 0.5.3
26
+ version: 0.6.1
26
27
  - !ruby/object:Gem::Dependency
27
28
  name: jwt
28
29
  requirement: !ruby/object:Gem::Requirement
@@ -83,10 +84,6 @@ files:
83
84
  - LICENSE.txt
84
85
  - README.md
85
86
  - lib/pq_crypto/jwt.rb
86
- - lib/pq_crypto/jwt/algorithms.rb
87
- - lib/pq_crypto/jwt/algorithms/ml_dsa_44.rb
88
- - lib/pq_crypto/jwt/algorithms/ml_dsa_65.rb
89
- - lib/pq_crypto/jwt/algorithms/ml_dsa_87.rb
90
87
  - lib/pq_crypto/jwt/errors.rb
91
88
  - lib/pq_crypto/jwt/jwa.rb
92
89
  - lib/pq_crypto/jwt/jwa/ml_dsa_44.rb
@@ -101,7 +98,11 @@ files:
101
98
  homepage: https://github.com/roman-haidarov/pq_crypto-jwt
102
99
  licenses:
103
100
  - MIT
104
- metadata: {}
101
+ metadata:
102
+ source_code_uri: https://github.com/roman-haidarov/pq_crypto-jwt
103
+ changelog_uri: https://github.com/roman-haidarov/pq_crypto-jwt/blob/v0.2.1/CHANGELOG.md
104
+ bug_tracker_uri: https://github.com/roman-haidarov/pq_crypto-jwt/issues
105
+ post_install_message:
105
106
  rdoc_options: []
106
107
  require_paths:
107
108
  - lib
@@ -116,7 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  requirements: []
119
- rubygems_version: 3.6.7
120
+ rubygems_version: 3.3.27
121
+ signing_key:
120
122
  specification_version: 4
121
123
  summary: ML-DSA JWS algorithms for ruby-jwt backed by pq_crypto
122
124
  test_files: []
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../jwa/ml_dsa_44"
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../jwa/ml_dsa_65"
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../jwa/ml_dsa_87"
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "jwa"