Crates.io | libreauth |
lib.rs | libreauth |
version | 0.18.1 |
created_at | 2016-09-16 21:12:40.076532+00 |
updated_at | 2025-08-21 16:28:24.41695+00 |
description | Collection of user authentication tools. |
homepage | |
repository | https://codeberg.org/rbd/libreauth |
max_upload_size | |
id | 6520 |
size | 225,134 |
LibreAuth is a collection of tools for user authentication.
uses the platform's secure entropy source
customizable size
customizable output format (Vec
The project itself is still in development and therefore should not be used in production before version 1.0.0. Below is the list of features that will be present in the first stable version and their individual status.
:white_check_mark: stable API
:warning: lack of peer review
You can find LibreAuth on crates.io and
include it in your Cargo.toml
:
libreauth = "*"
Modules can be cherry-picked using default-features = false
and then using
only the features you want.
[dependencies.libreauth]
version = "*"
default-features = false
features = ["key", "oath", "pass"]
In order to build LibreAuth, you will need the Rust compiler and its package manager, Cargo.
$ make
$ make install
More examples are available in the documentation.
use libreauth::oath::TOTPBuilder;
fn main() {
let key = "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ".to_string();
let code = TOTPBuilder::new()
.base32_key(&key)
.finalize()
.unwrap()
.generate();
assert_eq!(code.len(), 6);
}
#include <stdio.h>
#include <libreauth.h>
int main(void) {
struct libreauth_totp_cfg cfg;
char code[7], key[] = "12345678901234567890";
if (libreauth_totp_init(&cfg) != LIBREAUTH_OTP_SUCCESS) {
return 1;
}
cfg.key = key;
cfg.key_len = strlen(key);
if (libreauth_totp_generate(&cfg, code) != LIBREAUTH_OTP_SUCCESS) {
return 2;
}
printf("%s\n", code);
return 0;
}
$ cc -o totp totp.c -llibreauth
$ ./totp
848085
LibreAuth is a free software available either under the CeCILL-C or the CeCILL 2.1 license. For a quick summary of those licenses, you can read the frequently asked questions on the licenses' website.
Some file that are not directly part of the source code itself are distributed under the CC0-1.0 license.
This project is REUSE compliant. You will therefore find a copy of
every license in the LICENSES
directory and more details on the applicable
license of every file in the REUSE.toml
file.