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
//! 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.
/// Supported deep link schemes.
pub const DEEP_LINK_SCHEMES: = ;
pub use DeepLink;
pub use ;
pub use DeepLinkParseError;
pub use GrantApprovalFormat;
pub use GrantRelayChannel;
pub use DeepLinkScheme;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use XCallbackParams;