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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! # Identity Module
//!
//! Certificate-based identity resolution and discovery for BSV.
//!
//! ## Overview
//!
//! This module provides identity discovery and management via certificates.
//! Users can:
//! - **Reveal attributes**: Publicly reveal certificate fields on-chain
//! - **Resolve identities**: Find identities by key or attributes
//! - **Manage contacts**: Store and search personal contacts
//!
//! ## Components
//!
//! - [`IdentityClient`] - Main client for identity operations
//! - [`ContactsManager`] - Encrypted contact storage
//! - [`DisplayableIdentity`] - User-displayable identity representation
//! - [`KnownCertificateType`] - Predefined certificate types
//!
//! ## Known Certificate Types
//!
//! | Type | Description | Key Fields |
//! |------|-------------|------------|
//! | IdentiCert | Government ID | firstName, lastName, profilePhoto |
//! | DiscordCert | Discord account | userName, profilePhoto |
//! | PhoneCert | Phone number | phoneNumber |
//! | XCert | X/Twitter account | userName, profilePhoto |
//! | Registrant | Entity registration | name, icon |
//! | EmailCert | Email address | email |
//! | Anyone | Permissionless | (none) |
//! | Self | Self-issued | (none) |
//! | CoolCert | Demo certificate | cool |
//!
//! ## Example
//!
//! ```rust,ignore
//! use bsv_rs::identity::{IdentityClient, IdentityClientConfig};
//! use bsv_rs::wallet::ProtoWallet;
//!
//! // Create client
//! let wallet = ProtoWallet::new(None);
//! let config = IdentityClientConfig::with_originator("myapp.com");
//! let client = IdentityClient::new(wallet, config);
//!
//! // Resolve an identity
//! if let Some(identity) = client.resolve_by_identity_key("02abc123...").await? {
//! println!("Found: {} ({})", identity.name, identity.abbreviated_key);
//! }
//!
//! // Search by attribute
//! let mut attrs = std::collections::HashMap::new();
//! attrs.insert("email".to_string(), "user@example.com".to_string());
//! let identities = client.resolve_by_attributes(attrs).await?;
//!
//! // Manage contacts
//! let contacts = client.get_contacts(false).await?;
//! client.save_contact(identity, None).await?;
//! ```
//!
//! ## Integration with Auth Module
//!
//! The identity module uses [`VerifiableCertificate`](crate::auth::VerifiableCertificate)
//! from the auth module for certificate handling. Certificates are created and
//! signed using the auth module's certificate infrastructure.
//!
//! ## Integration with Overlay Module
//!
//! Identity resolution uses the overlay network:
//! - **ls_identity** - Lookup service for identity queries
//! - **tm_identity** - Topic for broadcasting identity revelations
//!
//! ## Cross-SDK Compatibility
//!
//! This module maintains API compatibility with:
//! - [TypeScript SDK](https://github.com/bitcoin-sv/ts-sdk) - `IdentityClient`, `ContactsManager`
//! - [Go SDK](https://github.com/bitcoin-sv/go-sdk) - `identity.Client`
//!
//! Certificate type IDs are consistent across all SDK implementations.
// Re-exports
pub use IdentityClient;
pub use ContactsManager;
pub use ;