Skip to main content

coqui_access_kit/
lib.rs

1//! Building blocks shared by access providers, independent of any plugin host.
2//!
3//! | Module | Purpose |
4//! | --- | --- |
5//! | [`mod@table`] | [`Table`], the typed source a provider reads its records from and writes them to; [`MemoryTable`] built in code; [`Reloading`], a cache that follows a table's changes. |
6//! | [`mod@hash`] | Use these with your own data: [`KeyHash`], [`verify_key`], [`PasswordHasher`], [`verify_password`], [`generate_key`]; self-describing `sha256:` and `$argon2id$` strings. |
7//! | [`mod@matcher`] | [`matcher::Matcher`]: a lookup's claims to a directory account, by templates and LDAP filters with every value escaped. |
8//! | [`mod@pins`] | [`pins::PinSource`], a per-user [`pins::AuthorizedFile`] and a [`pins::TablePins`]: where an account's pinned certificates live. |
9//! | [`mod@pick`] | [`pick::pick`]: which account a credential's named fields (a certificate's SANs, subject, fingerprint) name. |
10//! | [`mod@secret`] | Generate a prefixed 256-bit secret, hash it with optional domain separation, compare in constant time. |
11//! | `file` | Feature `file`: atomic private (`0600`) writes, bounded reads, change stamps, and `FileTable`, a table kept in one file in any serde format the caller supplies. |
12//!
13//! The kit names no format. A table kept in a file takes the caller's serde codec; a SQL
14//! database or an HTTP API is a [`Table`] the caller implements. Nothing here reads a file or
15//! an environment variable unless it is asked to.
16//!
17//! Secret helpers report errors as plain `String`s that never contain secrets; tables fail
18//! with [`SourceError`].
19
20#![forbid(unsafe_code)]
21#![warn(missing_docs)]
22#![warn(missing_debug_implementations)]
23#![cfg_attr(docsrs, feature(doc_cfg))]
24
25#[cfg(feature = "cache")]
26#[cfg_attr(docsrs, doc(cfg(feature = "cache")))]
27pub mod cache;
28#[cfg(feature = "file")]
29#[cfg_attr(docsrs, doc(cfg(feature = "file")))]
30pub mod file;
31pub mod hash;
32pub mod matcher;
33pub mod pick;
34pub mod pins;
35pub mod record;
36pub mod secret;
37pub mod table;
38
39#[cfg(feature = "cache")]
40pub use cache::{CacheOptions, CacheSetting, Cached};
41pub use hash::{
42    Argon2Params, DEFAULT_MAX_PASSWORD_BYTES, KeyHash, PasswordHasher, generate_key, is_key_hash,
43    is_password_hash, verify_key, verify_password,
44};
45pub use record::RecordLimits;
46pub use table::{
47    Keyed, MemoryTable, Reloading, Revision, Snapshot, SourceError, Table, Update, UpdateOne,
48    check_field, check_keys, unix_now,
49};