wowsql-sdk 3.9.1 → 3.9.3

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: 9d46c9cb43ff0d1ff729ee19c2384dec05476d286c4d5fb74041429fd4b5fc09
4
- data.tar.gz: edb308e3ffa9e0be0ca4d7e7f54639da839c137f7eb52ce2eb977f8c9b7eae3b
3
+ metadata.gz: 733ca78817394f358256715fd17bc810bb62d575cd3bac9a8371f6cd080dee3e
4
+ data.tar.gz: f66dcf05b1d189946aec2a2d107572170e7d7aac62864176fa8675d59e01e9e9
5
5
  SHA512:
6
- metadata.gz: 24d72bdaedce237c50ed1fcd43326d9cb54a013ee541569ae49a1aa422896b10583d04af7c01a8bb512a11044012ea8865ce5a671c8364891dad7ecb36d320e3
7
- data.tar.gz: 9ff8164572fbf57cb644c83c9345b74d18ba1763e91c49e372980a550854837777e7b1122414e8afea08f7873ad2e1b254f08402f66f8f6b31e25db870e955e6
6
+ metadata.gz: cb99407286c0edf67ce68faf420c7d2535eca07fc7d597c41d5064afeac5e7a8fb7f42848ea797b979fb83b09686a8714a24bd99f6a6bc7adfc99d5f001684f1
7
+ data.tar.gz: 49c5a291fdacd15bccf7b17f0a4dfc7f639d32275605ec2e91a38e53e2df0b44e65290aedc6adcbf472b46ad83c603a8ffef71d70c551b3199b65ef9da9d1ca0
data/CHANGELOG.md CHANGED
@@ -5,11 +5,22 @@ All notable changes to the WowSQL Ruby SDK will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [3.9.1] - 2026-10-07
9
-
10
- ### Added - Phone OTP (SMS)
11
- - `sendOtp` / `verifyOtp` (and language equivalents) accept either **email** or **phone** (exactly one)
12
- - Existing email OTP call sites remain backward compatible
8
+ ## [3.9.3] - 2026-10-10
9
+
10
+ ### Docs - CAPTCHA bring-your-own widget
11
+ - README: create a Cloudflare Turnstile widget for your app domain and paste site key + secret in Attack Protection. WoWSQL does not provide a shared widget. `GET /auth/v1/settings` returns your `captcha.site_key`.
12
+
13
+ ## [3.9.2] - 2026-10-10
14
+
15
+ ### Added - Optional Turnstile captcha
16
+ - Optional captcha token on signup, login, forgot password, OTP send, magic link, and resend verification
17
+ - Existing calls without a token remain unchanged
18
+
19
+ ## [3.9.1] - 2026-10-07
20
+
21
+ ### Added - Phone OTP (SMS)
22
+ - `sendOtp` / `verifyOtp` (and language equivalents) accept either **email** or **phone** (exactly one)
23
+ - Existing email OTP call sites remain backward compatible
13
24
 
14
25
 
15
26
  ## [3.9.0] - 2026-08-20
data/README.md CHANGED
@@ -406,6 +406,21 @@ puts response.session.access_token
406
406
  puts response.session.refresh_token
407
407
  ```
408
408
 
409
+ ### CAPTCHA (Turnstile)
410
+
411
+ Optional. Only required when dashboard **Attack Protection → Turnstile** is enabled.
412
+
413
+ Create a Cloudflare Turnstile widget for **your** app domain at [dash.cloudflare.com/turnstile](https://dash.cloudflare.com/turnstile) and paste the **site key** and **secret** in Attack Protection. WoWSQL does not provide a shared widget — each project must use its own keys bound to that hostname. `GET /auth/v1/settings` returns your `captcha.site_key`. Render Turnstile with that key, then pass the token. Omit it when captcha is off — existing calls without `captcha_token` are unchanged.
414
+
415
+ ```ruby
416
+ auth.sign_up(email: "alice@example.com", password: "SecurePass123!", captcha_token: turnstile_token)
417
+ auth.sign_in(email: "alice@example.com", password: "SecurePass123!", captcha_token: turnstile_token)
418
+ auth.forgot_password(email: "alice@example.com", captcha_token: turnstile_token)
419
+ auth.send_otp(email: "alice@example.com", captcha_token: turnstile_token)
420
+ auth.send_magic_link(email: "alice@example.com", captcha_token: turnstile_token)
421
+ auth.resend_verification(email: "alice@example.com", captcha_token: turnstile_token)
422
+ ```
423
+
409
424
  ### get_user
410
425
 
411
426
  ```ruby
