#chat #messaging #ruma #matrix-chat #codec #nio

matrix-sdk-qrcode

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

5 releases (3 breaking)

new 0.8.0 Nov 19, 2024
0.7.1 Jul 19, 2024
0.7.0 Jan 5, 2024
0.4.0 Sep 28, 2022
0.3.0 May 11, 2022

#454 in Development tools

Download history 44/week @ 2024-07-23 33/week @ 2024-07-30 4/week @ 2024-08-06 11/week @ 2024-08-13 6/week @ 2024-08-20 10/week @ 2024-08-27 3/week @ 2024-09-03 14/week @ 2024-09-10 9/week @ 2024-09-17 21/week @ 2024-09-24 12/week @ 2024-10-01 14/week @ 2024-10-08 41/week @ 2024-10-15 4/week @ 2024-10-22 8/week @ 2024-10-29 8/week @ 2024-11-05

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

Apache-2.0

36KB
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

~20MB
~323K SLoC