rqrr-zeroize 0.10.1

Fork of rqrr that zeroizes PreparedImage buffers. Detect and read QR codes from any image source.
Documentation

rqrr-zeroize

Crates.io documentation

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

  • PreparedImage implements zeroize::Zeroize and 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 by prepare_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

[dependencies]
rqrr-zeroize = "0.10.1"
use image;
use rqrr;

let img = image::open("tests/data/github.gif")?.into_luma8();
// Prepare for detection
let mut img = rqrr::PreparedImage::prepare(img);
// Search for grids, without decoding
let grids = img.detect_grids();
assert_eq!(grids.len(), 1);
// Decode the grid
let (meta, content) = grids[0].decode()?;
assert_eq!(meta.ecc_level, 0);
assert_eq!(content, "https://github.com/WanzenBug/rqrr");
// `img` is zeroized when it is dropped. Optional explicit wipe after decode:
img.zeroize();

To keep the dependency key as rqrr as well:

rqrr = { package = "rqrr-zeroize", version = "0.10.1" }

For more information visit docs.rs.

License

Either APACHE or MIT

Attribution

This library is a fork of rqrr, which was made on the base of quirc.