xposedornot 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5913b4a74ceb4c8a63d0c5e5688ec00974f773ceae4ea8b93035fdcf50f9021e
4
- data.tar.gz: e1235816258dd740400ac6ff8ddb77834e8a0226df56ad531b94beebe0e0d677
3
+ metadata.gz: 6f9cdb8cf4574407c468bb74827549048bf41754f4278c8987546b374b3a708c
4
+ data.tar.gz: fe1dd67cd895457cb38191ecde0c7a4c6eb350598137ef3c69c1aaca44304472
5
5
  SHA512:
6
- metadata.gz: c732cedf2d9f071f2f0d5b663d13e3d3e2b209ca3fa5558deec0690bdd41a4c98899cc3c3b393441c7d22c76b1a9e8fe37329fbbe36c46eecd529c14d0f57e55
7
- data.tar.gz: 00afa3164bdb922a1bffda624afba709c6ae3c826ee52a6e84190ba64de687dc6912ced8a88ccce827e2b259c213fec95f8588e3a1d9113f3cd63da39d148756
6
+ metadata.gz: ed2b79e6fb0b032718c143c988ecb788c3718f1ce0f6b60f5fb9a38635ec3f019cb0d78e898f5020b9d8b18db3c64a4cf0ef874e82c3aae475ab1aa36d42ed02
7
+ data.tar.gz: 589c001faa755f628a0c02c4b47120ec33eb7fa1082a7d69c63f42f23c57c51fbb25f012fb994e49a96cded660a955da678d789d17ca72cefb3834c306ee915d
@@ -44,6 +44,9 @@ module XposedOrNot
44
44
  def check_email_free(email)
45
45
  response = request(:get, "/v1/check-email/#{URI.encode_www_form_component(email)}", base: :free)
46
46
  Models::EmailBreachResponse.new(response)
47
+ rescue NotFoundError
48
+ # 404 means email not found in any breaches — valid result
49
+ Models::EmailBreachResponse.new({})
47
50
  end
48
51
 
49
52
  # @param email [String]
@@ -17,8 +17,13 @@ module XposedOrNot
17
17
  Utils.validate_password(password)
18
18
 
19
19
  hash_prefix = Utils.keccak_hash_prefix(password)
20
- response = request(:get, "/v1/pass/anon/#{hash_prefix}", base: :passwords)
21
- Models::PasswordCheckResponse.new(response)
20
+ begin
21
+ response = request(:get, "v1/pass/anon/#{hash_prefix}", base: :passwords)
22
+ Models::PasswordCheckResponse.new(response)
23
+ rescue NotFoundError
24
+ # 404 means password hash prefix not found — password is not exposed
25
+ Models::PasswordCheckResponse.not_found(hash_prefix)
26
+ end
22
27
  end
23
28
  end
24
29
  end
@@ -21,6 +21,13 @@ module XposedOrNot
21
21
  @count = (search["count"] || "0").to_i
22
22
  end
23
23
 
24
+ # Build a not-found response (password is clean).
25
+ # @param hash_prefix [String]
26
+ # @return [PasswordCheckResponse]
27
+ def self.not_found(hash_prefix)
28
+ new({"SearchPassAnon" => {"anon" => hash_prefix, "char" => "", "count" => "0"}})
29
+ end
30
+
24
31
  # @return [Boolean] true if the password has been exposed
25
32
  def exposed?
26
33
  @count.positive?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module XposedOrNot
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xposedornot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - XposedOrNot