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
//! Smart ID Client Library
//!
//! Provides a rust api client for [Smart ID](https://www.smart-id.com/) REST api.
//! Including support for authentication, signing and certificate choice.
//! As well as support for generating device links for the Smart ID app.
//!
//! Maintained by [Trust1Team](https://trust1team.com) partner of [SK ID](https://www.skidsolutions.eu/) for [Smart ID](https://www.smart-id.com/)
//!
//! # Example
//!
//! ```rust,ignore
//! use crate::smart_id_rust_client::config::SmartIDConfig;
//! use crate::smart_id_rust_client::client::smart_id_client::SmartIdClient;
//! use smart_id_rust_client::models::api::authentication_session::AuthenticationDeviceLinkRequest;
//! use smart_id_rust_client::models::api::signature_session::SignatureDeviceLinkRequest;
//! use smart_id_rust_client::models::api::certificate_choice_session::CertificateChoiceDeviceLinkRequest;
//! use crate::smart_id_rust_client::models::device_link::DeviceLinkType;
//! use crate::smart_id_rust_client::models::user_identity::UserIdentity;
//! use smart_id_rust_client::models::interaction::Interaction;
//! use smart_id_rust_client::error::Result;
//! use smart_id_rust_client::models::api::authentication_session::AuthenticationCertificateLevel;
//! use smart_id_rust_client::models::signature::SignatureAlgorithm;
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! use smart_id_rust_client::models::signature::HashingAlgorithm;
//! let cfg = SmartIDConfig::load_from_env()?;
//! let smart_id_client = SmartIdClient::new(&cfg, None, vec![], vec![]);
//!
//! // Example: Start an authentication session
//! let authentication_request = AuthenticationDeviceLinkRequest::new(
//! &cfg,
//! vec![Interaction::DisplayTextAndPIN {
//! display_text_60: "Authenticate to Application: Test".to_string(),
//! }],
//! SignatureAlgorithm::RsassaPss,
//! AuthenticationCertificateLevel::QUALIFIED,
//! None, // No callback url is needed for cross device link sessions (QR)
//! HashingAlgorithm::sha_512,
//! )?;
//! smart_id_client.start_authentication_device_link_anonymous_session(authentication_request).await?;
//!
//! // Example: Generate a device link
//! // This must be converted to a QR code to be scanned by the Smart ID app
//! let qr_code_link = smart_id_client.generate_device_link(DeviceLinkType::QR, "eng")?;
//! println!("QR Code Link: {}", qr_code_link);
//!
//! Ok(())
//! }
//! ```
//!
//! Consult examples/smart_id_client.rs for a full example with more detailed comments.