pub struct HmacSigner { /* private fields */ }Expand description
HMAC-SHA256 signer over a KeyRing (ADR 0006, ADR 0014).
Cheap to clone: the ring, clock, binding and policy live behind one
Arc. Debug shows key ids and states only — never key material
(issue #135).
Implementations§
Source§impl HmacSigner
impl HmacSigner
Sourcepub fn new(
current_secret: impl Into<String>,
previous_secret: Option<String>,
) -> Result<Self, SignerError>
pub fn new( current_secret: impl Into<String>, previous_secret: Option<String>, ) -> Result<Self, SignerError>
The environment shape of ADR 0006: HARNESS_SECRET signs, the
optional HARNESS_SECRET_PREVIOUS verifies only. No venture/env
binding and the default TokenPolicy; runtimes build the bound
signer through crate::HarnessConfig::signer, where those
fields come from config (issue #137).
§Errors
SignerError::SecretTooShort when the current secret is shorter
than MIN_SECRET_BYTES.
Sourcepub fn from_ring(ring: KeyRing) -> Self
pub fn from_ring(ring: KeyRing) -> Self
A signer over an already-built ring: crate::SystemClock, no
binding, default TokenPolicy. Apply with_clock,
with_binding and with_policy before handing it out.
Sourcepub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
Overrides the clock used for expiry checks and lifetime clamping
(the Clock port is the only time source in core, architecture
section 5).
Sourcepub fn with_binding(self, venture: Option<String>, env: Option<String>) -> Self
pub fn with_binding(self, venture: Option<String>, env: Option<String>) -> Self
Stamps and enforces the venture/environment binding (issue #137).
The labels come from config (HARNESS_VENTURE, ENV); a token
minted under one binding never verifies under another. With both
None the signer stays unbound — the pre-#137 shape, kept for
tests and hand-built rings.
Sourcepub fn with_policy(self, policy: TokenPolicy) -> Self
pub fn with_policy(self, policy: TokenPolicy) -> Self
Replaces the per-purpose lifetime policy.
Sourcepub fn ring_states(&self) -> Vec<(Kid, KeyState)>
pub fn ring_states(&self) -> Vec<(Kid, KeyState)>
The ring this signer verifies against (ids and states only).
Trait Implementations§
Source§impl Clone for HmacSigner
impl Clone for HmacSigner
Source§fn clone(&self) -> HmacSigner
fn clone(&self) -> HmacSigner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more