9 releases

0.2.1 Oct 25, 2023
0.2.0 Aug 24, 2023
0.1.12 Aug 22, 2023
0.1.11 Jun 30, 2023

#570 in Hardware support

Download history 6/week @ 2024-02-26 4/week @ 2024-03-11 227/week @ 2024-04-01

231 downloads per month

MIT license

52KB
952 lines

LIBFPRINT-RS

This crate provides a wrapper around the native libfprint library.

Dependencies

This package requires libfprint-2 to be installed in your system alongside libclang and pkg-config

Usage

Add libfprint-rs as a dependency in Cargo.toml

[dependencies]
libfprint-rs = "0.2.0"

Or using cargo

cargo add libfprint-rs

Import the libfprint_rs crate. The starting point for nearly all libfprint-rs functionality is to create a context object. With a context object, you can list devices, open them and execute their functionalities.

use libfprint_rs::FpContext;

fn main() {
    let ctx = FpContext::new();
    let devices = ctx.devices();
    let dev = devices.get(0).unwrap();

    dev.open_sync(None).unwrap();
}

License

Distributed under the MIT License.

Status

Currently libfprint-rs is WIP.


lib.rs:

Rust bindings for libfprint.

This crate provides a wrapper around the libfprint library, which allows you to use fingerprint scanners in your Rust applications.

Enrolling a new fingerprint

use libfprint_rs::{FpContext, FpPrint};

let context = FpContext::new();
let devices = context.get_devices();

let context = FpContext::new();
let devices = context.devices();

let dev = devices.get(0).unwrap();
dev.open_sync(None)?;

let template = FpPrint::new(&dev);
template.set_username("Bruce Banner");

let print = dev.enroll_sync(template, None, None, None::<()>)?;

Verifying a fingerprint

let context = FpContext::new();
let devices = context.devices();

let dev = devices.get(0).unwrap();
dev.open_sync(None)?;

let enrolled_print = load_print_from_file();

let match_res = dev.verify_sync(enrolled_print, None, None, None::<()>, None)?;

For more examples on how to use this crate, please refer to the github oficial repository and the documentation.

Dependencies

~8–11MB
~232K SLoC