discord-qr-auth

Crates.iodiscord-qr-auth
lib.rsdiscord-qr-auth
version0.1.0
sourcesrc
created_at2022-06-28 12:45:09.011527
updated_at2022-06-28 12:45:09.011527
descriptionA Rust library to authenticate with Discord using QR codes.
homepagehttps://github.com/safecord/discord-qr-auth
repositoryhttps://github.com/safecord/discord-qr-auth.git
max_upload_size
id614812
size17,633
raizo (iraizo)

documentation

README

discord-qr-auth

discord-qr-auth is a Rust library that lets you authenticate users using QR codes.

Example

use qrcode::render::unicode;
use discord_qr_auth::core::websocket::Client;

#[tokio::main]
async fn main() {
    let mut ws = Client::default();
    ws.connect().await.unwrap();
    let qr = ws.get_code().await.unwrap();

    let image = qr
        .render::<unicode::Dense1x2>()
        .dark_color(unicode::Dense1x2::Light)
        .light_color(unicode::Dense1x2::Dark)
        .build();
    println!("{}\nScan this QR code in the Discord app on your phone.", image);

    let user = ws.get_user().await.unwrap();

    println!("User {} scanned QR code!", user.username);

    let token = ws.get_token().await.unwrap();

    println!("User accepted log-in. Token: {}", token);
}
Commit count: 43

cargo fmt