//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/join-requests/submit`. Version: `0.3`.
/// Why this specification version is deprecated (SPEC "Superseded and
/// Withdrawn Versions"), or `None` while it is current.
pub const DEPRECATION: Option<&str> = None;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
/// Error from a `TryFrom` or `FromStr` implementation.
pub struct ConversionError(::std::borrow::Cow<'static, str>);
impl ::std::error::Error for ConversionError {}
impl ::std::fmt::Display for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Display::fmt(&self.0, f)
}
}
impl ::std::fmt::Debug for ConversionError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
::std::fmt::Debug::fmt(&self.0, f)
}
}
impl From<&'static str> for ConversionError {
fn from(value: &'static str) -> Self {
Self(value.into())
}
}
impl From<String> for ConversionError {
fn from(value: String) -> Self {
Self(value.into())
}
}
}
/**
A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.
Multihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.
This definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.
Restricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that "interoperability is not guaranteed between implementations using such values", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.*/
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct DigestMultibase(::std::string::String);
impl ::std::ops::Deref for DigestMultibase {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<DigestMultibase> for ::std::string::String {
fn from(value: DigestMultibase) -> Self {
value.0
}
}
impl ::std::str::FromStr for DigestMultibase {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 16usize {
return Err("shorter than 16 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\"".into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for DigestMultibase {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for DigestMultibase {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for DigestMultibase {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for DigestMultibase {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
&self.0
}
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
fn from(value: Ext) -> Self {
value.0
}
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
Self(value)
}
}
///`ExtKey`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
fn from(value: ExtKey) -> Self {
value.0
}
}
impl ::std::str::FromStr for ExtKey {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`Payload`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///The applicant's answers to the manifest's `requestedAttributes`: one entry per attribute given. Self-asserted and bound to the applicant by the document proof. A maintainer MUST refuse the submission with `attributesMissing` when a required attribute is absent and with `attributesUnrequested` when an entry names a type the manifest does not request.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub attributes: ::std::vec::Vec<PayloadAttributesItem>,
///The `requirementsDigest` of the criterion this submission is made under, as vtc/join-requests/manifest (0.3 or later) published it. Absent: the community decides the submission under the first criterion, in the order it publishes them, that the submission meets.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub criterion: ::std::option::Option<DigestMultibase>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Opaque applicant-supplied extension bag.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub extensions: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///Whether the applicant consents to trust-registry publication.
#[serde(
rename = "registryConsent",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub registry_consent: ::std::option::Option<bool>,
///The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field.
pub vp: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///`PayloadAttributesItem`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PayloadAttributesItem {
///A claim-type token from the persona claim-type registry (persona/_shared/0.1/CLAIM-TYPES.md) — `name.display`, `address.country` — or an `x:` extension token.
#[serde(rename = "type")]
pub type_: PayloadAttributesItemType,
///The value the applicant gives. Self-asserted: the applicant's own statement, bound to them by the document proof, and attested by nobody.
pub value: ::serde_json::Value,
}
impl PayloadAttributesItem {
pub fn builder() -> builder::PayloadAttributesItem {
Default::default()
}
}
///A claim-type token from the persona claim-type registry (persona/_shared/0.1/CLAIM-TYPES.md) — `name.display`, `address.country` — or an `x:` extension token.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadAttributesItemType(::std::string::String);
impl ::std::ops::Deref for PayloadAttributesItemType {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadAttributesItemType> for ::std::string::String {
fn from(value: PayloadAttributesItemType) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadAttributesItemType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^(x:)?[a-z][A-Za-z0-9]*(\\.[a-z][A-Za-z0-9]*)*$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^(x:)?[a-z][A-Za-z0-9]*(\\.[a-z][A-Za-z0-9]*)*$\"".into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadAttributesItemType {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for PayloadAttributesItemType {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for PayloadAttributesItemType {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for PayloadAttributesItemType {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`Response`
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Id of the created join request (a UUID).
#[serde(rename = "requestId")]
pub request_id: ResponseRequestId,
/**
What the community decided about this submission.
`0.1` returned `status: "pending"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.*/
pub verdict: Verdict,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Id of the created join request (a UUID).
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseRequestId(::std::string::String);
impl ::std::ops::Deref for ResponseRequestId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseRequestId> for ::std::string::String {
fn from(value: ResponseRequestId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseRequestId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseRequestId {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for ResponseRequestId {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for ResponseRequestId {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for ResponseRequestId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A ceremony decision: the effect, plus its effect-dependent detail.
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Verdict {
pub effect: VerdictEffect,
pub with: VerdictWith,
}
impl Verdict {
pub fn builder() -> builder::Verdict {
Default::default()
}
}
/**
What the policy decided.
`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.
The four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.*/
///
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum VerdictEffect {
#[serde(rename = "allow")]
Allow,
#[serde(rename = "deny")]
Deny,
#[serde(rename = "refer")]
Refer,
#[serde(rename = "requestMore")]
RequestMore,
}
impl ::std::fmt::Display for VerdictEffect {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Allow => f.write_str("allow"),
Self::Deny => f.write_str("deny"),
Self::Refer => f.write_str("refer"),
Self::RequestMore => f.write_str("requestMore"),
}
}
}
impl ::std::str::FromStr for VerdictEffect {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"allow" => Ok(Self::Allow),
"deny" => Ok(Self::Deny),
"refer" => Ok(Self::Refer),
"requestMore" => Ok(Self::RequestMore),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for VerdictEffect {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for VerdictEffect {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for VerdictEffect {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
The effect-dependent detail of a verdict.
Every member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.*/
///
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct VerdictWith {
///Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.
#[serde(
rename = "bundleRef",
default,
skip_serializing_if = "::serde_json::Map::is_empty"
)]
pub bundle_ref: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///Stable refusal code, safe to branch on. `deny` only.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub code: ::std::option::Option<VerdictWithCode>,
///What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub needs: ::std::vec::Vec<VerdictWithNeedsItem>,
///Conditions attached to the grant. `allow` only.
#[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")]
pub obligations: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.
#[serde(
rename = "presentationDefinition",
default,
skip_serializing_if = "::serde_json::Map::is_empty"
)]
pub presentation_definition: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub queue: ::std::option::Option<VerdictWithQueue>,
///Elaboration in prose, when the decider gave one. `deny` and `refer`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub reason: ::std::option::Option<VerdictWithReason>,
///The granted local role. `allow` only.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub role: ::std::option::Option<VerdictWithRole>,
}
impl ::std::default::Default for VerdictWith {
fn default() -> Self {
Self {
bundle_ref: Default::default(),
code: Default::default(),
needs: Default::default(),
obligations: Default::default(),
presentation_definition: Default::default(),
queue: Default::default(),
reason: Default::default(),
role: Default::default(),
}
}
}
impl VerdictWith {
pub fn builder() -> builder::VerdictWith {
Default::default()
}
}
///Stable refusal code, safe to branch on. `deny` only.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithCode(::std::string::String);
impl ::std::ops::Deref for VerdictWithCode {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithCode> for ::std::string::String {
fn from(value: VerdictWithCode) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithCode {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for VerdictWithCode {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for VerdictWithCode {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for VerdictWithCode {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for VerdictWithCode {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///`VerdictWithNeedsItem`
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithNeedsItem(::std::string::String);
impl ::std::ops::Deref for VerdictWithNeedsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithNeedsItem> for ::std::string::String {
fn from(value: VerdictWithNeedsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithNeedsItem {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for VerdictWithNeedsItem {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for VerdictWithNeedsItem {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for VerdictWithNeedsItem {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for VerdictWithNeedsItem {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithQueue(::std::string::String);
impl ::std::ops::Deref for VerdictWithQueue {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithQueue> for ::std::string::String {
fn from(value: VerdictWithQueue) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithQueue {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for VerdictWithQueue {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for VerdictWithQueue {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for VerdictWithQueue {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for VerdictWithQueue {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///Elaboration in prose, when the decider gave one. `deny` and `refer`.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithReason(::std::string::String);
impl ::std::ops::Deref for VerdictWithReason {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithReason> for ::std::string::String {
fn from(value: VerdictWithReason) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithReason {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 1024usize {
return Err("longer than 1024 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for VerdictWithReason {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for VerdictWithReason {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for VerdictWithReason {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for VerdictWithReason {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The granted local role. `allow` only.
///
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct VerdictWithRole(::std::string::String);
impl ::std::ops::Deref for VerdictWithRole {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<VerdictWithRole> for ::std::string::String {
fn from(value: VerdictWithRole) -> Self {
value.0
}
}
impl ::std::str::FromStr for VerdictWithRole {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for VerdictWithRole {
type Error = self::error::ConversionError;
fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<&::std::string::String> for VerdictWithRole {
type Error = self::error::ConversionError;
fn try_from(
value: &::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl ::std::convert::TryFrom<::std::string::String> for VerdictWithRole {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
impl<'de> ::serde::Deserialize<'de> for VerdictWithRole {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
attributes: ::std::result::Result<
::std::vec::Vec<super::PayloadAttributesItem>,
::std::string::String,
>,
criterion: ::std::result::Result<
::std::option::Option<super::DigestMultibase>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
extensions: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
registry_consent: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
vp: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
attributes: Ok(Default::default()),
criterion: Ok(Default::default()),
ext: Ok(Default::default()),
extensions: Ok(Default::default()),
registry_consent: Ok(Default::default()),
vp: Err("no value supplied for vp".to_string()),
}
}
}
impl Payload {
pub fn attributes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::PayloadAttributesItem>>,
T::Error: ::std::fmt::Display,
{
self.attributes = value
.try_into()
.map_err(|e| format!("error converting supplied value for attributes: {e}"));
self
}
pub fn criterion<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::DigestMultibase>>,
T::Error: ::std::fmt::Display,
{
self.criterion = value
.try_into()
.map_err(|e| format!("error converting supplied value for criterion: {e}"));
self
}
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn extensions<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
>,
T::Error: ::std::fmt::Display,
{
self.extensions = value
.try_into()
.map_err(|e| format!("error converting supplied value for extensions: {e}"));
self
}
pub fn registry_consent<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.registry_consent = value
.try_into()
.map_err(|e| format!("error converting supplied value for registry_consent: {e}"));
self
}
pub fn vp<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
>,
T::Error: ::std::fmt::Display,
{
self.vp = value
.try_into()
.map_err(|e| format!("error converting supplied value for vp: {e}"));
self
}
}
impl ::std::convert::TryFrom<Payload> for super::Payload {
type Error = super::error::ConversionError;
fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
attributes: value.attributes?,
criterion: value.criterion?,
ext: value.ext?,
extensions: value.extensions?,
registry_consent: value.registry_consent?,
vp: value.vp?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
attributes: Ok(value.attributes),
criterion: Ok(value.criterion),
ext: Ok(value.ext),
extensions: Ok(value.extensions),
registry_consent: Ok(value.registry_consent),
vp: Ok(value.vp),
}
}
}
#[derive(Clone, Debug)]
pub struct PayloadAttributesItem {
type_: ::std::result::Result<super::PayloadAttributesItemType, ::std::string::String>,
value: ::std::result::Result<::serde_json::Value, ::std::string::String>,
}
impl ::std::default::Default for PayloadAttributesItem {
fn default() -> Self {
Self {
type_: Err("no value supplied for type_".to_string()),
value: Err("no value supplied for value".to_string()),
}
}
}
impl PayloadAttributesItem {
pub fn type_<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadAttributesItemType>,
T::Error: ::std::fmt::Display,
{
self.type_ = value
.try_into()
.map_err(|e| format!("error converting supplied value for type_: {e}"));
self
}
pub fn value<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.value = value
.try_into()
.map_err(|e| format!("error converting supplied value for value: {e}"));
self
}
}
impl ::std::convert::TryFrom<PayloadAttributesItem> for super::PayloadAttributesItem {
type Error = super::error::ConversionError;
fn try_from(
value: PayloadAttributesItem,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
type_: value.type_?,
value: value.value?,
})
}
}
impl ::std::convert::From<super::PayloadAttributesItem> for PayloadAttributesItem {
fn from(value: super::PayloadAttributesItem) -> Self {
Self {
type_: Ok(value.type_),
value: Ok(value.value),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
request_id: ::std::result::Result<super::ResponseRequestId, ::std::string::String>,
verdict: ::std::result::Result<super::Verdict, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
request_id: Err("no value supplied for request_id".to_string()),
verdict: Err("no value supplied for verdict".to_string()),
}
}
}
impl Response {
pub fn ext<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
T::Error: ::std::fmt::Display,
{
self.ext = value
.try_into()
.map_err(|e| format!("error converting supplied value for ext: {e}"));
self
}
pub fn request_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseRequestId>,
T::Error: ::std::fmt::Display,
{
self.request_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for request_id: {e}"));
self
}
pub fn verdict<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Verdict>,
T::Error: ::std::fmt::Display,
{
self.verdict = value
.try_into()
.map_err(|e| format!("error converting supplied value for verdict: {e}"));
self
}
}
impl ::std::convert::TryFrom<Response> for super::Response {
type Error = super::error::ConversionError;
fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
ext: value.ext?,
request_id: value.request_id?,
verdict: value.verdict?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
ext: Ok(value.ext),
request_id: Ok(value.request_id),
verdict: Ok(value.verdict),
}
}
}
#[derive(Clone, Debug)]
pub struct Verdict {
effect: ::std::result::Result<super::VerdictEffect, ::std::string::String>,
with: ::std::result::Result<super::VerdictWith, ::std::string::String>,
}
impl ::std::default::Default for Verdict {
fn default() -> Self {
Self {
effect: Err("no value supplied for effect".to_string()),
with: Err("no value supplied for with".to_string()),
}
}
}
impl Verdict {
pub fn effect<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::VerdictEffect>,
T::Error: ::std::fmt::Display,
{
self.effect = value
.try_into()
.map_err(|e| format!("error converting supplied value for effect: {e}"));
self
}
pub fn with<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::VerdictWith>,
T::Error: ::std::fmt::Display,
{
self.with = value
.try_into()
.map_err(|e| format!("error converting supplied value for with: {e}"));
self
}
}
impl ::std::convert::TryFrom<Verdict> for super::Verdict {
type Error = super::error::ConversionError;
fn try_from(value: Verdict) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
effect: value.effect?,
with: value.with?,
})
}
}
impl ::std::convert::From<super::Verdict> for Verdict {
fn from(value: super::Verdict) -> Self {
Self {
effect: Ok(value.effect),
with: Ok(value.with),
}
}
}
#[derive(Clone, Debug)]
pub struct VerdictWith {
bundle_ref: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
code: ::std::result::Result<
::std::option::Option<super::VerdictWithCode>,
::std::string::String,
>,
needs: ::std::result::Result<
::std::vec::Vec<super::VerdictWithNeedsItem>,
::std::string::String,
>,
obligations: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
presentation_definition: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
queue: ::std::result::Result<
::std::option::Option<super::VerdictWithQueue>,
::std::string::String,
>,
reason: ::std::result::Result<
::std::option::Option<super::VerdictWithReason>,
::std::string::String,
>,
role: ::std::result::Result<
::std::option::Option<super::VerdictWithRole>,
::std::string::String,
>,
}
impl ::std::default::Default for VerdictWith {
fn default() -> Self {
Self {
bundle_ref: Ok(Default::default()),
code: Ok(Default::default()),
needs: Ok(Default::default()),
obligations: Ok(Default::default()),
presentation_definition: Ok(Default::default()),
queue: Ok(Default::default()),
reason: Ok(Default::default()),
role: Ok(Default::default()),
}
}
}
impl VerdictWith {
pub fn bundle_ref<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
>,
T::Error: ::std::fmt::Display,
{
self.bundle_ref = value
.try_into()
.map_err(|e| format!("error converting supplied value for bundle_ref: {e}"));
self
}
pub fn code<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithCode>>,
T::Error: ::std::fmt::Display,
{
self.code = value
.try_into()
.map_err(|e| format!("error converting supplied value for code: {e}"));
self
}
pub fn needs<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::VerdictWithNeedsItem>>,
T::Error: ::std::fmt::Display,
{
self.needs = value
.try_into()
.map_err(|e| format!("error converting supplied value for needs: {e}"));
self
}
pub fn obligations<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
>,
T::Error: ::std::fmt::Display,
{
self.obligations = value
.try_into()
.map_err(|e| format!("error converting supplied value for obligations: {e}"));
self
}
pub fn presentation_definition<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
>,
T::Error: ::std::fmt::Display,
{
self.presentation_definition = value.try_into().map_err(|e| {
format!("error converting supplied value for presentation_definition: {e}")
});
self
}
pub fn queue<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithQueue>>,
T::Error: ::std::fmt::Display,
{
self.queue = value
.try_into()
.map_err(|e| format!("error converting supplied value for queue: {e}"));
self
}
pub fn reason<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithReason>>,
T::Error: ::std::fmt::Display,
{
self.reason = value
.try_into()
.map_err(|e| format!("error converting supplied value for reason: {e}"));
self
}
pub fn role<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::VerdictWithRole>>,
T::Error: ::std::fmt::Display,
{
self.role = value
.try_into()
.map_err(|e| format!("error converting supplied value for role: {e}"));
self
}
}
impl ::std::convert::TryFrom<VerdictWith> for super::VerdictWith {
type Error = super::error::ConversionError;
fn try_from(
value: VerdictWith,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bundle_ref: value.bundle_ref?,
code: value.code?,
needs: value.needs?,
obligations: value.obligations?,
presentation_definition: value.presentation_definition?,
queue: value.queue?,
reason: value.reason?,
role: value.role?,
})
}
}
impl ::std::convert::From<super::VerdictWith> for VerdictWith {
fn from(value: super::VerdictWith) -> Self {
Self {
bundle_ref: Ok(value.bundle_ref),
code: Ok(value.code),
needs: Ok(value.needs),
obligations: Ok(value.obligations),
presentation_definition: Ok(value.presentation_definition),
queue: Ok(value.queue),
reason: Ok(value.reason),
role: Ok(value.role),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/join-requests/submit/0.3";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"DigestMultibase\":{\"description\":\"A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\\n\\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\\n\\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\\n\\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \\\"interoperability is not guaranteed between implementations using such values\\\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.\",\"examples\":[\"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\"],\"minLength\":16,\"pattern\":\"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\",\"title\":\"DigestMultibase\",\"type\":\"string\"},\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"requestId\":{\"description\":\"Id of the created join request (a UUID).\",\"minLength\":1,\"type\":\"string\"},\"verdict\":{\"$ref\":\"#/$defs/Verdict\",\"description\":\"What the community decided about this submission.\\n\\n`0.1` returned `status: \\\"pending\\\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.\"}},\"required\":[\"requestId\",\"verdict\"],\"title\":\"VTC Join-Requests Submit — response payload\",\"type\":\"object\"},\"Verdict\":{\"$anchor\":\"verdict\",\"additionalProperties\":false,\"description\":\"A ceremony decision: the effect, plus its effect-dependent detail.\",\"properties\":{\"effect\":{\"$ref\":\"#/$defs/VerdictEffect\"},\"with\":{\"$ref\":\"#/$defs/VerdictWith\"}},\"required\":[\"effect\",\"with\"],\"title\":\"Verdict\",\"type\":\"object\"},\"VerdictEffect\":{\"$anchor\":\"verdictEffect\",\"description\":\"What the policy decided.\\n\\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\\n\\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.\",\"enum\":[\"allow\",\"deny\",\"refer\",\"requestMore\"],\"title\":\"VerdictEffect\",\"type\":\"string\"},\"VerdictWith\":{\"$anchor\":\"verdictWith\",\"additionalProperties\":false,\"description\":\"The effect-dependent detail of a verdict.\\n\\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.\",\"properties\":{\"bundleRef\":{\"description\":\"Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.\",\"type\":\"object\"},\"code\":{\"description\":\"Stable refusal code, safe to branch on. `deny` only.\",\"minLength\":1,\"type\":\"string\"},\"needs\":{\"description\":\"What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.\",\"items\":{\"minLength\":1,\"type\":\"string\"},\"type\":\"array\"},\"obligations\":{\"description\":\"Conditions attached to the grant. `allow` only.\",\"type\":\"object\"},\"presentationDefinition\":{\"description\":\"A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.\",\"type\":\"object\"},\"queue\":{\"description\":\"Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.\",\"minLength\":1,\"type\":\"string\"},\"reason\":{\"description\":\"Elaboration in prose, when the decider gave one. `deny` and `refer`.\",\"maxLength\":1024,\"type\":[\"string\",\"null\"]},\"role\":{\"description\":\"The granted local role. `allow` only.\",\"minLength\":1,\"type\":\"string\"}},\"title\":\"VerdictWith\",\"type\":\"object\"}},\"$id\":\"https://trusttasks.org/spec/vtc/join-requests/submit/0.3\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"additionalProperties\":false,\"properties\":{\"attributes\":{\"description\":\"The applicant's answers to the manifest's `requestedAttributes`: one entry per attribute given. Self-asserted and bound to the applicant by the document proof. A maintainer MUST refuse the submission with `attributesMissing` when a required attribute is absent and with `attributesUnrequested` when an entry names a type the manifest does not request.\",\"items\":{\"additionalProperties\":false,\"properties\":{\"type\":{\"description\":\"A claim-type token from the persona claim-type registry (persona/_shared/0.1/CLAIM-TYPES.md) — `name.display`, `address.country` — or an `x:` extension token.\",\"maxLength\":128,\"minLength\":1,\"pattern\":\"^(x:)?[a-z][A-Za-z0-9]*(\\\\.[a-z][A-Za-z0-9]*)*$\",\"type\":\"string\"},\"value\":{\"description\":\"The value the applicant gives. Self-asserted: the applicant's own statement, bound to them by the document proof, and attested by nobody.\"}},\"required\":[\"type\",\"value\"],\"type\":\"object\"},\"maxItems\":32,\"type\":\"array\"},\"criterion\":{\"$ref\":\"#/$defs/DigestMultibase\",\"description\":\"The `requirementsDigest` of the criterion this submission is made under, as vtc/join-requests/manifest (0.3 or later) published it. Absent: the community decides the submission under the first criterion, in the order it publishes them, that the submission meets.\"},\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"extensions\":{\"description\":\"Opaque applicant-supplied extension bag.\",\"type\":\"object\"},\"registryConsent\":{\"description\":\"Whether the applicant consents to trust-registry publication.\",\"type\":\"boolean\"},\"vp\":{\"description\":\"The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field.\",\"type\":\"object\"}},\"required\":[\"vp\"],\"title\":\"VTC Join-Requests Submit — payload\",\"type\":\"object\"}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/vtc/join-requests/submit/0.3#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\"$defs\":{\"DigestMultibase\":{\"description\":\"A cryptographic digest as a multibase-encoded multihash — the encoding the W3C Verifiable Credentials Data Model 2.0 defines for `digestMultibase`, and the one `did:webvh` uses for its SCID and entry hashes.\\n\\nMultihash carries the hash algorithm in-band, so the value is self-describing and the wire format survives an algorithm change without a schema revision; multibase does the same for the base encoding, so a verifier never infers base58 from base64url by context. A bare hex string or a `sha-256:`-style prefix hard-codes one algorithm into the wire contract and is non-conforming here.\\n\\nThis definition constrains the *encoding only*. What the digest is computed over is stated by each referencing field, because it differs legitimately: a digest over a JSON document is taken over its RFC 8785 (JCS) canonicalization, while a digest over an opaque artifact is taken over its bytes. A field whose input is a JSON document and which does not name a canonicalization is not reproducible.\\n\\nRestricted to the two multibase headers W3C Controlled Identifiers 1.0 §2.4 normatively requires — `z` (base58btc) and `u` (base64url-no-pad). CID permits others but states that \\\"interoperability is not guaranteed between implementations using such values\\\", and a registry whose purpose is interoperability should not mint digests a conforming verifier may be unable to read. The alphabets are enforced rather than assumed: base58btc excludes 0, O, I and l, and an earlier permissive pattern let three published examples carry digests that were not valid base58 at all. base58btc is RECOMMENDED, for consistency with `did:key` and `did:webvh`.\",\"examples\":[\"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\"],\"minLength\":16,\"pattern\":\"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\",\"title\":\"DigestMultibase\",\"type\":\"string\"},\"Ext\":{\"additionalProperties\":true,\"description\":\"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\"minProperties\":1,\"propertyNames\":{\"pattern\":\"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"},\"title\":\"Ext\",\"type\":\"object\"},\"Response\":{\"$anchor\":\"response\",\"additionalProperties\":false,\"properties\":{\"ext\":{\"$ref\":\"#/$defs/Ext\"},\"requestId\":{\"description\":\"Id of the created join request (a UUID).\",\"minLength\":1,\"type\":\"string\"},\"verdict\":{\"$ref\":\"#/$defs/Verdict\",\"description\":\"What the community decided about this submission.\\n\\n`0.1` returned `status: \\\"pending\\\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.\"}},\"required\":[\"requestId\",\"verdict\"],\"title\":\"VTC Join-Requests Submit — response payload\",\"type\":\"object\"},\"Verdict\":{\"$anchor\":\"verdict\",\"additionalProperties\":false,\"description\":\"A ceremony decision: the effect, plus its effect-dependent detail.\",\"properties\":{\"effect\":{\"$ref\":\"#/$defs/VerdictEffect\"},\"with\":{\"$ref\":\"#/$defs/VerdictWith\"}},\"required\":[\"effect\",\"with\"],\"title\":\"Verdict\",\"type\":\"object\"},\"VerdictEffect\":{\"$anchor\":\"verdictEffect\",\"description\":\"What the policy decided.\\n\\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\\n\\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.\",\"enum\":[\"allow\",\"deny\",\"refer\",\"requestMore\"],\"title\":\"VerdictEffect\",\"type\":\"string\"},\"VerdictWith\":{\"$anchor\":\"verdictWith\",\"additionalProperties\":false,\"description\":\"The effect-dependent detail of a verdict.\\n\\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.\",\"properties\":{\"bundleRef\":{\"description\":\"Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.\",\"type\":\"object\"},\"code\":{\"description\":\"Stable refusal code, safe to branch on. `deny` only.\",\"minLength\":1,\"type\":\"string\"},\"needs\":{\"description\":\"What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.\",\"items\":{\"minLength\":1,\"type\":\"string\"},\"type\":\"array\"},\"obligations\":{\"description\":\"Conditions attached to the grant. `allow` only.\",\"type\":\"object\"},\"presentationDefinition\":{\"description\":\"A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.\",\"type\":\"object\"},\"queue\":{\"description\":\"Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.\",\"minLength\":1,\"type\":\"string\"},\"reason\":{\"description\":\"Elaboration in prose, when the decider gave one. `deny` and `refer`.\",\"maxLength\":1024,\"type\":[\"string\",\"null\"]},\"role\":{\"description\":\"The granted local role. `allow` only.\",\"minLength\":1,\"type\":\"string\"}},\"title\":\"VerdictWith\",\"type\":\"object\"}},\"$ref\":\"#/$defs/Response\",\"$schema\":\"https://json-schema.org/draft/2020-12/schema\"}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// The earlier `MAJOR.MINOR` of this slug that this version declares it
/// extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
/// `None`. Only the direct declaration; walk a chain with
/// [`crate::extension::extends_for`].
pub const EXTENDS: Option<&str> = None;
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[
error_codes::POLICY_UNSATISFIED,
error_codes::CRITERION_UNKNOWN,
error_codes::NOT_ACCEPTING,
error_codes::PRESENTATION_INVALID,
error_codes::ATTRIBUTES_MISSING,
error_codes::ATTRIBUTES_UNREQUESTED,
error_codes::CHALLENGE_NOT_ISSUED,
error_codes::CHALLENGE_ALREADY_USED,
error_codes::CHALLENGE_EXPIRED,
error_codes::CHALLENGE_MISMATCH,
];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
/// `vtc/join-requests/submit:policyUnsatisfied`
///
/// The submission does not meet the criterion it is made under, and the community refuses it rather than asking for more.
///
/// Declared `retryable: false`.
pub const POLICY_UNSATISFIED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:policyUnsatisfied",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/join-requests/submit:criterionUnknown`
///
/// `criterion` names no criterion the community publishes, nor an earlier version still within its `requirementsGrace`. The applicant reads the manifest again and resubmits under a current criterion.
///
/// Declared `retryable: false`.
pub const CRITERION_UNKNOWN: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:criterionUnknown",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/join-requests/submit:notAccepting`
///
/// The community publishes no criteria, so it accepts no applications at present.
///
/// Declared `retryable: false`.
pub const NOT_ACCEPTING: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:notAccepting",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/join-requests/submit:presentationInvalid`
///
/// The Verifiable Presentation failed verification, or its holder did not match the proof signer.
///
/// Declared `retryable: false`.
pub const PRESENTATION_INVALID: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:presentationInvalid",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/join-requests/submit:attributesMissing`
///
/// The manifest's `requestedAttributes` marks an attribute required and `attributes` does not answer it. The details name the missing types so the applicant can supply them and resubmit.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const ATTRIBUTES_MISSING: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:attributesMissing",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"types\":{\"items\":{\"type\":\"string\"},\"maxItems\":32,\"type\":\"array\"}},\"required\":[\"types\"],\"type\":\"object\"}",
),
};
/// `vtc/join-requests/submit:attributesUnrequested`
///
/// An entry in `attributes` names a type the manifest does not request. Refused rather than stored, so a client that over-shares cannot leave an applicant's data with a community that never asked for it. The details name the types.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const ATTRIBUTES_UNREQUESTED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:attributesUnrequested",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"types\":{\"items\":{\"type\":\"string\"},\"maxItems\":32,\"type\":\"array\"}},\"required\":[\"types\"],\"type\":\"object\"}",
),
};
/// `vtc/join-requests/submit:challengeNotIssued`
///
/// The submission's hidden-vetting proof is bound to a challenge, but the community holds no challenge for the applicant's DID — none was requested, or it expired and has since been discarded. The applicant requests a new challenge over `vtc/vetting/pcs-challenge`, builds the proof over it, and sends again.
///
/// Declared `retryable: false`.
pub const CHALLENGE_NOT_ISSUED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:challengeNotIssued",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/join-requests/submit:challengeAlreadyUsed`
///
/// The challenge the proof is bound to was spent by an earlier submission or supplement. Challenges are single-use. The applicant requests a new one, rebuilds the proof, and sends again.
///
/// Declared `retryable: false`.
pub const CHALLENGE_ALREADY_USED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:challengeAlreadyUsed",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `vtc/join-requests/submit:challengeExpired`
///
/// The challenge the proof is bound to is past its `expiresAt`. The details MAY carry `expiredAt`. The applicant requests a new one, rebuilds the proof, and sends again.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const CHALLENGE_EXPIRED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:challengeExpired",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"properties\":{\"expiredAt\":{\"format\":\"date-time\",\"type\":\"string\"}},\"type\":\"object\"}",
),
};
/// `vtc/join-requests/submit:challengeMismatch`
///
/// The proof is bound to a challenge other than the one the community holds open for this applicant — typically one it replaced when the applicant asked again. This attempt spends the open challenge. The applicant requests a new one, rebuilds the proof, and sends again.
///
/// Declared `retryable: false`.
pub const CHALLENGE_MISMATCH: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/join-requests/submit:challengeMismatch",
retryable: false,
details_schema: ::core::option::Option::None,
};
}