plexus-auth-core 0.1.0

Sealed-type primitives for the Plexus auth framework: AuthContext, VerifiedUser, Principal.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! AUTHZ-CRED-CORE-1 acceptance criterion 6: `Credential::new(...)` is
//! unreachable from outside `plexus-auth-core`.
//!
//! The credential's only constructor (`new_sealed`) is `pub(crate)` and the
//! fields are private; together this makes construction from any other
//! crate impossible. This program tries the obvious paths and must fail.

use plexus_auth_core::Credential;

fn main() {
    // Attempt 1: the (sealed) constructor.
    let _: Credential<String> = Credential::new_sealed(
        "fabricated".to_string(),
        unreachable!("can't even build metadata externally without the sealed deps"),
        unreachable!(),
    );
}