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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b147b6ede46b3ddb570fcf22a695d6cf4cb1b9d1ccba3f5b7f8afdd9419e0747
4
- data.tar.gz: ebe56e66f398850c478b73ec5ee7cab7ff37ed660df886b5e01d43f2f154bf4e
3
+ metadata.gz: b27173f10b5fa527f4bc1c1ea863ee154735fa91afd45b0b050fc07e30d3d4c1
4
+ data.tar.gz: 471a038be596fec5dcac92e16923fde534348288abd000c9a235178244dff4ee
5
5
  SHA512:
6
- metadata.gz: 7a8c50b775aeb0786f43489f1ddc9fc9196071ce7f87d36fff7db7bc9eba63b08ea3b5c1ef97798904b3205bc3e7f9b511fed322e84227a98a5712cd863be797
7
- data.tar.gz: b0b30cc23347d5a4c0d0add46ac6944cb1881a75aebd2577db470742e81b72613b6808bd63d36385897e4a304c328adbafe7ef196cb495fdab919defc1626410
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).where(arel_table[:not_before].lteq(Time.zone.now)).where(arel_table[:not_after].gteq(Time.zone.now)).last || create!
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(expires_at: :asc).to_a
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
- if valid_keys.last.nil? || valid_keys.last.not_before <= Time.zone.now
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Keypairs
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
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.0.0
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: 2020-11-17 00:00:00.000000000 Z
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.5.0
253
+ version: 2.6.0
254
254
  required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  requirements:
256
256
  - - ">="