wowsql-sdk 3.9.2 → 3.10.0
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +3 -4
- data/lib/wowsql/auth.rb +48 -5
- data/lib/wowsql/client.rb +1 -0
- data/lib/wowsql/schema.rb +1 -0
- data/lib/wowsql/storage.rb +2 -1
- data/lib/wowsql/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f82d49575289a354df9f59f3aad8c78f8bba8fd5e27f600e598e1fc6fa873bb4
|
|
4
|
+
data.tar.gz: 2b6674f1ddc575cc348e2c46ed7b9caadeccc3e902aa54f34b751d6b7c9f9773
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: deae84274b76b8881975b657de53a6841be12719ed04af9bc3aecf5c87b1e3ab4f87509ac6b1e7b8d9af54971ebcc5864bd9192bda8882eac502d7e962ba62d7
|
|
7
|
+
data.tar.gz: aa60076d325d857bc62781d5fde34b7edcfdf51705083360b348a07a491b634b0bf419dafb34d91c90f3d59fc59afda359f9be903954ccf91957449498b6a49e
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to the WowSQL Ruby SDK will be documented in this file.
|
|
|
4
4
|
|
|
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
|
+
|
|
8
|
+
## [3.10.0] - 2026-10-18
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Send `apikey` on database, auth, and storage calls (Bearer-only keys were 401 on project hosts).
|
|
12
|
+
- Session refresh uses `POST /refresh-token`.
|
|
13
|
+
- Storage public URLs use `/storage/v1/object/public/{bucket}/{path}`.
|
|
14
|
+
- Upload folder is the `folder` query parameter.
|
|
15
|
+
- Login replies with `requires_2fa` no longer store empty sessions.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- TOTP 2FA: status, setup, enable, disable, recovery codes, and `verifyTwoFactorLogin`.
|
|
19
|
+
|
|
20
|
+
## [3.9.3] - 2026-10-10
|
|
21
|
+
|
|
22
|
+
### Docs - CAPTCHA bring-your-own widget
|
|
23
|
+
- 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`.
|
|
7
24
|
|
|
8
25
|
## [3.9.2] - 2026-10-10
|
|
9
26
|
|
data/README.md
CHANGED
|
@@ -408,12 +408,11 @@ puts response.session.refresh_token
|
|
|
408
408
|
|
|
409
409
|
### CAPTCHA (Turnstile)
|
|
410
410
|
|
|
411
|
-
Optional. Only required when Attack Protection → Turnstile is enabled.
|
|
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.
|
|
412
414
|
|
|
413
415
|
```ruby
|
|
414
|
-
# 1. GET /auth/v1/settings → captcha.site_key
|
|
415
|
-
# 2. Render Cloudflare Turnstile with that site key
|
|
416
|
-
# 3. Pass the token:
|
|
417
416
|
auth.sign_up(email: "alice@example.com", password: "SecurePass123!", captcha_token: turnstile_token)
|
|
418
417
|
auth.sign_in(email: "alice@example.com", password: "SecurePass123!", captcha_token: turnstile_token)
|
|
419
418
|
auth.forgot_password(email: "alice@example.com", captcha_token: turnstile_token)
|
data/lib/wowsql/auth.rb
CHANGED
|
@@ -27,11 +27,7 @@ module WOWSQL
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# Response for signup/login requests.
|
|
30
|
-
AuthResponse = Struct.new(:session, :user, keyword_init: true)
|
|
31
|
-
def initialize(session:, user: nil)
|
|
32
|
-
super
|
|
33
|
-
end
|
|
34
|
-
end
|
|
30
|
+
AuthResponse = Struct.new(:session, :user, :requires_2fa, :pending_token, :method, :email, keyword_init: true)
|
|
35
31
|
|
|
36
32
|
# Interface for persisting tokens.
|
|
37
33
|
module TokenStorage
|
|
@@ -115,6 +111,7 @@ module WOWSQL
|
|
|
115
111
|
f.options.timeout = timeout
|
|
116
112
|
end
|
|
117
113
|
|
|
114
|
+
@conn.headers['apikey'] = api_key
|
|
118
115
|
@conn.headers['Authorization'] = "Bearer #{api_key}"
|
|
119
116
|
@conn.headers['Content-Type'] = 'application/json'
|
|
120
117
|
end
|
|
@@ -147,6 +144,14 @@ module WOWSQL
|
|
|
147
144
|
payload = { email: email, password: password }
|
|
148
145
|
payload[:captcha_token] = captcha_token if captcha_token && !captcha_token.to_s.empty?
|
|
149
146
|
data = request('POST', '/login', nil, payload)
|
|
147
|
+
if data['requires_2fa']
|
|
148
|
+
return AuthResponse.new(
|
|
149
|
+
requires_2fa: true,
|
|
150
|
+
pending_token: data['pending_token'] || data['temp_token'],
|
|
151
|
+
method: data['method'],
|
|
152
|
+
email: data['email']
|
|
153
|
+
)
|
|
154
|
+
end
|
|
150
155
|
session = persist_session(data)
|
|
151
156
|
AuthResponse.new(session: session, user: nil)
|
|
152
157
|
end
|
|
@@ -496,7 +501,45 @@ module WOWSQL
|
|
|
496
501
|
}
|
|
497
502
|
end
|
|
498
503
|
|
|
504
|
+
def verify_two_factor_login(pending_token, code: nil, backup_code: nil)
|
|
505
|
+
payload = { pending_token: pending_token, temp_token: pending_token }
|
|
506
|
+
payload[:code] = code if code
|
|
507
|
+
payload[:backup_code] = backup_code if backup_code
|
|
508
|
+
data = request('POST', '/2fa/verify-login', nil, payload)
|
|
509
|
+
session = persist_session(data)
|
|
510
|
+
AuthResponse.new(session: session)
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
def get_two_factor_status(access_token: nil)
|
|
514
|
+
token = access_token || @access_token || @storage.get_access_token
|
|
515
|
+
request_with_headers('GET', '/2fa/status', nil, nil, 'Authorization' => "Bearer #{token}")
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
def setup_totp(access_token: nil)
|
|
519
|
+
token = access_token || @access_token || @storage.get_access_token
|
|
520
|
+
request_with_headers('POST', '/2fa/setup-totp', nil, {}, 'Authorization' => "Bearer #{token}")
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
def enable_totp(code, access_token: nil)
|
|
524
|
+
token = access_token || @access_token || @storage.get_access_token
|
|
525
|
+
request_with_headers('POST', '/2fa/verify-and-enable', nil, { code: code, method: 'totp' }, 'Authorization' => "Bearer #{token}")
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
def disable_totp(code: nil, backup_code: nil, access_token: nil)
|
|
529
|
+
token = access_token || @access_token || @storage.get_access_token
|
|
530
|
+
payload = { method: 'totp' }
|
|
531
|
+
payload[:code] = code if code
|
|
532
|
+
payload[:backup_code] = backup_code if backup_code
|
|
533
|
+
request_with_headers('POST', '/2fa/disable', nil, payload, 'Authorization' => "Bearer #{token}")
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
def regenerate_recovery_codes(code, access_token: nil)
|
|
537
|
+
token = access_token || @access_token || @storage.get_access_token
|
|
538
|
+
request_with_headers('POST', '/2fa/recovery-codes', nil, { code: code, method: 'totp' }, 'Authorization' => "Bearer #{token}")
|
|
539
|
+
end
|
|
540
|
+
|
|
499
541
|
def persist_session(data)
|
|
542
|
+
raise WOWSQLError.new('Invalid session response') unless data['access_token'] || data[:access_token]
|
|
500
543
|
session = AuthSession.new(
|
|
501
544
|
access_token: data['access_token'] || data[:access_token] || '',
|
|
502
545
|
refresh_token: data['refresh_token'] || data[:refresh_token] || '',
|
data/lib/wowsql/client.rb
CHANGED
data/lib/wowsql/schema.rb
CHANGED
data/lib/wowsql/storage.rb
CHANGED
|
@@ -140,6 +140,7 @@ module WOWSQL
|
|
|
140
140
|
f.options.timeout = timeout
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
+
@conn.headers['apikey'] = api_key
|
|
143
144
|
@conn.headers['Authorization'] = "Bearer #{api_key}"
|
|
144
145
|
end
|
|
145
146
|
|
|
@@ -318,7 +319,7 @@ module WOWSQL
|
|
|
318
319
|
# @param file_path [String] File path within bucket
|
|
319
320
|
# @return [String]
|
|
320
321
|
def get_public_url(bucket_name, file_path)
|
|
321
|
-
"#{@base_url}/
|
|
322
|
+
"#{@base_url}/storage/v1/object/public/#{bucket_name}/#{file_path}"
|
|
322
323
|
end
|
|
323
324
|
|
|
324
325
|
# Get storage statistics for the project.
|
data/lib/wowsql/version.rb
CHANGED