safety_net_attestation 0.3.0 → 0.4.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: 6ccbadd15213737c97c7380d54fbf0b742f33aec05897ae6e7c2f51fe114f487
4
- data.tar.gz: e0fe5abd1f16f7b084b53431108defbc1d534d8061ec7d0363674b0ad207fd08
3
+ metadata.gz: 5116645ce8afe8172658cd294571bb6cef9921579f86ca8b8b8e9cb9d44620d4
4
+ data.tar.gz: 9cbf7c06202bc80ffa7e2f151c354f3a89ab75048cec8b064096840ece5a68e7
5
5
  SHA512:
6
- metadata.gz: d2f0413cb1b611f2bb0319da23002edb5f695119badb401fdef6af4e225e9a5cd778af31e0cf4af4ab228fca8c322763eb806d35ef21fa29cd7080edddbc318c
7
- data.tar.gz: 6327628183000d2110361284af325cc210f7d45da9af7da755cde2b108e9ac4858e40b6028b71f46c864be58b3bb72736dab8a5cf0bdc1f1a6235745f44b187b
6
+ metadata.gz: 359e37de75eebdf4198e79996f15ab7cc5d24e34cd664e34136b8a0d6f385729b696f541c40ca4dce14f2f2848082ef4ad4779d0a3c97386b91e291c1913339a
7
+ data.tar.gz: d2467423824192b293507131a2957e512a9c412ed762c6444359d1605edfe3f3cb837ed167245994d367ba2b37774cfac112018e1a998c39298d06ef279e51bb
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.0] - 2019-12-29
10
+ ### Fixed
11
+ - Root certificate loading when this gem is used as a dependency
12
+
13
+ ### Changed
14
+ - Rename `Statement#certificates` to `Statement#certificate_chain`
15
+
9
16
  ## [0.3.0] - 2019-12-29
10
17
  ### Added
11
18
  - `Statement#certificates` exposes the certificate chain used during verification
@@ -21,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
28
  - Extracted from [webauthn-ruby](https://github.com/cedarcode/webauthn-ruby) after discussion with the maintainers. Thanks for the feedback @grzuy and @brauliomartinezlm!
22
29
 
23
30
  [Unreleased]: https://github.com/bdewater/safety_net_attestation/compare/v0.1.0...HEAD
31
+ [0.4.0]: https://github.com/bdewater/safety_net_attestation/compare/v0.3.0...v0.4.0
24
32
  [0.3.0]: https://github.com/bdewater/safety_net_attestation/compare/v0.2.0...v0.3.0
25
33
  [0.2.0]: https://github.com/bdewater/safety_net_attestation/compare/v0.1.0...v0.2.0
26
34
  [0.1.0]: https://github.com/bdewater/safety_net_attestation/releases/tag/v0.1.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- safety_net_attestation (0.3.0)
4
+ safety_net_attestation (0.4.0)
5
5
  jwt (~> 2.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "safety_net_attestation/statement"
4
- require_relative "safety_net_attestation/version"
5
-
6
3
  module SafetyNetAttestation
4
+ GEM_ROOT = File.expand_path(__dir__)
7
5
  end
6
+
7
+ require_relative "safety_net_attestation/statement"
8
+ require_relative "safety_net_attestation/version"
@@ -10,7 +10,7 @@ require_relative "x5c_key_finder"
10
10
  module SafetyNetAttestation
11
11
  class Statement
12
12
  GOOGLE_ROOT_CERTIFICATES = Dir.glob(
13
- File.join(Dir.getwd, "lib", "safety_net_attestation", "certificates", "*.*")
13
+ File.join(SafetyNetAttestation::GEM_ROOT, "safety_net_attestation", "certificates", "*.*")
14
14
  ).map do |path|
15
15
  file = File.binread(path)
16
16
  OpenSSL::X509::Certificate.new(file)
@@ -25,22 +25,22 @@ module SafetyNetAttestation
25
25
  end
26
26
 
27
27
  def verify(nonce, timestamp_leeway: 60, trusted_certificates: GOOGLE_ROOT_CERTIFICATES, time: Time.now)
28
- certificates = nil
28
+ certificate_chain = nil
29
29
  response, _ = JWT.decode(@jws_result, nil, true, algorithms: ["ES256", "RS256"]) do |headers|
30
30
  x5c_certificates = headers["x5c"].map do |encoded|
31
31
  OpenSSL::X509::Certificate.new(Base64.strict_decode64(encoded))
32
32
  end
33
33
 
34
- certificates = X5cKeyFinder.from(x5c_certificates, trusted_certificates, time: time)
35
- certificates.first.public_key
34
+ certificate_chain = X5cKeyFinder.from(x5c_certificates, trusted_certificates, time: time)
35
+ certificate_chain.first.public_key
36
36
  end
37
37
 
38
- verify_certificate_subject(certificates.first)
38
+ verify_certificate_subject(certificate_chain.first)
39
39
  verify_nonce(response, nonce)
40
40
  verify_timestamp(response, timestamp_leeway, time)
41
41
 
42
42
  @json = response
43
- @certificates = certificates
43
+ @certificate_chain = certificate_chain
44
44
  self
45
45
  end
46
46
 
@@ -80,10 +80,10 @@ module SafetyNetAttestation
80
80
  json["advice"]&.split(",")
81
81
  end
82
82
 
83
- def certificates
83
+ def certificate_chain
84
84
  raise NotVerifiedError unless json
85
85
 
86
- @certificates
86
+ @certificate_chain
87
87
  end
88
88
 
89
89
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SafetyNetAttestation
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safety_net_attestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart de Water
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-29 00:00:00.000000000 Z
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt