//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `vtc/credentials/reissue`. Version: `0.1`.
#[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())
}
}
}
///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.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ext",
/// "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.",
/// "type": "object",
/// "minProperties": 1,
/// "additionalProperties": true,
/// "propertyNames": {
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
/// }
///}
/// ```
/// </details>
#[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`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///}
/// ```
/// </details>
#[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())
})
}
}
///Ask a VTC to re-sign its status lists and re-issue the attestation artefacts still in force that an attestation key revoked for compromise signed, under the community's current attestation key. Re-sending the same request returns the progress of the job it started.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/vtc/credentials/reissue/0.1",
/// "title": "Payload",
/// "description": "Ask a VTC to re-sign its status lists and re-issue the attestation artefacts still in force that an attestation key revoked for compromise signed, under the community's current attestation key. Re-sending the same request returns the progress of the job it started.",
/// "type": "object",
/// "required": [
/// "cause"
/// ],
/// "properties": {
/// "cause": {
/// "description": "The revocation that requires re-issuance. The VTC MUST verify it against its own DID's key roles (vta/webvh/dids/keys/list) rather than trust it.",
/// "type": "object",
/// "required": [
/// "verificationMethod"
/// ],
/// "properties": {
/// "rotationId": {
/// "description": "The VTA's rotation record (`kind: compromise`) for the revocation, when known.",
/// "type": "string",
/// "minLength": 1
/// },
/// "verificationMethod": {
/// "description": "The attestation key of the community's DID that was revoked for compromise.",
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "additionalProperties": false
/// },
/// "dryRun": {
/// "description": "Report what would be re-signed and re-issued, without doing it. Absent reads as false.",
/// "type": "boolean"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "scope": {
/// "description": "`all` (the default) re-signs status lists first and then re-issues artefacts. `statusListsOnly` re-signs status lists and stops — for an operator who must restore status checking within minutes and schedule the rest.",
/// "type": "string",
/// "enum": [
/// "all",
/// "statusListsOnly"
/// ]
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
pub cause: PayloadCause,
///Report what would be re-signed and re-issued, without doing it. Absent reads as false.
#[serde(
rename = "dryRun",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub dry_run: ::std::option::Option<bool>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///`all` (the default) re-signs status lists first and then re-issues artefacts. `statusListsOnly` re-signs status lists and stops — for an operator who must restore status checking within minutes and schedule the rest.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub scope: ::std::option::Option<PayloadScope>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The revocation that requires re-issuance. The VTC MUST verify it against its own DID's key roles (vta/webvh/dids/keys/list) rather than trust it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The revocation that requires re-issuance. The VTC MUST verify it against its own DID's key roles (vta/webvh/dids/keys/list) rather than trust it.",
/// "type": "object",
/// "required": [
/// "verificationMethod"
/// ],
/// "properties": {
/// "rotationId": {
/// "description": "The VTA's rotation record (`kind: compromise`) for the revocation, when known.",
/// "type": "string",
/// "minLength": 1
/// },
/// "verificationMethod": {
/// "description": "The attestation key of the community's DID that was revoked for compromise.",
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct PayloadCause {
///The VTA's rotation record (`kind: compromise`) for the revocation, when known.
#[serde(
rename = "rotationId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub rotation_id: ::std::option::Option<PayloadCauseRotationId>,
///The attestation key of the community's DID that was revoked for compromise.
#[serde(rename = "verificationMethod")]
pub verification_method: PayloadCauseVerificationMethod,
}
impl PayloadCause {
pub fn builder() -> builder::PayloadCause {
Default::default()
}
}
///The VTA's rotation record (`kind: compromise`) for the revocation, when known.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The VTA's rotation record (`kind: compromise`) for the revocation, when known.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadCauseRotationId(::std::string::String);
impl ::std::ops::Deref for PayloadCauseRotationId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadCauseRotationId> for ::std::string::String {
fn from(value: PayloadCauseRotationId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadCauseRotationId {
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 PayloadCauseRotationId {
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 PayloadCauseRotationId {
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 PayloadCauseRotationId {
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 PayloadCauseRotationId {
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 attestation key of the community's DID that was revoked for compromise.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The attestation key of the community's DID that was revoked for compromise.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadCauseVerificationMethod(::std::string::String);
impl ::std::ops::Deref for PayloadCauseVerificationMethod {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadCauseVerificationMethod> for ::std::string::String {
fn from(value: PayloadCauseVerificationMethod) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadCauseVerificationMethod {
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 PayloadCauseVerificationMethod {
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 PayloadCauseVerificationMethod {
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 PayloadCauseVerificationMethod {
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 PayloadCauseVerificationMethod {
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())
})
}
}
///`all` (the default) re-signs status lists first and then re-issues artefacts. `statusListsOnly` re-signs status lists and stops — for an operator who must restore status checking within minutes and schedule the rest.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`all` (the default) re-signs status lists first and then re-issues artefacts. `statusListsOnly` re-signs status lists and stops — for an operator who must restore status checking within minutes and schedule the rest.",
/// "type": "string",
/// "enum": [
/// "all",
/// "statusListsOnly"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum PayloadScope {
#[serde(rename = "all")]
All,
#[serde(rename = "statusListsOnly")]
StatusListsOnly,
}
impl ::std::fmt::Display for PayloadScope {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::All => f.write_str("all"),
Self::StatusListsOnly => f.write_str("statusListsOnly"),
}
}
}
impl ::std::str::FromStr for PayloadScope {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"all" => Ok(Self::All),
"statusListsOnly" => Ok(Self::StatusListsOnly),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for PayloadScope {
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 PayloadScope {
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 PayloadScope {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`Progress`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ReissueProgress",
/// "type": "object",
/// "required": [
/// "done",
/// "failed",
/// "total"
/// ],
/// "properties": {
/// "done": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "failed": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "total": {
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "undeliverable": {
/// "description": "Artefacts re-issued but not yet delivered to their holder — the holder is offline or unreachable. They are held for the holder's next renewal or contact.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Progress {
pub done: u64,
pub failed: u64,
pub total: u64,
///Artefacts re-issued but not yet delivered to their holder — the holder is offline or unreachable. They are held for the holder's next renewal or contact.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub undeliverable: ::std::option::Option<u64>,
}
impl Progress {
pub fn builder() -> builder::Progress {
Default::default()
}
}
///Success response. Type https://trusttasks.org/spec/vtc/credentials/reissue/0.1#response. Counts only — never a list of members or credentials.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "Success response. Type https://trusttasks.org/spec/vtc/credentials/reissue/0.1#response. Counts only — never a list of members or credentials.",
/// "type": "object",
/// "required": [
/// "artefacts",
/// "dryRun",
/// "jobId",
/// "state",
/// "statusLists"
/// ],
/// "properties": {
/// "artefacts": {
/// "$ref": "#/definitions/Progress"
/// },
/// "dryRun": {
/// "type": "boolean"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "jobId": {
/// "description": "The job this cause started. The same cause always names the same job.",
/// "type": "string",
/// "minLength": 1
/// },
/// "signedWith": {
/// "description": "The attestation keys (verification methods) the new signatures are made with.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// },
/// "state": {
/// "description": "`planned` — a dry run. `running` — status lists are being re-signed. `statusListsDone` — every status list is re-signed; artefacts are being re-issued (or, for `statusListsOnly`, the job is done). `completed` — everything in scope is re-signed and re-issued. `failed` — the job stopped; `artefacts.failed` and the audit trail say where.",
/// "type": "string",
/// "enum": [
/// "planned",
/// "running",
/// "statusListsDone",
/// "completed",
/// "failed"
/// ]
/// },
/// "statusLists": {
/// "$ref": "#/definitions/Progress"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
pub artefacts: Progress,
#[serde(rename = "dryRun")]
pub dry_run: bool,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The job this cause started. The same cause always names the same job.
#[serde(rename = "jobId")]
pub job_id: ResponseJobId,
///The attestation keys (verification methods) the new signatures are made with.
#[serde(
rename = "signedWith",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub signed_with: ::std::vec::Vec<::std::string::String>,
///`planned` — a dry run. `running` — status lists are being re-signed. `statusListsDone` — every status list is re-signed; artefacts are being re-issued (or, for `statusListsOnly`, the job is done). `completed` — everything in scope is re-signed and re-issued. `failed` — the job stopped; `artefacts.failed` and the audit trail say where.
pub state: ResponseState,
#[serde(rename = "statusLists")]
pub status_lists: Progress,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///The job this cause started. The same cause always names the same job.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The job this cause started. The same cause always names the same job.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseJobId(::std::string::String);
impl ::std::ops::Deref for ResponseJobId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseJobId> for ::std::string::String {
fn from(value: ResponseJobId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseJobId {
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 ResponseJobId {
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 ResponseJobId {
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 ResponseJobId {
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 ResponseJobId {
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())
})
}
}
///`planned` — a dry run. `running` — status lists are being re-signed. `statusListsDone` — every status list is re-signed; artefacts are being re-issued (or, for `statusListsOnly`, the job is done). `completed` — everything in scope is re-signed and re-issued. `failed` — the job stopped; `artefacts.failed` and the audit trail say where.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`planned` — a dry run. `running` — status lists are being re-signed. `statusListsDone` — every status list is re-signed; artefacts are being re-issued (or, for `statusListsOnly`, the job is done). `completed` — everything in scope is re-signed and re-issued. `failed` — the job stopped; `artefacts.failed` and the audit trail say where.",
/// "type": "string",
/// "enum": [
/// "planned",
/// "running",
/// "statusListsDone",
/// "completed",
/// "failed"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ResponseState {
#[serde(rename = "planned")]
Planned,
#[serde(rename = "running")]
Running,
#[serde(rename = "statusListsDone")]
StatusListsDone,
#[serde(rename = "completed")]
Completed,
#[serde(rename = "failed")]
Failed,
}
impl ::std::fmt::Display for ResponseState {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Planned => f.write_str("planned"),
Self::Running => f.write_str("running"),
Self::StatusListsDone => f.write_str("statusListsDone"),
Self::Completed => f.write_str("completed"),
Self::Failed => f.write_str("failed"),
}
}
}
impl ::std::str::FromStr for ResponseState {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"planned" => Ok(Self::Planned),
"running" => Ok(Self::Running),
"statusListsDone" => Ok(Self::StatusListsDone),
"completed" => Ok(Self::Completed),
"failed" => Ok(Self::Failed),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ResponseState {
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 ResponseState {
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 ResponseState {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
cause: ::std::result::Result<super::PayloadCause, ::std::string::String>,
dry_run: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
scope: ::std::result::Result<
::std::option::Option<super::PayloadScope>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
cause: Err("no value supplied for cause".to_string()),
dry_run: Ok(Default::default()),
ext: Ok(Default::default()),
scope: Ok(Default::default()),
}
}
}
impl Payload {
pub fn cause<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadCause>,
T::Error: ::std::fmt::Display,
{
self.cause = value
.try_into()
.map_err(|e| format!("error converting supplied value for cause: {e}"));
self
}
pub fn dry_run<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.dry_run = value
.try_into()
.map_err(|e| format!("error converting supplied value for dry_run: {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 scope<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadScope>>,
T::Error: ::std::fmt::Display,
{
self.scope = value
.try_into()
.map_err(|e| format!("error converting supplied value for scope: {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 {
cause: value.cause?,
dry_run: value.dry_run?,
ext: value.ext?,
scope: value.scope?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
cause: Ok(value.cause),
dry_run: Ok(value.dry_run),
ext: Ok(value.ext),
scope: Ok(value.scope),
}
}
}
#[derive(Clone, Debug)]
pub struct PayloadCause {
rotation_id: ::std::result::Result<
::std::option::Option<super::PayloadCauseRotationId>,
::std::string::String,
>,
verification_method:
::std::result::Result<super::PayloadCauseVerificationMethod, ::std::string::String>,
}
impl ::std::default::Default for PayloadCause {
fn default() -> Self {
Self {
rotation_id: Ok(Default::default()),
verification_method: Err("no value supplied for verification_method".to_string()),
}
}
}
impl PayloadCause {
pub fn rotation_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadCauseRotationId>>,
T::Error: ::std::fmt::Display,
{
self.rotation_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for rotation_id: {e}"));
self
}
pub fn verification_method<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadCauseVerificationMethod>,
T::Error: ::std::fmt::Display,
{
self.verification_method = value.try_into().map_err(|e| {
format!("error converting supplied value for verification_method: {e}")
});
self
}
}
impl ::std::convert::TryFrom<PayloadCause> for super::PayloadCause {
type Error = super::error::ConversionError;
fn try_from(
value: PayloadCause,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
rotation_id: value.rotation_id?,
verification_method: value.verification_method?,
})
}
}
impl ::std::convert::From<super::PayloadCause> for PayloadCause {
fn from(value: super::PayloadCause) -> Self {
Self {
rotation_id: Ok(value.rotation_id),
verification_method: Ok(value.verification_method),
}
}
}
#[derive(Clone, Debug)]
pub struct Progress {
done: ::std::result::Result<u64, ::std::string::String>,
failed: ::std::result::Result<u64, ::std::string::String>,
total: ::std::result::Result<u64, ::std::string::String>,
undeliverable: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for Progress {
fn default() -> Self {
Self {
done: Err("no value supplied for done".to_string()),
failed: Err("no value supplied for failed".to_string()),
total: Err("no value supplied for total".to_string()),
undeliverable: Ok(Default::default()),
}
}
}
impl Progress {
pub fn done<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.done = value
.try_into()
.map_err(|e| format!("error converting supplied value for done: {e}"));
self
}
pub fn failed<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.failed = value
.try_into()
.map_err(|e| format!("error converting supplied value for failed: {e}"));
self
}
pub fn total<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.total = value
.try_into()
.map_err(|e| format!("error converting supplied value for total: {e}"));
self
}
pub fn undeliverable<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.undeliverable = value
.try_into()
.map_err(|e| format!("error converting supplied value for undeliverable: {e}"));
self
}
}
impl ::std::convert::TryFrom<Progress> for super::Progress {
type Error = super::error::ConversionError;
fn try_from(value: Progress) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
done: value.done?,
failed: value.failed?,
total: value.total?,
undeliverable: value.undeliverable?,
})
}
}
impl ::std::convert::From<super::Progress> for Progress {
fn from(value: super::Progress) -> Self {
Self {
done: Ok(value.done),
failed: Ok(value.failed),
total: Ok(value.total),
undeliverable: Ok(value.undeliverable),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
artefacts: ::std::result::Result<super::Progress, ::std::string::String>,
dry_run: ::std::result::Result<bool, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
job_id: ::std::result::Result<super::ResponseJobId, ::std::string::String>,
signed_with:
::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>,
state: ::std::result::Result<super::ResponseState, ::std::string::String>,
status_lists: ::std::result::Result<super::Progress, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
artefacts: Err("no value supplied for artefacts".to_string()),
dry_run: Err("no value supplied for dry_run".to_string()),
ext: Ok(Default::default()),
job_id: Err("no value supplied for job_id".to_string()),
signed_with: Ok(Default::default()),
state: Err("no value supplied for state".to_string()),
status_lists: Err("no value supplied for status_lists".to_string()),
}
}
}
impl Response {
pub fn artefacts<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Progress>,
T::Error: ::std::fmt::Display,
{
self.artefacts = value
.try_into()
.map_err(|e| format!("error converting supplied value for artefacts: {e}"));
self
}
pub fn dry_run<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.dry_run = value
.try_into()
.map_err(|e| format!("error converting supplied value for dry_run: {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 job_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseJobId>,
T::Error: ::std::fmt::Display,
{
self.job_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for job_id: {e}"));
self
}
pub fn signed_with<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.signed_with = value
.try_into()
.map_err(|e| format!("error converting supplied value for signed_with: {e}"));
self
}
pub fn state<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseState>,
T::Error: ::std::fmt::Display,
{
self.state = value
.try_into()
.map_err(|e| format!("error converting supplied value for state: {e}"));
self
}
pub fn status_lists<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Progress>,
T::Error: ::std::fmt::Display,
{
self.status_lists = value
.try_into()
.map_err(|e| format!("error converting supplied value for status_lists: {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 {
artefacts: value.artefacts?,
dry_run: value.dry_run?,
ext: value.ext?,
job_id: value.job_id?,
signed_with: value.signed_with?,
state: value.state?,
status_lists: value.status_lists?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
artefacts: Ok(value.artefacts),
dry_run: Ok(value.dry_run),
ext: Ok(value.ext),
job_id: Ok(value.job_id),
signed_with: Ok(value.signed_with),
state: Ok(value.state),
status_lists: Ok(value.status_lists),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/vtc/credentials/reissue/0.1";
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(
"{\n \"$defs\": {\n \"Ext\": {\n \"additionalProperties\": true,\n \"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.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"Progress\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"done\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"failed\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"total\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"undeliverable\": {\n \"description\": \"Artefacts re-issued but not yet delivered to their holder — the holder is offline or unreachable. They are held for the holder's next renewal or contact.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"total\",\n \"done\",\n \"failed\"\n ],\n \"title\": \"ReissueProgress\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response. Type https://trusttasks.org/spec/vtc/credentials/reissue/0.1#response. Counts only — never a list of members or credentials.\",\n \"properties\": {\n \"artefacts\": {\n \"$ref\": \"#/$defs/Progress\"\n },\n \"dryRun\": {\n \"type\": \"boolean\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"jobId\": {\n \"description\": \"The job this cause started. The same cause always names the same job.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"signedWith\": {\n \"description\": \"The attestation keys (verification methods) the new signatures are made with.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"state\": {\n \"description\": \"`planned` — a dry run. `running` — status lists are being re-signed. `statusListsDone` — every status list is re-signed; artefacts are being re-issued (or, for `statusListsOnly`, the job is done). `completed` — everything in scope is re-signed and re-issued. `failed` — the job stopped; `artefacts.failed` and the audit trail say where.\",\n \"enum\": [\n \"planned\",\n \"running\",\n \"statusListsDone\",\n \"completed\",\n \"failed\"\n ],\n \"type\": \"string\"\n },\n \"statusLists\": {\n \"$ref\": \"#/$defs/Progress\"\n }\n },\n \"required\": [\n \"jobId\",\n \"state\",\n \"dryRun\",\n \"statusLists\",\n \"artefacts\"\n ],\n \"title\": \"VTC Credentials Reissue — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/vtc/credentials/reissue/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"Ask a VTC to re-sign its status lists and re-issue the attestation artefacts still in force that an attestation key revoked for compromise signed, under the community's current attestation key. Re-sending the same request returns the progress of the job it started.\",\n \"properties\": {\n \"cause\": {\n \"additionalProperties\": false,\n \"description\": \"The revocation that requires re-issuance. The VTC MUST verify it against its own DID's key roles (vta/webvh/dids/keys/list) rather than trust it.\",\n \"properties\": {\n \"rotationId\": {\n \"description\": \"The VTA's rotation record (`kind: compromise`) for the revocation, when known.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"verificationMethod\": {\n \"description\": \"The attestation key of the community's DID that was revoked for compromise.\",\n \"minLength\": 1,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"verificationMethod\"\n ],\n \"type\": \"object\"\n },\n \"dryRun\": {\n \"description\": \"Report what would be re-signed and re-issued, without doing it. Absent reads as false.\",\n \"type\": \"boolean\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"scope\": {\n \"description\": \"`all` (the default) re-signs status lists first and then re-issues artefacts. `statusListsOnly` re-signs status lists and stops — for an operator who must restore status checking within minutes and schedule the rest.\",\n \"enum\": [\n \"all\",\n \"statusListsOnly\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"cause\"\n ],\n \"title\": \"VTC Credentials Reissue — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/vtc/credentials/reissue/0.1#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(
"{\n \"$defs\": {\n \"Ext\": {\n \"additionalProperties\": true,\n \"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.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"Progress\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"done\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"failed\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"total\": {\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"undeliverable\": {\n \"description\": \"Artefacts re-issued but not yet delivered to their holder — the holder is offline or unreachable. They are held for the holder's next renewal or contact.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"total\",\n \"done\",\n \"failed\"\n ],\n \"title\": \"ReissueProgress\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response. Type https://trusttasks.org/spec/vtc/credentials/reissue/0.1#response. Counts only — never a list of members or credentials.\",\n \"properties\": {\n \"artefacts\": {\n \"$ref\": \"#/$defs/Progress\"\n },\n \"dryRun\": {\n \"type\": \"boolean\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"jobId\": {\n \"description\": \"The job this cause started. The same cause always names the same job.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"signedWith\": {\n \"description\": \"The attestation keys (verification methods) the new signatures are made with.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"state\": {\n \"description\": \"`planned` — a dry run. `running` — status lists are being re-signed. `statusListsDone` — every status list is re-signed; artefacts are being re-issued (or, for `statusListsOnly`, the job is done). `completed` — everything in scope is re-signed and re-issued. `failed` — the job stopped; `artefacts.failed` and the audit trail say where.\",\n \"enum\": [\n \"planned\",\n \"running\",\n \"statusListsDone\",\n \"completed\",\n \"failed\"\n ],\n \"type\": \"string\"\n },\n \"statusLists\": {\n \"$ref\": \"#/$defs/Progress\"\n }\n },\n \"required\": [\n \"jobId\",\n \"state\",\n \"dryRun\",\n \"statusLists\",\n \"artefacts\"\n ],\n \"title\": \"VTC Credentials Reissue — response payload\",\n \"type\": \"object\"\n }\n },\n \"$ref\": \"#/$defs/Response\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\"\n}\n",
);
}
impl crate::RequestPayload for Payload {
type Response = Response;
}
/// 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::CAUSE_NOT_FOUND,
error_codes::NO_SOUND_ATTESTATION_KEY,
];
/// 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/credentials/reissue:causeNotFound`
///
/// The named key is not an attestation key of this community's DID revoked for compromise.
///
/// Declared `retryable: false`.
pub const CAUSE_NOT_FOUND: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/credentials/reissue:causeNotFound",
retryable: false,
};
/// `vtc/credentials/reissue:noSoundAttestationKey`
///
/// The community's DID has no active attestation key to sign with. Add or rotate one first.
///
/// Declared `retryable: true`.
pub const NO_SOUND_ATTESTATION_KEY: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "vtc/credentials/reissue:noSoundAttestationKey",
retryable: true,
};
}
#[cfg(test)]
mod conformance {
//! Round-trip tests harvested from the spec's `spec.md`,
//! plus a `rejects_invalid_examples` test for any fixtures
//! in `payload.invalid-examples.json` (validate feature).
#[test]
fn request_example_1() {
const JSON: &str = "{\n \"id\": \"urn:uuid:4d5e6f70-0000-4000-8000-000000000001\",\n \"type\": \"https://trusttasks.org/spec/vtc/credentials/reissue/0.1\",\n \"issuer\": \"did:key:z6MkCommunityAdmin\",\n \"recipient\": \"did:webvh:QmVtcScid:vtc.example\",\n \"issuedAt\": \"2026-09-25T11:05:00Z\",\n \"payload\": {\n \"cause\": {\n \"verificationMethod\": \"did:webvh:QmVtcScid:vtc.example#z6MkNewAttestation\",\n \"rotationId\": \"rot-0004\"\n }\n },\n \"proof\": {\n \"type\": \"DataIntegrityProof\",\n \"cryptosuite\": \"eddsa-jcs-2022\",\n \"created\": \"2026-09-25T11:05:00Z\",\n \"verificationMethod\": \"did:key:z6MkCommunityAdmin#z6MkCommunityAdmin\",\n \"proofPurpose\": \"authentication\",\n \"proofValue\": \"z3FXQ...\"\n }\n}\n";
let doc: crate::TrustTask<super::Payload> =
serde_json::from_str(JSON).expect("deserialize request example");
let rendered = serde_json::to_value(&doc).expect("re-serialize");
let expected: serde_json::Value = serde_json::from_str(JSON).expect("re-parse expected");
assert_eq!(rendered, expected, "request example failed round-trip");
}
#[test]
fn response_example_1() {
const JSON: &str = "{\n \"id\": \"urn:uuid:4d5e6f70-0000-4000-8000-000000000002\",\n \"type\": \"https://trusttasks.org/spec/vtc/credentials/reissue/0.1#response\",\n \"issuer\": \"did:webvh:QmVtcScid:vtc.example\",\n \"recipient\": \"did:key:z6MkCommunityAdmin\",\n \"issuedAt\": \"2026-09-25T11:05:01Z\",\n \"threadId\": \"urn:uuid:4d5e6f70-0000-4000-8000-000000000001\",\n \"payload\": {\n \"jobId\": \"reissue-rot-0004\",\n \"state\": \"statusListsDone\",\n \"dryRun\": false,\n \"statusLists\": { \"total\": 3, \"done\": 3, \"failed\": 0 },\n \"artefacts\": { \"total\": 412, \"done\": 57, \"failed\": 0, \"undeliverable\": 4 },\n \"signedWith\": [\"did:webvh:QmVtcScid:vtc.example#z6MkReplacement\"]\n }\n}\n";
let doc: crate::TrustTask<super::Response> =
serde_json::from_str(JSON).expect("deserialize response example");
let rendered = serde_json::to_value(&doc).expect("re-serialize");
let expected: serde_json::Value = serde_json::from_str(JSON).expect("re-parse expected");
assert_eq!(rendered, expected, "response example failed round-trip");
}
}