#matrix #chat #messaging #ruma #nio

matrix-sdk-qrcode

Library to encode and decode QR codes for interactive verifications in Matrix land

3 releases (breaking)

0.7.0 Jan 5, 2024
0.4.0 Sep 28, 2022
0.3.0 May 11, 2022

#1754 in Web programming

Download history 21/week @ 2023-11-04 21/week @ 2023-11-11 24/week @ 2023-11-18 30/week @ 2023-11-25 17/week @ 2023-12-02 27/week @ 2023-12-09 22/week @ 2023-12-16 23/week @ 2023-12-23 44/week @ 2023-12-30 30/week @ 2024-01-06 26/week @ 2024-01-13 18/week @ 2024-01-20 20/week @ 2024-01-27 16/week @ 2024-02-03 34/week @ 2024-02-10 85/week @ 2024-02-17

160 downloads per month
Used in 4 crates (2 directly)

Apache-2.0

35KB
378 lines

matrix-sdk-qrcode is a crate to easily generate and parse QR codes for interactive verification using QR codes in Matrix.

Usage

This is probably not the crate you are looking for, it's used internally in the matrix-sdk.

If you still want to play with QR codes, here is a helpful example.

Encode into a QR code

use matrix_sdk_qrcode::{QrVerificationData, DecodingError};
use image::Luma;

fn main() -> Result<(), DecodingError> {
    let data = b"MATRIX\
        \x02\x02\x00\x07\
        FLOW_ID\
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
        BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\
        SHARED_SECRET";

    let data = QrVerificationData::from_bytes(data)?;
    let encoded = data.to_qr_code().unwrap();
    let image = encoded.render::<Luma<u8>>().build();

    Ok(())
}

Dependencies

~17MB
~343K SLoC