Skip to main content

HarnessSigner

Struct HarnessSigner 

Source
pub struct HarnessSigner { /* private fields */ }

Implementations§

Source§

impl HarnessSigner

Source

pub fn generated(credential_ids: &[&str]) -> Self

A signer holding fresh random roots under the given fixture credential ids.

Source

pub fn fixed(credential_id: &str, secret: [u8; 32]) -> Self

A signer holding one root with a fixed secret (the golden pair’s RFC 8032 key).

Source

pub fn from_pairs(roots: impl IntoIterator<Item = (String, KeyPair)>) -> Self

A signer holding the given key pairs as roots. The pair’s type decides only how FixtureRoot::account_public spells the key; the signature is the same.

Source

pub fn without(&self, credential_id: &str) -> Self

The same signer without the root credential_id: requests for that credential return not_found, like a vault missing the key or ck-bus missing its grant on it.

Source

pub fn with_fault(self, fault: SignerFault) -> Self

Source

pub fn root(&self, credential_id: &str) -> &FixtureRoot

Source

pub fn observed_principals(&self) -> Vec<Option<Principal>>

Source

pub fn manifest(&self) -> ModuleManifest

Register as the claustrum vault’s management surface, so ck-bus can route signing requests to the same module id and operations as in production.

Source

pub fn answer(&self, body: &[u8]) -> HandlerOutcome

Answers one request body the way claustrum’s read surface does: a {method, params} body in, {"result": ...} out, a vault refusal as {"result": {"error": {code, class}}} in an ordinary response, and undecodable params as an error frame (invalid_params).

Trait Implementations§

Source§

impl Clone for HarnessSigner

Source§

fn clone(&self) -> Self

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 ModuleHandler for HarnessSigner

Source§

fn on_bind<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 RouteBindRequest, ) -> Pin<Box<dyn Future<Output = BindDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Accepts every caller. The principal is recorded for the report, never checked: this signer carries no authority to check it against.

Source§

fn handle<'life0, 'async_trait>( &'life0 self, _ctx: RequestCtx, body: Vec<u8>, ) -> Pin<Box<dyn Future<Output = HandlerOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle a data-plane request on a route channel. Return a unary response, a typed error, or stream interim events via RequestCtx::emit and return HandlerOutcome::Streamed. Each request runs in its own task so one slow handler cannot head-of-line-block another route.
Source§

fn on_hello_ack<'life0, 'life1, 'async_trait>( &'life0 self, _ack: &'life1 ModuleHelloAckBody, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Called once after HELLO_ACK so the module can inspect the ack body for negotiated capabilities and any storage descriptor supplied by the daemon.
Source§

fn control_ops(&self) -> Vec<String>

Extra daemon-to-module operations served on channel 0, such as consent/v1. Read and validated once before HELLO: names must be nonempty ASCII names using letters, digits, ., _, - or /, with no empty segments. Duplicates and SDK-owned health.check, config.review and route.bind are refused with SubcModuleError::InvalidControlOp before advertising.
Source§

fn on_control_request<'life0, 'life1, 'async_trait>( &'life0 self, _op: &'life1 str, _body: Value, _cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<Value, ErrorBody>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Handle a declared control op with its entire decoded JSON request body. The control name is the body’s op string; for a protocol-tagged request with no op, such as consent/v1, it is the body’s protocol string. Return a JSON RESPONSE body or an ErrorBody carrying a wire error code and message. Runs off the reader, independently of routes, health and config review, with at most 16 concurrent calls per connection and no queue; overload returns resource_exhausted. There is no SDK time limit. Read more
Source§

fn config_declaration(&self) -> Option<ConfigDeclareRequest>

Opt in once per connection. The SDK advertises config.review, declares these locations, and fetches immutable views before calling config_apply. Returning None leaves the existing module wire and file reader unchanged.
Source§

fn config_review<'life0, 'async_trait>( &'life0 self, _request: ConfigReviewRequest, ) -> Pin<Box<dyn Future<Output = ConfigReviewReply> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Pure review of supplied snapshots and base. Do not read mutable files, environment, network or secrets here. Runs off the connection reader.
Source§

fn config_apply<'life0, 'async_trait>( &'life0 self, _view: ConfigView, ) -> Pin<Box<dyn Future<Output = Result<(), Vec<String>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Atomically apply a complete view, or leave the previous view intact and return secret-free NACK reasons. Readiness is included in a successful return. Runs off the reader; health and drain hooks remain independent.
Source§

fn config_files<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Use the module’s existing file reader. Called only for an opted-in module whose HELLO_ACK lacks config.gate, never after a gate refusal.
Source§

fn on_config_state<'life0, 'async_trait>( &'life0 self, _state: ConfigState, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Observe wire status and refusals without ending the serving connection.
Source§

fn on_config_error<'life0, 'async_trait>( &'life0 self, error: ConfigError, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Observe transport, malformed-reply and other config errors. These never authorize a file fallback or end the module connection.
Source§

fn on_bound<'life0, 'life1, 'async_trait>( &'life0 self, _handle: &'life1 RouteHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Called after an accepted bind ACK is queued and the handle is installed.
Source§

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HealthReport> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Return cheap in-memory health for the module. Read more
Source§

fn on_route_gone<'life0, 'life1, 'async_trait>( &'life0 self, _handle: &'life1 RouteHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

A route was torn down, rejected, or abandoned before its bind ACK was queued.
Source§

fn request_pools(&self) -> RequestPools

How this module’s data requests share handler slots. Called once per connection, before the serve loop reads its first frame after HELLO_ACK. Read more
Source§

fn on_draining<'life0, 'async_trait>( &'life0 self, _reason: RouteCloseReason, _deadline: SystemTime, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

The daemon has started draining this module: it will stop it for reason (a restart, reload, disable, or the daemon’s own shutdown), and has already stopped admitting new routes to it. Stop taking new work here and finish or hand off what is in flight; see the trait docs for how to keep the drain open while background work finishes. Read more
Source§

fn on_connection_end<'life0, 'async_trait>( &'life0 self, _end: ConnectionEnd, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

The connection ended orderly: a daemon GOODBYE is a planned stop, EOF or Reset means the daemon went away without one, and Closed is a module stop. Called once, after request tasks have finished or been cancelled. A module that wants a different exit code for an unannounced end can decide here. Not called for handler or protocol failures. A later, unexpected writer failure can still make serving return an error.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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