steam_connect/
lib.rs

1//! # steam-connect
2//!
3//! Implementation Steam web authorization for simple use in projects with or without actix_web
4//!
5//! ### Usage
6//!
7//! Example:
8//! ```
9//! // Getting the authorization link. Requires a link to redirect
10//! // the user after authorization. If used in a project with
11//! // actix_web, you can use the redirect function defined in Redirect
12//! let url = Redirect::new("http://127.0.0.1:8080/auth/callback").unwrap();
13//!
14//! // Performs data validation when returning to the callback page
15//! let verify = Verify::verify_request(req.query_string()).await.unwrap();
16//!
17//! verify.claim_id(); // Get SteamID64 of an authorized user
18//!
19//! // Queries the steam api for more information about the profile.
20//! verify.get_summaries();
21//! ```
22//!
23//! You can study an [example project](https://github.com/AspectUnk/steam-connect-rs/blob/main/examples/actix.rs) using actix_web
24
25#[macro_use]
26extern crate serde;
27#[macro_use]
28extern crate lazy_static;
29
30mod redirect;
31mod verify;
32
33pub use redirect::Redirect;
34pub use verify::Verify;
35
36#[derive(Debug)]
37pub enum Error {
38    /// Often occurs due to incorrect callback link specified when creating a redirect link
39    ParseUrl(url::ParseError),
40    ParseQuery(serde_qs::Error),
41    /// Query string conversion error when checking for validity
42    Deserialize(serde_qs::Error),
43    /// Error getting a SteamID64
44    ParseSteamID(String),
45    /// Error getting a player profile
46    GetSummaries(String),
47}