SignedIdentity

Struct SignedIdentity 

Source
pub struct SignedIdentity { /* private fields */ }
Expand description

A credential signed with a secret this process holds.

The credential is <payload>.<mac>, where payload is actor;expiry_millis;key=value;key=value… and mac is a keyed BLAKE3 of it under the shared secret, hex-encoded. Verification is a constant-time comparison of the recomputed tag.

This is a symmetric scheme, and its limits are the point of writing them here. It suits a gateway that mints credentials for a Beck process behind it — the shape a rung-1 deployment actually has — and it does not suit a public identity provider, because everything that can verify a credential can also mint one. An asymmetric verifier is D6’s OIDC work and needs a signature library (48 §48.13).

BLAKE3’s keyed mode is a MAC by construction and is already in this workspace’s dependency graph, so this costs no new dependency and no hand-rolled cryptography — the two ways a module like this usually goes wrong.

Implementations§

Source§

impl SignedIdentity

Source

pub fn new(secret: &str, clock: Arc<dyn Clock>) -> SignedIdentity

A verifier for a shared secret of any length, stretched to BLAKE3’s key size by its own derivation function rather than by truncation or padding.

Source

pub fn mint( &self, actor: &str, expires_at_millis: i64, claims: &[(&str, &str)], ) -> String

Mint a credential. Present so a test, a gateway written in Beck, or beck run --auth can produce one — and so the format has exactly one implementation rather than a description.

Trait Implementations§

Source§

impl Debug for SignedIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Identity for SignedIdentity

Source§

fn verify(&self, claim: &str) -> Result<Actor, Rejected>

Verify what a client said about itself. Read more
Source§

fn kind(&self) -> &'static str

What this provider is, for the dashboard and for the startup line. An operator who cannot tell from the logs whether authentication is on does not have authentication.
Source§

fn verifies(&self) -> bool

Whether this provider verifies anything at all. Read more
Source§

fn login(&self) -> Option<&RelyingParty>

The browser-facing half, for a provider that can run a login flow. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more