Crates.io | matrix-sdk-qrcode |
lib.rs | matrix-sdk-qrcode |
version | 0.7.1 |
source | src |
created_at | 2022-05-11 16:27:14.184532 |
updated_at | 2024-07-19 09:12:20.248622 |
description | Library to encode and decode QR codes for interactive verifications in Matrix land |
homepage | https://github.com/matrix-org/matrix-rust-sdk |
repository | https://github.com/matrix-org/matrix-rust-sdk |
max_upload_size | |
id | 584784 |
size | 34,508 |
matrix-sdk-qrcode is a crate to easily generate and parse QR codes for interactive verification using QR codes in Matrix.
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.
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(())
}