keypairs 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/keypair.rb +6 -3
- data/lib/keypairs/version.rb +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: b27173f10b5fa527f4bc1c1ea863ee154735fa91afd45b0b050fc07e30d3d4c1
|
4
|
+
data.tar.gz: 471a038be596fec5dcac92e16923fde534348288abd000c9a235178244dff4ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7da952c440fb88a52457fa801ac78ea318cdccd7514b44187f5fd7701c36d72e83dbbc6c436789b9fb029680b6c1b4f9197c69bcca7449b74bdc09b00ded9d94
|
7
|
+
data.tar.gz: 8bb70edb0ea21824d99841414f3b02bfa467f5e420c3fb7ae1ca61ee593a491123ea7826f455f549beb42f8408399d78afb15a227a399f298f5e8d41ebae15b3
|
data/lib/keypair.rb
CHANGED
@@ -57,7 +57,10 @@ class Keypair < ActiveRecord::Base
|
|
57
57
|
|
58
58
|
# @return [Keypair] the keypair used to sign messages and autorotates if it has expired.
|
59
59
|
def self.current
|
60
|
-
order(not_before: :asc)
|
60
|
+
order(not_before: :asc)
|
61
|
+
.where(arel_table[:not_before].lteq(Time.zone.now))
|
62
|
+
.where(arel_table[:not_after].gteq(Time.zone.now))
|
63
|
+
.last || create!
|
61
64
|
end
|
62
65
|
|
63
66
|
# The JWK Set of our valid keypairs.
|
@@ -83,9 +86,9 @@ class Keypair < ActiveRecord::Base
|
|
83
86
|
#
|
84
87
|
# @see https://www.imsglobal.org/spec/security/v1p0/#h_key-set-url
|
85
88
|
def self.keyset
|
86
|
-
valid_keys = valid.order(
|
89
|
+
valid_keys = valid.order(not_before: :asc).to_a
|
87
90
|
# If we don't have any keys or if we don't have a future key (i.e. the last key is the current key)
|
88
|
-
|
91
|
+
while valid_keys.last.nil? || valid_keys.last.not_before <= Time.zone.now
|
89
92
|
# There is an automatic fallback to Time.zone.now if not_before is not set
|
90
93
|
valid_keys << create!(not_before: valid_keys.last&.not_after)
|
91
94
|
end
|
data/lib/keypairs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keypairs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stef Schenkelaars
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -250,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
250
|
requirements:
|
251
251
|
- - ">="
|
252
252
|
- !ruby/object:Gem::Version
|
253
|
-
version: 2.
|
253
|
+
version: 2.6.0
|
254
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
255
255
|
requirements:
|
256
256
|
- - ">="
|