Skip to main content

sui_id_shared/
lib.rs

1//! # sui-id-shared
2//!
3//! Shared types crossing crate boundaries. Kept intentionally small: only DTOs,
4//! protocol-level enums, and a public-facing API error type live here. Internal
5//! domain logic stays in `sui-id-core`.
6
7#![forbid(unsafe_code)]
8
9pub mod api;
10pub mod auth_method;
11pub mod errors;
12pub mod ids;
13
14pub use auth_method::{acr_from_methods, amr_from_methods, AuthMethod};
15pub use errors::{ApiError, ApiErrorCode};
16
17/// Normalise an email address for case-insensitive uniqueness checks and
18/// lookup. The original-case form is preserved separately in `UserRow.email`
19/// for display purposes; this function produces the canonical form used for
20/// database indexing and forgot-password lookup.
21///
22/// Rule: trim leading/trailing whitespace, then convert to lowercase.
23/// We do not perform full RFC 5321 local-part canonicalisation (dots,
24/// plus-addressing) — those vary by provider and are not universally
25/// applicable.
26pub fn normalize_email(input: &str) -> String {
27    input.trim().to_lowercase()
28}