otp-jwt 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: c2ab72bba26dccf6e9997c1d308817a5b83bff50
4
- data.tar.gz: 2eaad486102257081e36effb3a8952497a2fe6fa
3
+ metadata.gz: 0c54629c5b9a4eeda3f9019ab09ddacc4828530f
4
+ data.tar.gz: dd8eff09d8e026ed05474ab9354912bd23e3fbe0
5
5
  SHA512:
6
- metadata.gz: e5799a46574afae040a12d024f3dec337d231cc2f517dfb29619d8ff5b6d3006018f009d15683d1ef089dc0744a8901bb752b63ddff74bbaa3e1207c2da3b9ef
7
- data.tar.gz: 88e4c2d697960bceb4c3617545461698fb0f474b48e3266120708038f5bc318fce98482f0ac056ce8f936e0e53e496cec4869187c1773acbf9ec68fd42115f8e
6
+ metadata.gz: e40074ff075698128268c9fe3005419490842dc8a32bcc23ebc082080d38e273232f014d4ab75082703ab0fa0d74d2efa46d63cfec605ffd9f72531de4f5d12b
7
+ data.tar.gz: 8d974d37a87403d214d37663e98dd679f00b0912a6f7d7c90dcba2bb72916f9cb0008ba15c7f2c4f3a9c8bb40ebbaffe41fb82f58cf0cd2a4b4973c7cd007530
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- otp-jwt (0.2.1)
4
+ otp-jwt (0.2.2)
5
5
  activesupport
6
6
  jwt (~> 2.2.0.pre.beta.0)
7
7
  rotp (~> 4.1)
@@ -20,6 +20,7 @@ module OTP
20
20
  # @return [String] or nil if no OTP is set
21
21
  def otp
22
22
  return nil if !valid? || !persisted? || otp_secret.blank?
23
+
23
24
  otp_digits = self.class.const_get(:OTP_DIGITS)
24
25
  hotp = ROTP::HOTP.new(otp_secret, digits: otp_digits)
25
26
 
@@ -33,6 +34,8 @@ module OTP
33
34
  #
34
35
  # @return true on success, false on failure
35
36
  def verify_otp(otp)
37
+ return nil if !valid? || !persisted? || otp_secret.blank?
38
+
36
39
  hotp = ROTP::HOTP.new(otp_secret, digits: OTP_DIGITS)
37
40
  transaction do
38
41
  otp_status = hotp.verify(otp.to_s, otp_counter)
@@ -1,5 +1,5 @@
1
1
  module OTP
2
2
  module JWT
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: otp-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Suscov