Crates.io | libreauth |
lib.rs | libreauth |
version | 0.16.0 |
source | src |
created_at | 2016-09-16 21:12:40.076532 |
updated_at | 2023-04-22 09:43:58.766509 |
description | Collection of tools for user authentication. |
homepage | |
repository | https://github.com/breard-r/libreauth |
max_upload_size | |
id | 6520 |
size | 312,934 |
LibreAuth is a collection of tools for user authentication.
authenticator API
server API
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.
:warning: 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. The minimal required Rust version is 1.60, although it is recommended to use the latest stable one.
$ 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. A full copy of those licenses are available in this repository both in english and french.
While the CeCILL 2.1 is the original LibreAuth license, future versions may be published only under the CeCILL-C license. This change occurs because CeCILL 2.1 isn't really suited for a library since it is a "viral" license.