host_sso/lib.rs
1//! host-sso — SSO session manager for Polkadot Host products.
2//!
3//! Manages the QR-based pairing lifecycle between a host application and a
4//! mobile wallet (Polkadot App). Handles sign-request forwarding and session
5//! persistence across restarts.
6//!
7//! ## Architecture
8//!
9//! All I/O (transport, signing, storage, event delivery) is injected via the
10//! traits in [`traits`]. The crate has **no direct I/O dependencies**.
11//!
12//! ## Usage
13//!
14//! 1. Implement [`traits::SsoTransport`], provide a [`host_wallet::HostSigner`],
15//! [`traits::SsoSessionStore`], and [`traits::SsoEventSink`] for your platform.
16//! 2. Construct a [`manager::SsoManager`] with the adapters and metadata URL.
17//! 3. Call `restore_session()` on startup to resume a previous session.
18//! 4. Call `pair()` to initiate a new QR-pairing flow.
19//! 5. Call `handle_pairing_result()` once the pairing handshake completes.
20
21pub mod error;
22pub mod manager;
23pub mod presence;
24pub mod product_key;
25pub mod product_key_cache;
26pub mod session;
27pub mod state;
28pub mod traits;
29
30#[cfg(feature = "chain-subscription")]
31pub mod subscription_handler;
32
33pub use error::SsoError;
34pub use manager::SsoManager;
35pub use product_key_cache::{CacheIdentityMismatch, ProductKeyCache, ProductKeyCacheEntry};
36pub use session::PairingResult;
37pub use state::SsoState;
38pub use traits::{
39 NoopProductKeyStore, PersistedSessionMeta, ProductKeyStoreLoadResult, SsoEventSink,
40 SsoProductKeyStore, SsoSessionStore, SsoSigner, SsoTransport,
41};