Skip to main content

PubkeysEndpointLookup

Struct PubkeysEndpointLookup 

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

DEMOTED to convenience-only as of the gate-3 redesign (2026-09-13) — do NOT wire this as the default AttestationKeyLookup for verify_attestation/Client::verify_attestation. PinnedKeyMap is the default now. See the module-level “Design history” doc for why: fetching a verification key from the same service whose signature is being verified is architecturally circular — whoever controls /v1/pubkeys would control what “verifies.”

This type still fetches {base_url}/v1/pubkeys (the endpoint cleanlib-app publishes per cosign migration gate 1) and caches each key_id -> PEM pair for ttl, unauthenticated + no-store (same posture as /health). Its ONLY sanctioned use post-redesign is Self::describe_unknown_key — producing a human-readable advisory a caller can show a user when PinnedKeyMap doesn’t recognize a key_id, so they can go verify a fingerprint out of band. It must never feed a verify_attestation trust decision directly; AttestationKeyLookup::lookup_pem stays implemented here (so this type remains directly testable / usable standalone, e.g. by a caller building their own advisory UX), but verify_attestation’s DEFAULT path never reaches it.

Implementations§

Source§

impl PubkeysEndpointLookup

Source

pub fn new(base_url: &Url) -> Result<Self, CleanLibraryError>

base_url is the App origin (e.g. https://cleanapp.clnstrt.dev); this joins /v1/pubkeys per the gate-1 endpoint. Uses DEFAULT_PUBKEY_CACHE_TTL; see Self::with_ttl to override.

Source

pub fn with_ttl(self, ttl: Duration) -> Self

Source

pub async fn describe_unknown_key(&self, key_id: &str) -> Option<String>

Convenience-only advisory (see the type doc): when PinnedKeyMap doesn’t recognize a key_id, a caller MAY use this to look up whether /v1/pubkeys reports that key_id anyway, and produce a human-readable hint — “this key_id exists on the server, go verify its fingerprint out of band before deciding whether to pin it.” This NEVER returns a verified/trusted signal and must NEVER be fed into a trust decision — it only ever produces advisory text (Option<String>), never a PEM, never a bool, precisely so it cannot be mistaken for a verify result.

Returns None if the server is unreachable or doesn’t recognize the key_id either — absence of an advisory is not itself a security signal in either direction.

Trait Implementations§

Source§

impl AttestationKeyLookup for PubkeysEndpointLookup

Source§

fn lookup_pem<'life0, 'life1, 'async_trait>( &'life0 self, key_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, CleanLibraryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve key_id (the exact string carried on SignedAttestation.key_id — the full KMS key-version resource path, e.g. projects/.../cryptoKeys/cleanlib-cosign-staging/cryptoKeyVersions/1) to a PEM-encoded SubjectPublicKeyInfo. Implementations should treat a “no such key_id” answer as AttestationInvalid (permanent — retrying the same key_id against the same catalog will not help) and a network/5xx failure as Transport (transient — retry may succeed).
Source§

impl Clone for PubkeysEndpointLookup

Source§

fn clone(&self) -> PubkeysEndpointLookup

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 PubkeysEndpointLookup

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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