aurabase 0.1.1

Official Rust SDK for Aurabase: high-performance open-source Backend-as-a-Service (BaaS)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
use crate::error::AuraError;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

// ---- Generic response wrapper ---------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Meta {
    pub total: Option<u64>,
    pub next_cursor: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuraResponse<T> {
    pub data: Option<T>,
    pub error: Option<AuraError>,
    pub meta: Option<Meta>,
}

// ---- Auth -----------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct User {
    pub id: String,
    pub email: Option<String>,
    pub phone: Option<String>,
    pub role: String,
    pub email_verified: bool,
    pub is_banned: bool,
    pub is_anonymous: bool,
    pub mfa_enabled: bool,
    pub avatar_url: Option<String>,
    pub user_metadata: HashMap<String, serde_json::Value>,
    pub app_metadata: HashMap<String, serde_json::Value>,
    pub created_at: String,
    pub last_sign_in_at: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TokenPair {
    pub access_token: String,
    pub refresh_token: String,
    pub token_type: String,
    pub expires_in: u64,
    pub user: User,
    pub provider_token: Option<String>,
    pub provider_refresh_token: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MfaChallenge {
    pub mfa_required: bool,
    pub mfa_token: String,
    pub mfa_setup_required: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum LoginResponse {
    TokenPair(Box<TokenPair>),
    MfaChallenge(MfaChallenge),
}

impl LoginResponse {
    pub fn is_mfa_challenge(&self) -> bool {
        match self {
            LoginResponse::MfaChallenge(_) => true,
            LoginResponse::TokenPair(_) => false,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum AuthEvent {
    #[serde(rename = "SIGNED_IN")]
    SignedIn,
    #[serde(rename = "SIGNED_OUT")]
    SignedOut,
    #[serde(rename = "TOKEN_REFRESHED")]
    TokenRefreshed,
    #[serde(rename = "MFA_CHALLENGE")]
    MfaChallenge,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthChangePayload {
    pub event: AuthEvent,
    pub user: Option<User>,
    pub access_token: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SignUpRequest {
    pub email: String,
    pub password: String,
    pub captcha_token: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SignInRequest {
    pub email: String,
    pub password: String,
    pub captcha_token: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MagicLinkRequest {
    pub email: String,
    pub redirect_url: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct OAuthSignInOptions {
    pub redirect_to: Option<String>,
    pub scopes: Option<String>,
    pub query_params: Option<HashMap<String, String>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PasswordResetRequest {
    pub email: String,
    pub redirect_to: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct UpdateUserRequest {
    pub email: Option<String>,
    pub phone: Option<String>,
    pub password: Option<String>,
    pub current_password: Option<String>,
    pub data: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MfaEnrollResponse {
    pub otpauth_url: String,
    pub secret: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MfaVerifyRequest {
    pub mfa_token: String,
    pub code: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SessionInfo {
    pub id: String,
    pub device_info: Option<String>,
    pub ip_address: Option<String>,
    pub created_at: String,
    pub expires_at: String,
    pub last_used_at: String,
    pub is_current: bool,
}

// ---- Database / Query -----------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SchemaColumn {
    pub name: String,
    pub data_type: String,
    pub is_nullable: bool,
    pub default_value: Option<String>,
    pub is_primary_key: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SchemaTable {
    pub name: String,
    pub columns: Vec<SchemaColumn>,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum CountMode {
    Exact,
    Estimated,
}

// ---- Storage --------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StorageBucket {
    pub id: String,
    pub name: String,
    pub public: bool,
    pub file_size_limit: Option<u64>,
    pub allowed_mime_types: Option<Vec<String>>,
    pub created_at: String,
    pub updated_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UploadResult {
    pub key: String,
    pub url: String,
    pub size: u64,
    #[serde(alias = "content_type")]
    pub mime_type: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileEntry {
    #[serde(alias = "key")]
    pub name: String,
    pub id: Option<String>,
    #[serde(alias = "bucket", default)]
    pub bucket_id: String,
    pub size: u64,
    #[serde(alias = "content_type")]
    pub mime_type: String,
    #[serde(alias = "last_modified", default)]
    pub created_at: String,
    #[serde(default)]
    pub updated_at: String,
    pub metadata: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ObjectMeta {
    pub key: String,
    pub bucket: String,
    pub size: u64,
    pub content_type: String,
    pub etag: Option<String>,
    pub last_modified: Option<String>,
    pub metadata: HashMap<String, String>,
}

// ---- Realtime -------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ServerMessage {
    Subscribed(ServerSubscribedMsg),
    Event(ServerEventMsg),
    Pong,
    Error(ServerErrorMsg),
    TokenRefreshed,
    PresenceState(ServerPresenceStateMsg),
    BroadcastAck(BroadcastAckMessage),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ServerSubscribedMsg {
    pub channel: String,
    pub subscription_id: Option<String>,
    pub history: Vec<RealtimeEvent>,
    pub ref_id: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ServerEventMsg {
    pub id: String,
    pub event: String, // 'insert', 'update', 'delete', 'broadcast', 'presence', 'system'
    pub topic: String,
    pub payload: serde_json::Value,
    pub timestamp: String,
    pub allowed_sub_ids: Option<Vec<String>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ServerErrorMsg {
    pub message: String,
    /// Canal concerné par l'erreur, tel qu'émis par le serveur (`<project_id>:<nom>`).
    ///
    /// N29 — le serveur distingue depuis B9/N23 une erreur PROPRE À UN CANAL (refus RLS,
    /// write policy, nom de canal invalide…) d'une erreur GLOBALE de connexion (heartbeat,
    /// token expiré, quota de violations) : il ne sérialise le champ que dans le premier cas
    /// (`skip_serializing_if = "Option::is_none"`,
    /// `services/aura-realtime/src/handlers/websocket.rs`). Le SDK ne le déclarait pas et le
    /// perdait donc silencieusement.
    ///
    /// `serde(default)` est indispensable : sans lui, le décodage d'une erreur GLOBALE — qui
    /// n'a pas ce champ — échouerait, et le SDK cesserait de voir les déconnexions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub channel: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ServerPresenceStateMsg {
    pub channel: String,
    pub presences: Vec<PresenceInfo>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BroadcastAckMessage {
    pub message_id: String,
    pub ref_id: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RealtimeEvent {
    pub id: String,
    pub event: String,
    pub topic: String,
    pub payload: serde_json::Value,
    pub timestamp: String,
    pub allowed_sub_ids: Option<Vec<String>>,
    pub ref_id: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CdcPayload {
    pub schema: String,
    pub table: String,
    #[serde(rename = "type")]
    pub op_type: String, // 'INSERT', 'UPDATE', 'DELETE'
    pub record: HashMap<String, serde_json::Value>,
    pub old_record: Option<HashMap<String, serde_json::Value>>,
    pub _truncated: Option<bool>,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
pub enum RealtimeSubscribeStatus {
    Subscribed,
    Closed,
    ChannelError,
    TimedOut,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PostgresChangesFilter {
    pub event: String, // 'INSERT', 'UPDATE', 'DELETE', '*'
    pub schema: Option<String>,
    pub table: Option<String>,
    pub filter: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BroadcastFilter {
    pub event: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PresenceFilter {
    pub event: String, // 'sync', 'join', 'leave'
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct ChannelConfig {
    #[serde(default)]
    pub private: bool,
    pub broadcast: Option<BroadcastConfig>,
    pub config: Option<PresenceConfigWrapper>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct BroadcastConfig {
    pub ack: Option<bool>,
    pub self_broadcast: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PresenceConfigWrapper {
    pub presence: Option<PresenceKeyConfig>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PresenceKeyConfig {
    pub key: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BroadcastPayload {
    #[serde(rename = "type")]
    pub msg_type: String, // 'broadcast'
    pub event: String,
    pub payload: serde_json::Value,
    pub ref_id: Option<String>,
}

pub type PresenceState = HashMap<String, Vec<PresenceInfo>>;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PresenceInfo {
    pub client_id: String,
    pub user_id: Option<String>,
    pub metadata: HashMap<String, serde_json::Value>,
    pub joined_at: String,
    pub last_seen: String,
}

// ---- AI -------------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChatMessage {
    pub role: String, // 'system', 'user', 'assistant'
    pub content: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChatResponse {
    pub model: String,
    pub content: String,
    pub input_tokens: Option<u64>,
    pub output_tokens: Option<u64>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmbedRequest {
    pub text: String,
    pub namespace: String,
    pub metadata: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmbedResponse {
    pub id: String,
    pub dimensions: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RagRequest {
    pub question: String,
    pub namespace: String,
    pub history: Option<Vec<ChatMessage>>,
    pub system: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RagResponse {
    pub answer: String,
    pub sources: Vec<RagSource>,
    pub model: String,
    pub tokens: Option<u64>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RagSource {
    pub id: String,
    pub content: String,
    pub metadata: HashMap<String, serde_json::Value>,
    pub similarity: f64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RagIngestRequest {
    pub namespace: String,
    pub content: String,
    pub metadata: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RagIngestResponse {
    pub id: String,
    pub chunks: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SemanticSearchResult {
    pub id: String,
    pub content: String,
    pub metadata: HashMap<String, serde_json::Value>,
    pub similarity: f64,
}

// ---- Functions ------------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FunctionDef {
    pub id: String,
    pub project_id: String,
    pub name: String,
    pub runtime: String,
    pub code: String,
    pub code_hash: String,
    pub env_vars: HashMap<String, serde_json::Value>,
    pub is_active: bool,
    pub created_at: String,
    pub updated_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Job {
    pub id: String,
    pub project_id: String,
    pub function_name: String,
    pub status: String, // 'pending', 'running', 'completed', 'failed', 'dead'
    pub payload: serde_json::Value,
    pub attempts: u32,
    pub max_attempts: u32,
    pub error: Option<String>,
    pub scheduled_at: String,
    pub started_at: Option<String>,
    pub created_at: String,
    pub completed_at: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CronJob {
    pub id: String,
    pub project_id: String,
    pub name: String,
    pub schedule: String,
    pub function_name: String,
    pub payload: serde_json::Value,
    pub is_active: bool,
    pub last_run: Option<String>,
    pub next_run: Option<String>,
    pub created_at: String,
}

// ---- Notifications --------------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Notification {
    pub id: String,
    pub project_id: String,
    pub channel: String, // 'email', 'sms', 'push', 'webhook'
    pub recipient: String,
    pub subject: Option<String>,
    pub body: String,
    pub status: String, // 'queued', 'processing', 'sent', 'failed', 'delivered', 'expired', 'dead_lettered'
    pub error: Option<String>,
    pub metadata: serde_json::Value,
    pub attempt_count: Option<i32>,
    pub last_attempt_at: Option<String>,
    pub next_attempt_at: Option<String>,
    pub locked_until: Option<String>,
    pub lock_owner: Option<String>,
    pub provider_message_id: Option<String>,
    pub delivered_at: Option<String>,
    pub expires_at: Option<String>,
    pub idempotency_key: Option<String>,
    pub payload_hash: Option<String>,
    pub last_error: Option<String>,
    pub last_error_code: Option<String>,
    pub last_provider_response: Option<String>,
    pub processing_started_at: Option<String>,
    pub completed_at: Option<String>,
    pub updated_at: Option<String>,
    pub sent_at: Option<String>,
    pub created_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NotificationTemplate {
    pub id: String,
    pub project_id: String,
    pub name: String,
    pub channel: String,
    pub subject: Option<String>,
    pub body: String,
    #[serde(default)]
    pub variables: Vec<String>,
    pub created_at: String,
    pub updated_at: String,
}

// ---- Phase 2 additions ----------------------------------------------------

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct IdentityInfo {
    pub id: String,
    pub provider: String,
    pub provider_id: String,
    pub identity_data: HashMap<String, serde_json::Value>,
    pub auto_linked: bool,
    pub created_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdminUser {
    #[serde(flatten)]
    pub user: User,
    pub is_active: bool,
    pub password_hash: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuditLogEntry {
    pub id: String,
    pub user_id: Option<String>,
    pub action: String,
    pub ip_address: Option<String>,
    pub user_agent: Option<String>,
    pub created_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthSettings {
    pub allow_signup: bool,
    pub email_confirmation_required: bool,
    pub password_min_length: u32,
    pub mfa_enabled: bool,
    pub allow_anonymous_users: bool,
    pub jwt_expiry_seconds: u32,
    pub refresh_token_expiry_days: u32,
    pub site_url: Option<String>,
    pub oauth_providers: HashMap<String, OAuthProviderConfig>,
    pub new_device_alerts_enabled: bool,
    pub webhook_url: Option<String>,
    pub smtp_host: Option<String>,
    pub smtp_port: Option<u16>,
    pub smtp_username: Option<String>,
    pub smtp_password_set: Option<bool>,
    pub smtp_from_email: Option<String>,
    pub smtp_from_name: Option<String>,
    pub oauth_credentials: HashMap<String, HashMap<String, String>>,
    pub captcha_enabled: bool,
    pub captcha_provider: Option<String>,
    pub captcha_site_key: Option<String>,
    pub captcha_secret_key_set: Option<bool>,
    pub password_check_hibp: bool,
    pub sms_provider: Option<String>,
    pub sms_api_key_set: Option<bool>,
    pub sms_from_number: Option<String>,
    pub redirect_urls: Vec<String>,
    pub session_inactivity_timeout_seconds: u32,
    pub hook_send_sms_url: Option<String>,
    pub hook_send_email_url: Option<String>,
    pub hook_mfa_verification_url: Option<String>,
    pub hook_password_verification_url: Option<String>,
    pub auto_link_by_email: bool,
    pub revoke_on_new_device: bool,
    pub enforce_ip_binding: bool,
    pub allowed_email_domains: Vec<String>,
    pub blocked_email_domains: Vec<String>,
    pub updated_at: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OAuthProviderConfig {
    pub enabled: Option<bool>,
    pub client_id: Option<String>,
    pub client_secret: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EmailTemplateUpdate {
    pub subject: Option<String>,
    pub body: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdminCreateUserRequest {
    pub email: String,
    pub password: Option<String>,
    pub role: Option<String>,
    pub email_verified: Option<bool>,
    pub user_metadata: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct AdminUpdateUserRequest {
    pub password: Option<String>,
    pub role: Option<String>,
    pub is_active: Option<bool>,
    pub is_banned: Option<bool>,
    pub email_verified: Option<bool>,
    pub user_metadata: Option<HashMap<String, serde_json::Value>>,
    pub app_metadata: Option<HashMap<String, serde_json::Value>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PaginatedResponse<T> {
    pub data: Vec<T>,
    pub total: u64,
    pub page: u64,
    pub per_page: u64,
}

// ---- Vérification OTP unifiée ----------------------------------------------

/// Flux de vérification acceptés par [`crate::services::auth::AuthService::verify_otp`].
///
/// Un ENUM plutôt qu'une chaîne `type` : le périmètre est le même que celui des façades
/// `verifyOtp` de JavaScript, Dart et Python — SIX flux, un par endpoint réellement servi par
/// `aura-auth` (`services/aura-auth/src/main.rs`) — mais un type hors contrat ne peut pas
/// franchir la compilation, là où les trois autres SDK doivent le rejeter à l'exécution
/// (`otp_type_unsupported`).
///
/// **F4 — `MagicLink` et `Recovery` ont été AJOUTÉS.** Ce SDK savait ENVOYER les deux liens
/// (`sign_in_with_magic_link`, `reset_password_for_email`) sans offrir aucun moyen de CONSOMMER
/// le jeton qui revient : deux parcours utilisateur qui commençaient sans pouvoir finir. Les
/// endpoints existaient des deux côtés ; seule la façade manquait.
///
/// `invite` et `phone_change` n'existent dans AUCUN SDK : `aura-auth` ne déclare aucun endpoint
/// pour les vérifier. Ils ne sont pas « à faire », ils n'ont pas lieu d'être.
///
/// `token` porte partout la valeur saisie par l'utilisateur ou reçue par courriel — c'est le
/// nom qu'emploient les trois autres SDK, même quand le corps envoyé au backend l'appelle
/// `code` (`/email-otp/verify`, `/sms/verify`).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum VerifyOtpParams<'a> {
    /// Confirmation d'inscription par lien courriel — `POST /v1/auth/verify-email`.
    Signup { token: &'a str },
    /// Consommation d'un lien magique — `POST /v1/auth/magic-link/verify`.
    MagicLink { token: &'a str },
    /// Code à usage unique envoyé par courriel — `POST /v1/auth/email-otp/verify`.
    Email { email: &'a str, token: &'a str },
    /// Code à usage unique envoyé par SMS — `POST /v1/auth/sms/verify`.
    Sms { phone: &'a str, token: &'a str },
    /// Consommation d'un lien de récupération — `POST /v1/auth/reset-password`.
    ///
    /// `password` est OBLIGATOIRE, et le typage l'impose : le backend fusionne consommation du
    /// jeton et changement de mot de passe en un seul appel (divergence assumée avec
    /// `@supabase/auth-js`, qui ouvre d'abord une session). Les SDK dynamiques doivent rendre
    /// `missing_param` à l'exécution ; ici le cas est inatteignable.
    Recovery { token: &'a str, password: &'a str },
    /// Confirmation d'un changement d'adresse — `POST /v1/auth/user/confirm-email-change`.
    /// Seul flux qui ne délivre PAS de jetons : il renvoie l'utilisateur mis à jour.
    EmailChange { token: &'a str },
}