Documentation
//! Deep link related module.
//! Contains the following:
//! - `SigninDeepLink` - A deep link for signing into a Pubky homeserver (legacy cookie flow).
//! - `SignupDeepLink` - A deep link for signing up to a Pubky homeserver (legacy cookie flow).
//! - `DirectSignupDeepLink` - A deep link for registering an account directly on a Pubky homeserver.
//! - `SigninGrantDeepLink` - A deep link for signing in via the grant flow.
//! - `SignupGrantDeepLink` - A deep link for signing up via the grant flow.
//! - `SeedExportDeepLink` - A deep link for exporting a user secret to a signer like Pubky Ring.
//! - `DeepLink` - A parsed Pubky deep link.
//! - `DeepLinkParseError` - Errors that can occur when parsing a deep link.
//! - `DEEP_LINK_SCHEMES` - Supported deep link schemes.
//!
//! A deep link is used either on a phone directly or in the browser as a QR code
//! to communicate with a Pubky Signer like Pubky Ring.
//!
//! # Construct grant links
//!
//! Grant parameter structs are non-exhaustive. Replace external struct literals
//! with their constructors, then customize public fields as needed. Parsing
//! links and using [`crate::PubkyGrantAuthFlow`] are unchanged.
//!
//! ```
//! use pubky::{Capabilities, ClientId, Keypair};
//! use pubky::deep_links::SigninGrantParams;
//! use url::Url;
//!
//! # let secret = pubky_common::crypto::random_bytes::<32>();
//! let mut params = SigninGrantParams::new(
//!     Capabilities::builder().read_write("/")?.finish(),
//!     Url::parse("https://httprelay.pubky.app/inbox/")?,
//!     secret, // A fresh random 32-byte relay secret.
//!     ClientId::new("example.app")?,
//!     Keypair::random().public_key(),
//! );
//! // Bare-grant typed links use the shared relay secret above.
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//! For signup, use [`SignupGrantParams::new`] and set `signup_token` if needed.
//! Use [`crate::PubkyGrantAuthFlow`] to create signed-approval links; it
//! generates and retains the required ephemeral HPKE key automatically.

mod deep_link;
mod direct_signup;
mod error;
mod grant_approval_format;
mod grant_relay_channel;
mod query_params;
mod schemes;
mod seed_export;
mod signin;
mod signin_grant;
mod signup;
mod signup_grant;
mod typed_deep_link;
mod x_callback;

/// Supported deep link schemes.
pub const DEEP_LINK_SCHEMES: [&str; 2] = ["pubkyauth", "pubkyring"];

pub use deep_link::DeepLink;
pub use direct_signup::{DirectSignupDeepLink, DirectSignupIntent, DirectSignupParams};
pub use error::DeepLinkParseError;
pub use grant_approval_format::GrantApprovalFormat;
pub use grant_relay_channel::GrantRelayChannel;
pub use schemes::DeepLinkScheme;
pub use seed_export::{SecretExportIntent, SeedExportDeepLink, SeedExportParams};
pub use signin::{SigninDeepLink, SigninIntent, SigninParams};
pub use signin_grant::{SigninGrantDeepLink, SigninGrantIntent, SigninGrantParams};
pub use signup::{SignupDeepLink, SignupIntent, SignupParams};
pub use signup_grant::{SignupGrantDeepLink, SignupGrantIntent, SignupGrantParams};
pub use typed_deep_link::{DeepLinkIntent, DeepLinkParams, TypedDeepLink};
pub use x_callback::XCallbackParams;