Skip to main content

HarnessConfig

Struct HarnessConfig 

Source
pub struct HarnessConfig {
    pub harness_secret: String,
    pub harness_secret_previous: Option<String>,
    pub harness_secret_revoked: Vec<String>,
    pub harness_venture: Option<String>,
    pub admin_token: Option<String>,
    pub env: VentureEnv,
}
Expand description

The harness-level keys, parsed once from the environment Config (issue #3): HARNESS_SECRET (required, ≥ 32 bytes), HARNESS_SECRET_PREVIOUS (optional), ADMIN_TOKEN (optional), ENV (development|staging|production, default development), and the issue #137 key-ring keys: HARNESS_SECRET_REVOKED (optional, comma-separated key ids whose tokens must be refused immediately) and HARNESS_VENTURE (optional label binding tokens to this venture, so one venture’s links cannot verify in another that shares its secret by mistake).

Dummy secrets only, in tests: HARNESS_SECRET = "test-secret-0123456789abcdef-0123".

Fields§

§harness_secret: String§harness_secret_previous: Option<String>§harness_secret_revoked: Vec<String>

Key ids revoked at boot (issue #137). Ids and states, never key material — this list is safe to log.

§harness_venture: Option<String>

The venture binding label for issued tokens (issue #137).

§admin_token: Option<String>§env: VentureEnv

Implementations§

Source§

impl HarnessConfig

Source

pub fn from_config(config: &dyn Config) -> Result<Self, ConfigError>

§Errors

One problem per invalid key, reported together: missing or short HARNESS_SECRET, unknown ENV value.

Source

pub fn signer(&self) -> HmacSigner

The HMAC signer for this configuration: a bounded key ring (ADR 0006 as amended by ADR 0014, issue #137). HARNESS_SECRET is the signing key, HARNESS_SECRET_PREVIOUS a verification-only key, and every id named in HARNESS_SECRET_REVOKED is burned before the ring is frozen. Tokens are bound to HARNESS_VENTURE and ENV so a link minted in one venture or environment never verifies in another.

§Panics

Only when from_config was bypassed with an invalid secret.

Trait Implementations§

Source§

impl Clone for HarnessConfig

Source§

fn clone(&self) -> HarnessConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HarnessConfig

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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