wowsql-sdk 3.9.0 → 3.9.1
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 +8 -1
- data/lib/wowsql/auth.rb +23 -10
- 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: 9d46c9cb43ff0d1ff729ee19c2384dec05476d286c4d5fb74041429fd4b5fc09
|
|
4
|
+
data.tar.gz: edb308e3ffa9e0be0ca4d7e7f54639da839c137f7eb52ce2eb977f8c9b7eae3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24d72bdaedce237c50ed1fcd43326d9cb54a013ee541569ae49a1aa422896b10583d04af7c01a8bb512a11044012ea8865ce5a671c8364891dad7ecb36d320e3
|
|
7
|
+
data.tar.gz: 9ff8164572fbf57cb644c83c9345b74d18ba1763e91c49e372980a550854837777e7b1122414e8afea08f7873ad2e1b254f08402f66f8f6b31e25db870e955e6
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ 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
|
|
13
|
+
|
|
14
|
+
|
|
8
15
|
## [3.9.0] - 2026-08-20
|
|
9
16
|
|
|
10
17
|
### Added - Realtime
|
|
@@ -12,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
19
|
- `client.realtime.subscribe` for Postgres `INSERT` / `UPDATE` / `DELETE` (and `*`)
|
|
13
20
|
- WebSocket auth: `wss://<project>/realtime/v1/websocket?apikey=<anon or service_role key>`
|
|
14
21
|
- Auto-reconnect after disconnect; unsubscribe / disconnect clean local and server state
|
|
15
|
-
- `client.realtime.channel(name)`
|
|
22
|
+
- `client.realtime.channel(name)` — ephemeral broadcast (`send`) and presence (`track` / `presence_state`)
|
|
16
23
|
- `websocket-client-simple` dependency
|
|
17
24
|
|
|
18
25
|
### Documentation
|
data/lib/wowsql/auth.rb
CHANGED
|
@@ -242,41 +242,54 @@ module WOWSQL
|
|
|
242
242
|
}
|
|
243
243
|
end
|
|
244
244
|
|
|
245
|
-
# Send OTP
|
|
245
|
+
# Send OTP via email or phone (SMS). Provide exactly one of email or phone.
|
|
246
246
|
#
|
|
247
|
-
# @param email [String] User's email address
|
|
247
|
+
# @param email [String, nil] User's email address
|
|
248
|
+
# @param phone [String, nil] E.164 phone number
|
|
248
249
|
# @param purpose [String] 'login', 'signup', or 'password_reset'
|
|
249
250
|
# @return [Hash]
|
|
250
|
-
def send_otp(email
|
|
251
|
+
def send_otp(email: nil, phone: nil, purpose: 'login')
|
|
251
252
|
unless %w[login signup password_reset].include?(purpose)
|
|
252
253
|
raise WOWSQLError.new("Purpose must be 'login', 'signup', or 'password_reset'")
|
|
253
254
|
end
|
|
255
|
+
if email.to_s.empty? == phone.to_s.empty?
|
|
256
|
+
raise WOWSQLError.new('Provide exactly one of email or phone')
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
payload = { purpose: purpose }
|
|
260
|
+
payload[:email] = email unless email.to_s.empty?
|
|
261
|
+
payload[:phone] = phone unless phone.to_s.empty?
|
|
254
262
|
|
|
255
|
-
payload = { email: email, purpose: purpose }
|
|
256
263
|
data = request('POST', '/otp/send', nil, payload)
|
|
257
264
|
{
|
|
258
265
|
'success' => data['success'] != false,
|
|
259
|
-
'message' => data['message'] || 'If that email exists, an OTP code has been sent'
|
|
266
|
+
'message' => data['message'] || (phone.to_s.empty? ? 'If that email exists, an OTP code has been sent' : 'If that phone exists, an OTP code has been sent')
|
|
260
267
|
}
|
|
261
268
|
end
|
|
262
269
|
|
|
263
|
-
# Verify OTP
|
|
270
|
+
# Verify OTP via email or phone. Provide exactly one of email or phone.
|
|
264
271
|
#
|
|
265
|
-
# @param email [String] User's email address
|
|
266
|
-
# @param
|
|
272
|
+
# @param email [String, nil] User's email address
|
|
273
|
+
# @param phone [String, nil] E.164 phone number
|
|
274
|
+
# @param otp [String] OTP code
|
|
267
275
|
# @param purpose [String] 'login', 'signup', or 'password_reset'
|
|
268
276
|
# @param new_password [String, nil] Required for password_reset purpose
|
|
269
277
|
# @return [AuthResponse, Hash]
|
|
270
|
-
def verify_otp(email
|
|
278
|
+
def verify_otp(email: nil, phone: nil, otp:, purpose: 'login', new_password: nil)
|
|
271
279
|
unless %w[login signup password_reset].include?(purpose)
|
|
272
280
|
raise WOWSQLError.new("Purpose must be 'login', 'signup', or 'password_reset'")
|
|
273
281
|
end
|
|
282
|
+
if email.to_s.empty? == phone.to_s.empty?
|
|
283
|
+
raise WOWSQLError.new('Provide exactly one of email or phone')
|
|
284
|
+
end
|
|
274
285
|
|
|
275
286
|
if purpose == 'password_reset' && new_password.nil?
|
|
276
287
|
raise WOWSQLError.new('new_password is required for password_reset purpose')
|
|
277
288
|
end
|
|
278
289
|
|
|
279
|
-
payload = {
|
|
290
|
+
payload = { otp: otp, purpose: purpose }
|
|
291
|
+
payload[:email] = email unless email.to_s.empty?
|
|
292
|
+
payload[:phone] = phone unless phone.to_s.empty?
|
|
280
293
|
payload[:new_password] = new_password if new_password
|
|
281
294
|
|
|
282
295
|
data = request('POST', '/otp/verify', nil, payload)
|
data/lib/wowsql/version.rb
CHANGED