rqrr-zeroize
Fork of rqrr (0.10.1) by WanzenBug.
This crate exports the same QR detection/decode API as upstream rqrr, plus
secure wiping of the prepared image buffer.
Why this fork
rqrr::PreparedImage keeps a private pixel buffer. After prepare(), that
buffer is a binary QR mask (not the original screenshot), but it is still enough
to reconstruct the code. The public API had no way to overwrite it, and
detect_grids() clones the image internally — those copies were dropped without
wiping.
This fork exists so QR payloads that may be sensitive (wallet URIs, seeds, login tokens, …) do not linger in heap memory after decode.
The rustc crate name stays rqrr, so existing use rqrr::… code is a
drop-in. Depend on the crates.io package rqrr-zeroize.
Differences from upstream
PreparedImageimplementszeroize::Zeroizeand overwrites its pixel buffer on [Drop] (including clones made during detection).PreparedImage::zeroize()is also available as an inherent method.- Transient luminance averages used during
prepare()are wiped. BasicImageBuffer(used byprepare_from_bitmap/prepare_from_greyscale) wipes its pixel slice on drop.
Do not call zeroize() while detect_grids() results still borrow the
image. Dropping PreparedImage after decode is enough.
Usage
[]
= "0.10.1"
use image;
use rqrr;
let img = open?.into_luma8;
// Prepare for detection
let mut img = prepare;
// Search for grids, without decoding
let grids = img.detect_grids;
assert_eq!;
// Decode the grid
let = grids.decode?;
assert_eq!;
assert_eq!;
// `img` is zeroized when it is dropped. Optional explicit wipe after decode:
img.zeroize;
To keep the dependency key as rqrr as well:
= { = "rqrr-zeroize", = "0.10.1" }
For more information visit docs.rs.
License
Attribution
This library is a fork of rqrr, which was made on the base of quirc.