reputable 0.1.3 → 0.1.4

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: ca78832e420ad0cacad0c44bbfbf2a682f1b9f702bbaf8aa07a44e4e04d7d53b
4
- data.tar.gz: 9e15f534984a4e3d67560a98cbede0c596d02d30fb7f7171b380b043b0781384
3
+ metadata.gz: 0c39e960378d885e97cac40ebc6147ea8f41bc9276a24e341011edd7590090b9
4
+ data.tar.gz: '09a3302c4e84261dd2b6941d87747297d37aa6458bc23fdd181d05fe715124be'
5
5
  SHA512:
6
- metadata.gz: 23832e31d409bb3316c33c931e6207f24eb2ea078c2fa79d3d0c4618e4ffd3359f525d0c6b090344bb5d8e79cf9fdc714752ae09180ce973dd353d93015afb6c
7
- data.tar.gz: 9eb4a989b111a493e7555672057946c2928251a1112e7b75e011bf7183c329ee3b9c6c6cb0e34a163d3803cb5956321b443b25f2d9fcbfca5c90ad16b73cd766
6
+ metadata.gz: aa66be8227fbe97f9b270ec901642c397f59ec9cd39e6a8dc16dcfe7ab8d09c3b7ce7984d3ddf66d00a74d319a3b05fa8167b8b1a45fca6c1da84a20917c80f3
7
+ data.tar.gz: 36166971d3eec60a629a03992968381d57f7b52b3cd43f8c9876ebbf99528e4ed4fe6370b1c41abdb904c7100d970b7e58d032228f4c7c22187c283466d1e0bf
data/README.md CHANGED
@@ -138,7 +138,7 @@ Reputable.configure do |config|
138
138
  # Verification Configuration
139
139
  # Supports comma-separated list in REPUTABLE_TRUSTED_KEYS or single key in REPUTABLE_TRUSTED_KEY
140
140
  config.trusted_keys = ENV['REPUTABLE_TRUSTED_KEYS']&.split(',') || ENV['REPUTABLE_TRUSTED_KEY']
141
- config.verification_base_url = ENV['REPUTABLE_VERIFY_URL'] # URL of your Reputable API verify endpoint
141
+ config.verification_base_url = ENV['REPUTABLE_VERIFY_URL'] # Base URL of your Reputable API (e.g., https://dev-new-1.verify.reputable.click)
142
142
 
143
143
  # Error callback (optional)
144
144
  config.on_error = ->(error, context) {
@@ -73,7 +73,7 @@ module Reputable
73
73
  elsif ENV["REPUTABLE_SECRET_KEY"]
74
74
  @trusted_keys = [ENV["REPUTABLE_SECRET_KEY"]]
75
75
  end
76
- @verification_base_url = ENV.fetch("REPUTABLE_VERIFY_URL", "https://api.reputable.click/_reputable/verify")
76
+ @verification_base_url = ENV.fetch("REPUTABLE_VERIFY_URL", "https://api.reputable.click")
77
77
  end
78
78
 
79
79
  # Alias for backward compatibility
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reputable
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/reputable.rb CHANGED
@@ -130,18 +130,21 @@ module Reputable
130
130
  keys = configuration.trusted_keys
131
131
  if keys.nil? || keys.empty?
132
132
  logger&.warn "Reputable: Missing trusted_keys, cannot generate verification URL"
133
- return return_url
133
+ return return_url
134
134
  end
135
-
135
+
136
136
  # Use the first key for signing new requests
137
137
  secret = keys.first
138
-
138
+
139
139
  base_url = configuration.verification_base_url
140
-
140
+ # Ensure base_url doesn't have a trailing slash, then append the verify path
141
+ base_url = base_url.chomp("/")
142
+ verify_url = "#{base_url}/_reputable/verify"
143
+
141
144
  # JWT Header
142
145
  header = { alg: "HS256", typ: "JWT" }
143
146
  encoded_header = base64url_encode(JSON.generate(header))
144
-
147
+
145
148
  # JWT Payload
146
149
  payload = {
147
150
  returnUrl: return_url,
@@ -150,15 +153,15 @@ module Reputable
150
153
  iat: Time.now.to_i
151
154
  }
152
155
  encoded_payload = base64url_encode(JSON.generate(payload))
153
-
156
+
154
157
  # Signature
155
158
  data = "#{encoded_header}.#{encoded_payload}"
156
159
  signature = OpenSSL::HMAC.digest("SHA256", secret, data)
157
160
  encoded_signature = base64url_encode(signature)
158
-
161
+
159
162
  token = "#{data}.#{encoded_signature}"
160
-
161
- "#{base_url}?token=#{token}"
163
+
164
+ "#{verify_url}?token=#{token}"
162
165
  end
163
166
 
164
167
  # Verify the signature of a redirect return
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reputable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reputable