Skip to main content

PublishValidator

Struct PublishValidator 

Source
pub struct PublishValidator<'a> { /* private fields */ }
Expand description

Stateless publish request validator.

Runs §2.1 steps 1–8 (structural and cryptographic checks). Steps 9+ (identifier assignment, lineage, supersession, persistence) are registry-implementation concerns.

Implementations§

Source§

impl<'a> PublishValidator<'a>

Source

pub fn new(caps: &'a CapabilitiesDocument) -> Self

Create a validator without same-registry supersession enforcement.

Source

pub fn for_authority( caps: &'a CapabilitiesDocument, own_authority: &'a str, ) -> Self

Create a validator that rejects cross-registry supersession.

own_authority is the registry’s DNS authority (e.g. registry.example.com). When set, a publish request whose supersedes ctx_id has a different authority will be rejected with AcdpError::SupersededTarget / CrossRegistrySupersessionUnsupported (RFC-ACDP-0006 — v0.1.0 only allows same-registry supersession).

Source

pub fn validate_post_schema( &self, req: &PublishRequest, raw_body_bytes: usize, ) -> Result<ValidatedPublish, AcdpError>

Validate a publish request through the structural / cryptographic steps of RFC-ACDP-0003 §2.1, plus the cross-registry-supersession guard if the validator was built with Self::for_authority.

Mapped steps from RFC-ACDP-0003 §2.1:

  • Step 1 (schema validation) — assumed performed upstream (e.g. by validate_publish_request).
  • Step 2 (payload size vs limits.max_payload_bytes).
  • Step 3 (embedded size vs limits.max_embedded_bytes).
  • Step 4 (hash recomputation over ProducerContent).
  • Step 5 (signature algorithm vs supported_signature_algorithms).
  • Step 6 (key_id DID portion equals agent_id).
  • Step 7–8 (DID resolution + signature verification) — async, handled separately by acdp_verify::Verifier::verify_body.
  • Cross-registry supersession check (RFC-ACDP-0006): when an own-authority is configured, rejects supersedes targets on a different authority.
Source

pub fn validate_structural( &self, req: &PublishRequest, raw_body_bytes: usize, ) -> Result<ValidatedPublish, AcdpError>

👎Deprecated since 0.1.0:

Use validate_post_schema; this alias no longer skips runtime validation

Deprecated alias — now routes through Self::validate_post_schema.

The previous implementation skipped the schema-level validation (title length, metadata depth, DataRef integrity, did:web check, version coherence, …). Callers using validate_structural directly were silently bypassing those checks. The deprecated alias now runs the full pipeline so existing call sites remain safe; new code should call validate_post_schema explicitly.

Auto Trait Implementations§

§

impl<'a> Freeze for PublishValidator<'a>

§

impl<'a> RefUnwindSafe for PublishValidator<'a>

§

impl<'a> Send for PublishValidator<'a>

§

impl<'a> Sync for PublishValidator<'a>

§

impl<'a> Unpin for PublishValidator<'a>

§

impl<'a> UnsafeUnpin for PublishValidator<'a>

§

impl<'a> UnwindSafe for PublishValidator<'a>

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.

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.