LibreAuth

Build Status LibreAuth on crates.io LibreAuth on docs.rs License: CeCILL-C License: CeCILL-2.1

LibreAuth is a collection of tools for user authentication.

Features

Status

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.

Using within a Rust project

You can find LibreAuth on crates.io and include it in your Cargo.toml:

toml libreauth = "*"

Modules can be cherry-picked using default-features = false and then using only the features you want.

toml [dependencies.libreauth] version = "*" default-features = false features = ["key", "oath", "pass"]

Using outside Rust

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.

ShellSession $ make $ make install

Quick examples

Rust

More examples are available in the documentation.

```rust use libreauth::oath::TOTPBuilder;

fn main() { let key = "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ".tostring(); let code = TOTPBuilder::new() .base32key(&key) .finalize() .unwrap() .generate(); assert_eq!(code.len(), 6); } ```

C

```C

include

include

int main(void) { struct libreauthtotpcfg cfg; char code[7], key[] = "12345678901234567890";

if (libreauthtotpinit(&cfg) != LIBREAUTHOTPSUCCESS) { return 1; } cfg.key = key; cfg.keylen = strlen(key); if (libreauthtotpgenerate(&cfg, code) != LIBREAUTHOTP_SUCCESS) { return 2; }

printf("%s\n", code);

return 0; } ```

ShellSession $ cc -o totp totp.c -llibreauth $ ./totp 848085

License

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.