arcly_http_identity/
notify.rs1use async_trait::async_trait;
6
7use crate::error::Result;
8
9#[derive(Debug, Clone)]
11pub struct Notification {
12 pub to: String,
14 pub channel: Channel,
16 pub kind: NotificationKind,
18 pub payload: String,
20}
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum Channel {
24 Email,
25 Sms,
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29pub enum NotificationKind {
30 EmailVerification,
31 PhoneVerification,
32 PasswordReset,
33 MagicLink,
34 LoginOtp,
35}
36
37#[async_trait]
40pub trait Notifier: Send + Sync + 'static {
41 async fn send(&self, message: Notification) -> Result<()>;
42}
43
44pub struct LogNotifier;
47
48#[async_trait]
49impl Notifier for LogNotifier {
50 async fn send(&self, message: Notification) -> Result<()> {
51 tracing::info!(
52 to = %message.to,
53 channel = ?message.channel,
54 kind = ?message.kind,
55 payload = %message.payload,
56 "identity notification (LogNotifier — not actually delivered)"
57 );
58 Ok(())
59 }
60}