data/lib/wowsql/auth.rb CHANGED
@@ -126,10 +126,11 @@ module WOWSQL
126
126
  # @param full_name [String, nil] Optional full name
127
127
  # @param user_metadata [Hash, nil] Optional user metadata
128
128
  # @return [AuthResponse]
129
- def sign_up(email:, password:, full_name: nil, user_metadata: nil)
129
+ def sign_up(email:, password:, full_name: nil, user_metadata: nil, captcha_token: nil)
130
130
  payload = { email: email, password: password }
131
131
  payload[:full_name] = full_name if full_name
132
132
  payload[:user_metadata] = user_metadata if user_metadata
133
+ payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
133
134
 
134
135
  data = request('POST', '/signup', nil, payload)
135
136
  session = persist_session(data)
@@ -142,8 +143,9 @@ module WOWSQL
142
143
  # @param email [String] User email
143
144
  # @param password [String] User password
144
145
  # @return [AuthResponse]
145
- def sign_in(email:, password:)
146
+ def sign_in(email:, password:, captcha_token: nil)
146
147
  payload = { email: email, password: password }
148
+ payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
147
149
  data = request('POST', '/login', nil, payload)
148
150
  session = persist_session(data)
149
151
  AuthResponse.new(session: session, user: nil)
@@ -219,8 +221,9 @@ module WOWSQL
219
221
  #
220
222
  # @param email [String] User's email address
221
223
  # @return [Hash]
222
- def forgot_password(email:)
224
+ def forgot_password(email:, captcha_token: nil)
223
225
  payload = { email: email }
226
+ payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
224
227
  data = request('POST', '/forgot-password', nil, payload)
225
228
  {
226
229
  'success' => data['success'] != false,
@@ -248,7 +251,7 @@ module WOWSQL
248
251
  # @param phone [String, nil] E.164 phone number
249
252
  # @param purpose [String] 'login', 'signup', or 'password_reset'
250
253
  # @return [Hash]
251
- def send_otp(email: nil, phone: nil, purpose: 'login')
254
+ def send_otp(email: nil, phone: nil, purpose: 'login', captcha_token: nil)
252
255
  unless %w[login signup password_reset].include?(purpose)
253
256
  raise WOWSQLError.new("Purpose must be 'login', 'signup', or 'password_reset'")
254
257
  end
@@ -259,6 +262,7 @@ module WOWSQL
259
262
  payload = { purpose: purpose }
260
263
  payload[:email] = email unless email.to_s.empty?
261
264
  payload[:phone] = phone unless phone.to_s.empty?
265
+ payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
262
266
 
263
267
  data = request('POST', '/otp/send', nil, payload)
264
268
  {
@@ -311,12 +315,13 @@ module WOWSQL
311
315
  # @param email [String] User's email address
312
316
  # @param purpose [String] 'login', 'signup', or 'email_verification'
313
317
  # @return [Hash]
314
- def send_magic_link(email:, purpose: 'login')
318
+ def send_magic_link(email:, purpose: 'login', captcha_token: nil)
315
319
  unless %w[login signup email_verification].include?(purpose)
316
320
  raise WOWSQLError.new("Purpose must be 'login', 'signup', or 'email_verification'")
317
321
  end
318
322
 
319
323
  payload = { email: email, purpose: purpose }
324
+ payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
320
325
  data = request('POST', '/magic-link/send', nil, payload)
321
326
  {
322
327
  'success' => data['success'] != false,
@@ -342,8 +347,9 @@ module WOWSQL
342
347
  #
343
348
  # @param email [String] User's email address
344
349
  # @return [Hash]
345
- def resend_verification(email:)
350
+ def resend_verification(email:, captcha_token: nil)
346
351
  payload = { email: email }
352
+ payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
347
353
  data = request('POST', '/resend-verification', nil, payload)
348
354
  {
349
355
  'success' => data['success'] != false,
@@ -1,4 +1,4 @@
1
1
  module WOWSQL
2
- VERSION = "3.9.1"
2
+ VERSION = "3.9.3"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wowsql-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.1
4
+ version: 3.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - WOWSQL Team