reputable 0.1.5 → 0.1.6

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: 1d8e38d02c6ad20f915ff71f489780dea010d1304132ba5f1946082e023ff797
4
- data.tar.gz: 712a5a0eeadd88a5127a0d9086c57d4566c6074440e93724deaf28186cf0c55d
3
+ metadata.gz: 3c8047e39b4f09d6580aeba68d04e3231c2774b9f0eac1d7c70591b7e45e11df
4
+ data.tar.gz: 14aecba661b4bd57381f496274dfd0185cc7ef1e7332ab71d2ce56d623935cb8
5
5
  SHA512:
6
- metadata.gz: bbffa423a948e82c995e5cce48f93356cb0f44519106872e588637a11678b980a26a6290d59289851130ddba212897172b5aaa343ae6b73ebd7d39e15d8a53ce
7
- data.tar.gz: c18bec4b986c8a83cba202130ee3dcfcc2f999256c36622020768112285309bf1aca4744518ed0edeed5423b4dc538edf86f5c4f2a4dd97112cde6602a09cc8c
6
+ metadata.gz: 34507a4124cca8739008ccf9bc1762226aeef05c994fb861be47bc08eb4e4b06dcad501082750cf56b6f9025b0e1d7596bc057da761bba23c94b583048096425
7
+ data.tar.gz: 67d7c49193f2c2492d49cc34a0e5051f45db49ed98f7d62a7623fc32cfc753f481da5c6ba9a9fba71f624d68cab535334d409b7c74532c102ffd4f29f338e2ba
data/README.md CHANGED
@@ -381,13 +381,20 @@ if suspicious_activity_detected?
381
381
  redirect_url = Reputable.verification_url(
382
382
  return_url: request.original_url, # Where to send them back after verification
383
383
  failure_url: root_url, # Optional: where to send if they fail/garbage token
384
- session_id: session.id # Optional: link specific session
384
+ session_id: session.id, # Optional: link specific session
385
+ force_challenge: false # Optional: if true, always show CAPTCHA (for testing)
385
386
  )
386
387
 
387
388
  redirect_to redirect_url
388
389
  end
389
390
  ```
390
391
 
392
+ **Options:**
393
+ - `return_url` (required): Where to redirect after successful verification
394
+ - `failure_url` (optional): Where to redirect on failure (defaults to return_url)
395
+ - `session_id` (optional): Bind verification to a specific session
396
+ - `force_challenge` (optional): If `true`, always show CAPTCHA even for trusted users. Useful for testing the challenge flow.
397
+
391
398
  ### 2. Handling the Return Redirect
392
399
 
393
400
  When the user passes verification (or is determined to be already trusted/clean), they are immediately redirected back to your `return_url` with signed parameters.
@@ -77,7 +77,7 @@ module Reputable
77
77
  elsif ENV["REPUTABLE_SECRET_KEY"]
78
78
  @trusted_keys = [ENV["REPUTABLE_SECRET_KEY"]]
79
79
  end
80
- @base_url = ENV["REPUTABLE_BASE_URL"]
80
+ @base_url = ENV.fetch("REPUTABLE_BASE_URL", "https://api.reputable.click")
81
81
  end
82
82
 
83
83
  # Alias for backward compatibility
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reputable
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
data/lib/reputable.rb CHANGED
@@ -126,7 +126,12 @@ module Reputable
126
126
  end
127
127
 
128
128
  # Generate a signed verification URL
129
- def verification_url(return_url:, failure_url: nil, session_id: nil)
129
+ # @param return_url [String] URL to redirect to after successful verification
130
+ # @param failure_url [String, nil] URL to redirect to on failure (optional)
131
+ # @param session_id [String, nil] Session ID to bind the verification to (optional)
132
+ # @param force_challenge [Boolean] If true, always show CAPTCHA even for trusted users (default: false)
133
+ # @return [String] The signed verification URL
134
+ def verification_url(return_url:, failure_url: nil, session_id: nil, force_challenge: false)
130
135
  keys = configuration.trusted_keys
131
136
  if keys.nil? || keys.empty?
132
137
  logger&.warn "Reputable: Missing trusted_keys, cannot generate verification URL"
@@ -150,6 +155,7 @@ module Reputable
150
155
  returnUrl: return_url,
151
156
  failureUrl: failure_url,
152
157
  sessionId: session_id,
158
+ forceChallenge: force_challenge,
153
159
  iat: Time.now.to_i
154
160
  }
155
161
  encoded_payload = base64url_encode(JSON.generate(payload))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reputable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reputable
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-12-26 00:00:00.000000000 Z
11
+ date: 2025-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis