//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `task-consent/decision`. Version: `0.2`.
#[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())
}
}
}
///The credential the client returns from `navigator.credentials.get`. Binary fields are base64url-encoded.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "AuthenticatorAssertionResponse (login)",
/// "description": "The credential the client returns from `navigator.credentials.get`. Binary fields are base64url-encoded.",
/// "type": "object",
/// "required": [
/// "id",
/// "rawId",
/// "response",
/// "type"
/// ],
/// "properties": {
/// "authenticatorAttachment": {
/// "enum": [
/// "platform",
/// "cross-platform"
/// ]
/// },
/// "clientExtensionResults": {
/// "type": "object"
/// },
/// "id": {
/// "type": "string"
/// },
/// "rawId": {
/// "type": "string"
/// },
/// "response": {
/// "type": "object",
/// "required": [
/// "authenticatorData",
/// "clientDataJSON",
/// "signature"
/// ],
/// "properties": {
/// "authenticatorData": {
/// "type": "string"
/// },
/// "clientDataJSON": {
/// "type": "string"
/// },
/// "signature": {
/// "type": "string"
/// },
/// "userHandle": {
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// },
/// "additionalProperties": false
/// },
/// "type": {
/// "const": "public-key"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "assertionResponse"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct AssertionResponse {
#[serde(
rename = "authenticatorAttachment",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub authenticator_attachment: ::std::option::Option<AssertionResponseAuthenticatorAttachment>,
#[serde(
rename = "clientExtensionResults",
default,
skip_serializing_if = "::serde_json::Map::is_empty"
)]
pub client_extension_results: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
pub id: ::std::string::String,
#[serde(rename = "rawId")]
pub raw_id: ::std::string::String,
pub response: AssertionResponseResponse,
#[serde(rename = "type")]
pub type_: ::serde_json::Value,
}
impl AssertionResponse {
pub fn builder() -> builder::AssertionResponse {
Default::default()
}
}
///`AssertionResponseAuthenticatorAttachment`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "enum": [
/// "platform",
/// "cross-platform"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum AssertionResponseAuthenticatorAttachment {
#[serde(rename = "platform")]
Platform,
#[serde(rename = "cross-platform")]
CrossPlatform,
}
impl ::std::fmt::Display for AssertionResponseAuthenticatorAttachment {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Platform => f.write_str("platform"),
Self::CrossPlatform => f.write_str("cross-platform"),
}
}
}
impl ::std::str::FromStr for AssertionResponseAuthenticatorAttachment {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"platform" => Ok(Self::Platform),
"cross-platform" => Ok(Self::CrossPlatform),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for AssertionResponseAuthenticatorAttachment {
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 AssertionResponseAuthenticatorAttachment {
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 AssertionResponseAuthenticatorAttachment {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///`AssertionResponseResponse`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "authenticatorData",
/// "clientDataJSON",
/// "signature"
/// ],
/// "properties": {
/// "authenticatorData": {
/// "type": "string"
/// },
/// "clientDataJSON": {
/// "type": "string"
/// },
/// "signature": {
/// "type": "string"
/// },
/// "userHandle": {
/// "type": [
/// "string",
/// "null"
/// ]
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct AssertionResponseResponse {
#[serde(rename = "authenticatorData")]
pub authenticator_data: ::std::string::String,
#[serde(rename = "clientDataJSON")]
pub client_data_json: ::std::string::String,
pub signature: ::std::string::String,
#[serde(
rename = "userHandle",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub user_handle: ::std::option::Option<::std::string::String>,
}
impl AssertionResponseResponse {
pub fn builder() -> builder::AssertionResponseResponse {
Default::default()
}
}
///The approver's answer. `deny` aborts the pending request; a subsequent submit of the same task starts a fresh one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Decision",
/// "description": "The approver's answer. `deny` aborts the pending request; a subsequent submit of the same task starts a fresh one.",
/// "type": "string",
/// "enum": [
/// "approve",
/// "deny"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum Decision {
#[serde(rename = "approve")]
Approve,
#[serde(rename = "deny")]
Deny,
}
impl ::std::fmt::Display for Decision {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Approve => f.write_str("approve"),
Self::Deny => f.write_str("deny"),
}
}
}
impl ::std::str::FromStr for Decision {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"approve" => Ok(Self::Approve),
"deny" => Ok(Self::Deny),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for Decision {
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 Decision {
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 Decision {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
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`.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "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"
/// ],
/// "type": "string",
/// "minLength": 16,
/// "pattern": "^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$"
///}
/// ```
/// </details>
#[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())
})
}
}
///An additional factor backing the decision, tagged on `kind`. It never replaces the document's proof — that proof is still REQUIRED and is by the approver's own DID — and it is verified by the executor on top of it. Absent, the proof alone is the authorization, exactly as in 0.1.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Decision Evidence",
/// "description": "An additional factor backing the decision, tagged on `kind`. It never replaces the document's proof — that proof is still REQUIRED and is by the approver's own DID — and it is verified by the executor on top of it. Absent, the proof alone is the authorization, exactly as in 0.1.",
/// "oneOf": [
/// {
/// "title": "WebAuthn",
/// "type": "object",
/// "required": [
/// "assertion",
/// "kind"
/// ],
/// "properties": {
/// "assertion": {
/// "description": "The unmodified AuthenticatorAssertionResponse from the platform WebAuthn API, the same shape auth/step-up/approve-response/0.5 carries. The WebAuthn challenge the approver's client passed to the authenticator MUST be the UTF-8 bytes of this decision's `challenge` value, so `clientDataJSON.challenge` is their base64url (no padding) encoding; the executor, as relying party, verifies it per WebAuthn Level 2 §7.2 against a credential enrolled to the approver whose DID made the document's proof. The commitment to the payload is the executor's binding: it issued that challenge for exactly one pending request, whose `payloadDigest` is salted with it.",
/// "$ref": "#/definitions/AssertionResponse"
/// },
/// "kind": {
/// "const": "webauthn"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "title": "ApproverSigned",
/// "type": "object",
/// "required": [
/// "kind",
/// "statement"
/// ],
/// "properties": {
/// "kind": {
/// "const": "approverSigned"
/// },
/// "statement": {
/// "description": "A complete, signed https://trusttasks.org/spec/auth/step-up/approver/attest/0.1 Trust Task document whose `purpose` is `decision`, issued by a step-up approver enrolled to the decision's signer: its `subject` is the DID that made this document's proof, its `audience` the executor, its `challenge` this decision's `challenge`, and its `boundTo` this decision's `payloadDigest`. The executor verifies it as a document in its own right — envelope, proof and payload against that specification's schemas — and over its members exactly as received: its proof covers every member, including ones this schema does not name, so it is deliberately an open object here rather than a typed one a binding could narrow.",
/// "type": "object"
/// }
/// },
/// "additionalProperties": false
/// }
/// ],
/// "$anchor": "evidence"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(tag = "kind", deny_unknown_fields)]
#[non_exhaustive]
pub enum Evidence {
///WebAuthn
#[serde(rename = "webauthn")]
Webauthn {
///The unmodified AuthenticatorAssertionResponse from the platform WebAuthn API, the same shape auth/step-up/approve-response/0.5 carries. The WebAuthn challenge the approver's client passed to the authenticator MUST be the UTF-8 bytes of this decision's `challenge` value, so `clientDataJSON.challenge` is their base64url (no padding) encoding; the executor, as relying party, verifies it per WebAuthn Level 2 §7.2 against a credential enrolled to the approver whose DID made the document's proof. The commitment to the payload is the executor's binding: it issued that challenge for exactly one pending request, whose `payloadDigest` is salted with it.
assertion: AssertionResponse,
},
///ApproverSigned
#[serde(rename = "approverSigned")]
ApproverSigned {
///A complete, signed https://trusttasks.org/spec/auth/step-up/approver/attest/0.1 Trust Task document whose `purpose` is `decision`, issued by a step-up approver enrolled to the decision's signer: its `subject` is the DID that made this document's proof, its `audience` the executor, its `challenge` this decision's `challenge`, and its `boundTo` this decision's `payloadDigest`. The executor verifies it as a document in its own right — envelope, proof and payload against that specification's schemas — and over its members exactly as received: its proof covers every member, including ones this schema does not name, so it is deliberately an open object here rather than a typed one a binding could narrow.
statement: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
},
}
///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())
})
}
}
///An enrolled approver authorizes (or refuses) one pending privileged task, bound to the exact payload it was shown. The proof on this document — not the transport session that carried it — is the authorization, and it is always made by the approver's own DID. Additive over 0.1: an OPTIONAL `evidence` member carries an additional factor (a WebAuthn assertion, or a signed step-up approver statement) the executor verifies on top of the proof, and an OPTIONAL `actionId` links the decision to a Verifiable Trust Community action (vtc/admin/actions/list/0.1). The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/task-consent/decision/0.2",
/// "title": "Payload",
/// "description": "An enrolled approver authorizes (or refuses) one pending privileged task, bound to the exact payload it was shown. The proof on this document — not the transport session that carried it — is the authorization, and it is always made by the approver's own DID. Additive over 0.1: an OPTIONAL `evidence` member carries an additional factor (a WebAuthn assertion, or a signed step-up approver statement) the executor verifies on top of the proof, and an OPTIONAL `actionId` links the decision to a Verifiable Trust Community action (vtc/admin/actions/list/0.1). The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.",
/// "type": "object",
/// "required": [
/// "challenge",
/// "decision",
/// "payloadDigest"
/// ],
/// "properties": {
/// "actionId": {
/// "description": "OPTIONAL identifier of the Verifiable Trust Community action (vtc/admin/actions/_shared/0.1 ActionId) this decision answers. A locator only: the executor finds the pending request by `payloadDigest` and checks `challenge` against it exactly as without this member, and refuses a decision whose `actionId` names a different action than the one those resolve to.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
/// },
/// "challenge": {
/// "description": "Echoes the challenge of the pending request this decision answers — a task-consent/request's `challenge`, or the `challenge` on a VTC action the approver may decide — binding the decision to that one pending request and that one approver. An executor MUST consume the challenge at execution rather than on receipt of this decision: a decision authorizes exactly one execution, and consuming it earlier lets an executor's own retry legitimately replay it.",
/// "type": "string",
/// "minLength": 16
/// },
/// "decision": {
/// "$ref": "#/definitions/Decision"
/// },
/// "evidence": {
/// "$ref": "#/definitions/Evidence"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "payloadDigest": {
/// "description": "Echoes the challenge-salted digest of the task being authorized, in the encoding the pending request carried it. The executor re-derives it from the payload it is about to execute and refuses on mismatch — this is what makes the approved payload the executed payload, cryptographically rather than by convention.",
/// "$ref": "#/definitions/DigestMultibase"
/// },
/// "reason": {
/// "description": "OPTIONAL human-facing note, most useful on a `deny`.",
/// "type": "string",
/// "maxLength": 500
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///OPTIONAL identifier of the Verifiable Trust Community action (vtc/admin/actions/_shared/0.1 ActionId) this decision answers. A locator only: the executor finds the pending request by `payloadDigest` and checks `challenge` against it exactly as without this member, and refuses a decision whose `actionId` names a different action than the one those resolve to.
#[serde(
rename = "actionId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub action_id: ::std::option::Option<PayloadActionId>,
///Echoes the challenge of the pending request this decision answers — a task-consent/request's `challenge`, or the `challenge` on a VTC action the approver may decide — binding the decision to that one pending request and that one approver. An executor MUST consume the challenge at execution rather than on receipt of this decision: a decision authorizes exactly one execution, and consuming it earlier lets an executor's own retry legitimately replay it.
pub challenge: PayloadChallenge,
pub decision: Decision,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub evidence: ::std::option::Option<Evidence>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Echoes the challenge-salted digest of the task being authorized, in the encoding the pending request carried it. The executor re-derives it from the payload it is about to execute and refuses on mismatch — this is what makes the approved payload the executed payload, cryptographically rather than by convention.
#[serde(rename = "payloadDigest")]
pub payload_digest: DigestMultibase,
///OPTIONAL human-facing note, most useful on a `deny`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub reason: ::std::option::Option<PayloadReason>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///OPTIONAL identifier of the Verifiable Trust Community action (vtc/admin/actions/_shared/0.1 ActionId) this decision answers. A locator only: the executor finds the pending request by `payloadDigest` and checks `challenge` against it exactly as without this member, and refuses a decision whose `actionId` names a different action than the one those resolve to.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "OPTIONAL identifier of the Verifiable Trust Community action (vtc/admin/actions/_shared/0.1 ActionId) this decision answers. A locator only: the executor finds the pending request by `payloadDigest` and checks `challenge` against it exactly as without this member, and refuses a decision whose `actionId` names a different action than the one those resolve to.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadActionId(::std::string::String);
impl ::std::ops::Deref for PayloadActionId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadActionId> for ::std::string::String {
fn from(value: PayloadActionId) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadActionId {
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());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadActionId {
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 PayloadActionId {
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 PayloadActionId {
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 PayloadActionId {
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())
})
}
}
///Echoes the challenge of the pending request this decision answers — a task-consent/request's `challenge`, or the `challenge` on a VTC action the approver may decide — binding the decision to that one pending request and that one approver. An executor MUST consume the challenge at execution rather than on receipt of this decision: a decision authorizes exactly one execution, and consuming it earlier lets an executor's own retry legitimately replay it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Echoes the challenge of the pending request this decision answers — a task-consent/request's `challenge`, or the `challenge` on a VTC action the approver may decide — binding the decision to that one pending request and that one approver. An executor MUST consume the challenge at execution rather than on receipt of this decision: a decision authorizes exactly one execution, and consuming it earlier lets an executor's own retry legitimately replay it.",
/// "type": "string",
/// "minLength": 16
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadChallenge(::std::string::String);
impl ::std::ops::Deref for PayloadChallenge {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadChallenge> for ::std::string::String {
fn from(value: PayloadChallenge) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadChallenge {
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());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadChallenge {
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 PayloadChallenge {
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 PayloadChallenge {
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 PayloadChallenge {
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())
})
}
}
///OPTIONAL human-facing note, most useful on a `deny`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "OPTIONAL human-facing note, most useful on a `deny`.",
/// "type": "string",
/// "maxLength": 500
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadReason(::std::string::String);
impl ::std::ops::Deref for PayloadReason {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadReason> for ::std::string::String {
fn from(value: PayloadReason) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadReason {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 500usize {
return Err("longer than 500 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadReason {
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 PayloadReason {
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 PayloadReason {
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 PayloadReason {
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())
})
}
}
///Acknowledgement of the recorded decision, and whether the approval threshold is now met.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "Acknowledgement of the recorded decision, and whether the approval threshold is now met.",
/// "type": "object",
/// "required": [
/// "payloadDigest",
/// "status"
/// ],
/// "properties": {
/// "actionId": {
/// "description": "Echoed when the decision carried one.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
/// },
/// "approvals": {
/// "description": "Distinct approvals recorded so far.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "needed": {
/// "description": "Distinct approvals required. Present when status is `pending`.",
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "payloadDigest": {
/// "description": "The digest this decision concerned, in the encoding the pending request carried it.",
/// "$ref": "#/definitions/DigestMultibase"
/// },
/// "status": {
/// "description": "`granted` = the threshold is met: the requester's re-submit will now execute, or — for a VTC action — the executor has executed (or is executing) the parked operation itself. `pending` = the approval was recorded but more are needed. `denied` = the request was aborted.",
/// "type": "string",
/// "enum": [
/// "granted",
/// "pending",
/// "denied"
/// ]
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
///Echoed when the decision carried one.
#[serde(
rename = "actionId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub action_id: ::std::option::Option<ResponseActionId>,
///Distinct approvals recorded so far.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub approvals: ::std::option::Option<u64>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Distinct approvals required. Present when status is `pending`.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub needed: ::std::option::Option<::std::num::NonZeroU64>,
///The digest this decision concerned, in the encoding the pending request carried it.
#[serde(rename = "payloadDigest")]
pub payload_digest: DigestMultibase,
///`granted` = the threshold is met: the requester's re-submit will now execute, or — for a VTC action — the executor has executed (or is executing) the parked operation itself. `pending` = the approval was recorded but more are needed. `denied` = the request was aborted.
pub status: ResponseStatus,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Echoed when the decision carried one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Echoed when the decision carried one.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseActionId(::std::string::String);
impl ::std::ops::Deref for ResponseActionId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseActionId> for ::std::string::String {
fn from(value: ResponseActionId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseActionId {
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());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseActionId {
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 ResponseActionId {
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 ResponseActionId {
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 ResponseActionId {
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())
})
}
}
///`granted` = the threshold is met: the requester's re-submit will now execute, or — for a VTC action — the executor has executed (or is executing) the parked operation itself. `pending` = the approval was recorded but more are needed. `denied` = the request was aborted.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "`granted` = the threshold is met: the requester's re-submit will now execute, or — for a VTC action — the executor has executed (or is executing) the parked operation itself. `pending` = the approval was recorded but more are needed. `denied` = the request was aborted.",
/// "type": "string",
/// "enum": [
/// "granted",
/// "pending",
/// "denied"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ResponseStatus {
#[serde(rename = "granted")]
Granted,
#[serde(rename = "pending")]
Pending,
#[serde(rename = "denied")]
Denied,
}
impl ::std::fmt::Display for ResponseStatus {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Granted => f.write_str("granted"),
Self::Pending => f.write_str("pending"),
Self::Denied => f.write_str("denied"),
}
}
}
impl ::std::str::FromStr for ResponseStatus {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"granted" => Ok(Self::Granted),
"pending" => Ok(Self::Pending),
"denied" => Ok(Self::Denied),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ResponseStatus {
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 ResponseStatus {
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 ResponseStatus {
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 AssertionResponse {
authenticator_attachment: ::std::result::Result<
::std::option::Option<super::AssertionResponseAuthenticatorAttachment>,
::std::string::String,
>,
client_extension_results: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
id: ::std::result::Result<::std::string::String, ::std::string::String>,
raw_id: ::std::result::Result<::std::string::String, ::std::string::String>,
response: ::std::result::Result<super::AssertionResponseResponse, ::std::string::String>,
type_: ::std::result::Result<::serde_json::Value, ::std::string::String>,
}
impl ::std::default::Default for AssertionResponse {
fn default() -> Self {
Self {
authenticator_attachment: Ok(Default::default()),
client_extension_results: Ok(Default::default()),
id: Err("no value supplied for id".to_string()),
raw_id: Err("no value supplied for raw_id".to_string()),
response: Err("no value supplied for response".to_string()),
type_: Err("no value supplied for type_".to_string()),
}
}
}
impl AssertionResponse {
pub fn authenticator_attachment<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<super::AssertionResponseAuthenticatorAttachment>,
>,
T::Error: ::std::fmt::Display,
{
self.authenticator_attachment = value.try_into().map_err(|e| {
format!("error converting supplied value for authenticator_attachment: {e}")
});
self
}
pub fn client_extension_results<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.client_extension_results = value.try_into().map_err(|e| {
format!("error converting supplied value for client_extension_results: {e}")
});
self
}
pub fn id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {e}"));
self
}
pub fn raw_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.raw_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for raw_id: {e}"));
self
}
pub fn response<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::AssertionResponseResponse>,
T::Error: ::std::fmt::Display,
{
self.response = value
.try_into()
.map_err(|e| format!("error converting supplied value for response: {e}"));
self
}
pub fn type_<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.type_ = value
.try_into()
.map_err(|e| format!("error converting supplied value for type_: {e}"));
self
}
}
impl ::std::convert::TryFrom<AssertionResponse> for super::AssertionResponse {
type Error = super::error::ConversionError;
fn try_from(
value: AssertionResponse,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
authenticator_attachment: value.authenticator_attachment?,
client_extension_results: value.client_extension_results?,
id: value.id?,
raw_id: value.raw_id?,
response: value.response?,
type_: value.type_?,
})
}
}
impl ::std::convert::From<super::AssertionResponse> for AssertionResponse {
fn from(value: super::AssertionResponse) -> Self {
Self {
authenticator_attachment: Ok(value.authenticator_attachment),
client_extension_results: Ok(value.client_extension_results),
id: Ok(value.id),
raw_id: Ok(value.raw_id),
response: Ok(value.response),
type_: Ok(value.type_),
}
}
}
#[derive(Clone, Debug)]
pub struct AssertionResponseResponse {
authenticator_data: ::std::result::Result<::std::string::String, ::std::string::String>,
client_data_json: ::std::result::Result<::std::string::String, ::std::string::String>,
signature: ::std::result::Result<::std::string::String, ::std::string::String>,
user_handle: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
}
impl ::std::default::Default for AssertionResponseResponse {
fn default() -> Self {
Self {
authenticator_data: Err("no value supplied for authenticator_data".to_string()),
client_data_json: Err("no value supplied for client_data_json".to_string()),
signature: Err("no value supplied for signature".to_string()),
user_handle: Ok(Default::default()),
}
}
}
impl AssertionResponseResponse {
pub fn authenticator_data<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.authenticator_data = value.try_into().map_err(|e| {
format!("error converting supplied value for authenticator_data: {e}")
});
self
}
pub fn client_data_json<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.client_data_json = value
.try_into()
.map_err(|e| format!("error converting supplied value for client_data_json: {e}"));
self
}
pub fn signature<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.signature = value
.try_into()
.map_err(|e| format!("error converting supplied value for signature: {e}"));
self
}
pub fn user_handle<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.user_handle = value
.try_into()
.map_err(|e| format!("error converting supplied value for user_handle: {e}"));
self
}
}
impl ::std::convert::TryFrom<AssertionResponseResponse> for super::AssertionResponseResponse {
type Error = super::error::ConversionError;
fn try_from(
value: AssertionResponseResponse,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
authenticator_data: value.authenticator_data?,
client_data_json: value.client_data_json?,
signature: value.signature?,
user_handle: value.user_handle?,
})
}
}
impl ::std::convert::From<super::AssertionResponseResponse> for AssertionResponseResponse {
fn from(value: super::AssertionResponseResponse) -> Self {
Self {
authenticator_data: Ok(value.authenticator_data),
client_data_json: Ok(value.client_data_json),
signature: Ok(value.signature),
user_handle: Ok(value.user_handle),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
action_id: ::std::result::Result<
::std::option::Option<super::PayloadActionId>,
::std::string::String,
>,
challenge: ::std::result::Result<super::PayloadChallenge, ::std::string::String>,
decision: ::std::result::Result<super::Decision, ::std::string::String>,
evidence:
::std::result::Result<::std::option::Option<super::Evidence>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
payload_digest: ::std::result::Result<super::DigestMultibase, ::std::string::String>,
reason: ::std::result::Result<
::std::option::Option<super::PayloadReason>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
action_id: Ok(Default::default()),
challenge: Err("no value supplied for challenge".to_string()),
decision: Err("no value supplied for decision".to_string()),
evidence: Ok(Default::default()),
ext: Ok(Default::default()),
payload_digest: Err("no value supplied for payload_digest".to_string()),
reason: Ok(Default::default()),
}
}
}
impl Payload {
pub fn action_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadActionId>>,
T::Error: ::std::fmt::Display,
{
self.action_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for action_id: {e}"));
self
}
pub fn challenge<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::PayloadChallenge>,
T::Error: ::std::fmt::Display,
{
self.challenge = value
.try_into()
.map_err(|e| format!("error converting supplied value for challenge: {e}"));
self
}
pub fn decision<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Decision>,
T::Error: ::std::fmt::Display,
{
self.decision = value
.try_into()
.map_err(|e| format!("error converting supplied value for decision: {e}"));
self
}
pub fn evidence<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::Evidence>>,
T::Error: ::std::fmt::Display,
{
self.evidence = value
.try_into()
.map_err(|e| format!("error converting supplied value for evidence: {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 payload_digest<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DigestMultibase>,
T::Error: ::std::fmt::Display,
{
self.payload_digest = value
.try_into()
.map_err(|e| format!("error converting supplied value for payload_digest: {e}"));
self
}
pub fn reason<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadReason>>,
T::Error: ::std::fmt::Display,
{
self.reason = value
.try_into()
.map_err(|e| format!("error converting supplied value for reason: {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 {
action_id: value.action_id?,
challenge: value.challenge?,
decision: value.decision?,
evidence: value.evidence?,
ext: value.ext?,
payload_digest: value.payload_digest?,
reason: value.reason?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
action_id: Ok(value.action_id),
challenge: Ok(value.challenge),
decision: Ok(value.decision),
evidence: Ok(value.evidence),
ext: Ok(value.ext),
payload_digest: Ok(value.payload_digest),
reason: Ok(value.reason),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
action_id: ::std::result::Result<
::std::option::Option<super::ResponseActionId>,
::std::string::String,
>,
approvals: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
needed: ::std::result::Result<
::std::option::Option<::std::num::NonZeroU64>,
::std::string::String,
>,
payload_digest: ::std::result::Result<super::DigestMultibase, ::std::string::String>,
status: ::std::result::Result<super::ResponseStatus, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
action_id: Ok(Default::default()),
approvals: Ok(Default::default()),
ext: Ok(Default::default()),
needed: Ok(Default::default()),
payload_digest: Err("no value supplied for payload_digest".to_string()),
status: Err("no value supplied for status".to_string()),
}
}
}
impl Response {
pub fn action_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseActionId>>,
T::Error: ::std::fmt::Display,
{
self.action_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for action_id: {e}"));
self
}
pub fn approvals<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.approvals = value
.try_into()
.map_err(|e| format!("error converting supplied value for approvals: {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 needed<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
T::Error: ::std::fmt::Display,
{
self.needed = value
.try_into()
.map_err(|e| format!("error converting supplied value for needed: {e}"));
self
}
pub fn payload_digest<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::DigestMultibase>,
T::Error: ::std::fmt::Display,
{
self.payload_digest = value
.try_into()
.map_err(|e| format!("error converting supplied value for payload_digest: {e}"));
self
}
pub fn status<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseStatus>,
T::Error: ::std::fmt::Display,
{
self.status = value
.try_into()
.map_err(|e| format!("error converting supplied value for status: {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 {
action_id: value.action_id?,
approvals: value.approvals?,
ext: value.ext?,
needed: value.needed?,
payload_digest: value.payload_digest?,
status: value.status?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
action_id: Ok(value.action_id),
approvals: Ok(value.approvals),
ext: Ok(value.ext),
needed: Ok(value.needed),
payload_digest: Ok(value.payload_digest),
status: Ok(value.status),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/task-consent/decision/0.2";
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 \"AssertionResponse\": {\n \"$anchor\": \"assertionResponse\",\n \"additionalProperties\": false,\n \"description\": \"The credential the client returns from `navigator.credentials.get`. Binary fields are base64url-encoded.\",\n \"properties\": {\n \"authenticatorAttachment\": {\n \"enum\": [\n \"platform\",\n \"cross-platform\"\n ]\n },\n \"clientExtensionResults\": {\n \"type\": \"object\"\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"rawId\": {\n \"type\": \"string\"\n },\n \"response\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"authenticatorData\": {\n \"type\": \"string\"\n },\n \"clientDataJSON\": {\n \"type\": \"string\"\n },\n \"signature\": {\n \"type\": \"string\"\n },\n \"userHandle\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"clientDataJSON\",\n \"authenticatorData\",\n \"signature\"\n ],\n \"type\": \"object\"\n },\n \"type\": {\n \"const\": \"public-key\"\n }\n },\n \"required\": [\n \"id\",\n \"rawId\",\n \"type\",\n \"response\"\n ],\n \"title\": \"AuthenticatorAssertionResponse (login)\",\n \"type\": \"object\"\n },\n \"Decision\": {\n \"description\": \"The approver's answer. `deny` aborts the pending request; a subsequent submit of the same task starts a fresh one.\",\n \"enum\": [\n \"approve\",\n \"deny\"\n ],\n \"title\": \"Decision\",\n \"type\": \"string\"\n },\n \"DigestMultibase\": {\n \"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`.\",\n \"examples\": [\n \"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\"\n ],\n \"minLength\": 16,\n \"pattern\": \"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\",\n \"title\": \"DigestMultibase\",\n \"type\": \"string\"\n },\n \"Evidence\": {\n \"$anchor\": \"evidence\",\n \"description\": \"An additional factor backing the decision, tagged on `kind`. It never replaces the document's proof — that proof is still REQUIRED and is by the approver's own DID — and it is verified by the executor on top of it. Absent, the proof alone is the authorization, exactly as in 0.1.\",\n \"oneOf\": [\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"assertion\": {\n \"$ref\": \"#/$defs/AssertionResponse\",\n \"description\": \"The unmodified AuthenticatorAssertionResponse from the platform WebAuthn API, the same shape auth/step-up/approve-response/0.5 carries. The WebAuthn challenge the approver's client passed to the authenticator MUST be the UTF-8 bytes of this decision's `challenge` value, so `clientDataJSON.challenge` is their base64url (no padding) encoding; the executor, as relying party, verifies it per WebAuthn Level 2 §7.2 against a credential enrolled to the approver whose DID made the document's proof. The commitment to the payload is the executor's binding: it issued that challenge for exactly one pending request, whose `payloadDigest` is salted with it.\"\n },\n \"kind\": {\n \"const\": \"webauthn\"\n }\n },\n \"required\": [\n \"kind\",\n \"assertion\"\n ],\n \"title\": \"WebAuthn\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"kind\": {\n \"const\": \"approverSigned\"\n },\n \"statement\": {\n \"description\": \"A complete, signed https://trusttasks.org/spec/auth/step-up/approver/attest/0.1 Trust Task document whose `purpose` is `decision`, issued by a step-up approver enrolled to the decision's signer: its `subject` is the DID that made this document's proof, its `audience` the executor, its `challenge` this decision's `challenge`, and its `boundTo` this decision's `payloadDigest`. The executor verifies it as a document in its own right — envelope, proof and payload against that specification's schemas — and over its members exactly as received: its proof covers every member, including ones this schema does not name, so it is deliberately an open object here rather than a typed one a binding could narrow.\",\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"kind\",\n \"statement\"\n ],\n \"title\": \"ApproverSigned\",\n \"type\": \"object\"\n }\n ],\n \"title\": \"Decision Evidence\"\n },\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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Acknowledgement of the recorded decision, and whether the approval threshold is now met.\",\n \"properties\": {\n \"actionId\": {\n \"description\": \"Echoed when the decision carried one.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"approvals\": {\n \"description\": \"Distinct approvals recorded so far.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"needed\": {\n \"description\": \"Distinct approvals required. Present when status is `pending`.\",\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"payloadDigest\": {\n \"$ref\": \"#/$defs/DigestMultibase\",\n \"description\": \"The digest this decision concerned, in the encoding the pending request carried it.\"\n },\n \"status\": {\n \"description\": \"`granted` = the threshold is met: the requester's re-submit will now execute, or — for a VTC action — the executor has executed (or is executing) the parked operation itself. `pending` = the approval was recorded but more are needed. `denied` = the request was aborted.\",\n \"enum\": [\n \"granted\",\n \"pending\",\n \"denied\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"status\",\n \"payloadDigest\"\n ],\n \"title\": \"Task Consent Decision — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/task-consent/decision/0.2\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"An enrolled approver authorizes (or refuses) one pending privileged task, bound to the exact payload it was shown. The proof on this document — not the transport session that carried it — is the authorization, and it is always made by the approver's own DID. Additive over 0.1: an OPTIONAL `evidence` member carries an additional factor (a WebAuthn assertion, or a signed step-up approver statement) the executor verifies on top of the proof, and an OPTIONAL `actionId` links the decision to a Verifiable Trust Community action (vtc/admin/actions/list/0.1). The outer document members (id, type, issuer, recipient, issuedAt, expiresAt, proof) are owned by the framework — SPEC §6.3.\",\n \"properties\": {\n \"actionId\": {\n \"description\": \"OPTIONAL identifier of the Verifiable Trust Community action (vtc/admin/actions/_shared/0.1 ActionId) this decision answers. A locator only: the executor finds the pending request by `payloadDigest` and checks `challenge` against it exactly as without this member, and refuses a decision whose `actionId` names a different action than the one those resolve to.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"challenge\": {\n \"description\": \"Echoes the challenge of the pending request this decision answers — a task-consent/request's `challenge`, or the `challenge` on a VTC action the approver may decide — binding the decision to that one pending request and that one approver. An executor MUST consume the challenge at execution rather than on receipt of this decision: a decision authorizes exactly one execution, and consuming it earlier lets an executor's own retry legitimately replay it.\",\n \"minLength\": 16,\n \"type\": \"string\"\n },\n \"decision\": {\n \"$ref\": \"#/$defs/Decision\"\n },\n \"evidence\": {\n \"$ref\": \"#/$defs/Evidence\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"payloadDigest\": {\n \"$ref\": \"#/$defs/DigestMultibase\",\n \"description\": \"Echoes the challenge-salted digest of the task being authorized, in the encoding the pending request carried it. The executor re-derives it from the payload it is about to execute and refuses on mismatch — this is what makes the approved payload the executed payload, cryptographically rather than by convention.\"\n },\n \"reason\": {\n \"description\": \"OPTIONAL human-facing note, most useful on a `deny`.\",\n \"maxLength\": 500,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"challenge\",\n \"payloadDigest\",\n \"decision\"\n ],\n \"title\": \"Task Consent Decision — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/task-consent/decision/0.2#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 \"AssertionResponse\": {\n \"$anchor\": \"assertionResponse\",\n \"additionalProperties\": false,\n \"description\": \"The credential the client returns from `navigator.credentials.get`. Binary fields are base64url-encoded.\",\n \"properties\": {\n \"authenticatorAttachment\": {\n \"enum\": [\n \"platform\",\n \"cross-platform\"\n ]\n },\n \"clientExtensionResults\": {\n \"type\": \"object\"\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"rawId\": {\n \"type\": \"string\"\n },\n \"response\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"authenticatorData\": {\n \"type\": \"string\"\n },\n \"clientDataJSON\": {\n \"type\": \"string\"\n },\n \"signature\": {\n \"type\": \"string\"\n },\n \"userHandle\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n }\n },\n \"required\": [\n \"clientDataJSON\",\n \"authenticatorData\",\n \"signature\"\n ],\n \"type\": \"object\"\n },\n \"type\": {\n \"const\": \"public-key\"\n }\n },\n \"required\": [\n \"id\",\n \"rawId\",\n \"type\",\n \"response\"\n ],\n \"title\": \"AuthenticatorAssertionResponse (login)\",\n \"type\": \"object\"\n },\n \"Decision\": {\n \"description\": \"The approver's answer. `deny` aborts the pending request; a subsequent submit of the same task starts a fresh one.\",\n \"enum\": [\n \"approve\",\n \"deny\"\n ],\n \"title\": \"Decision\",\n \"type\": \"string\"\n },\n \"DigestMultibase\": {\n \"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`.\",\n \"examples\": [\n \"zQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\"\n ],\n \"minLength\": 16,\n \"pattern\": \"^(z[1-9A-HJ-NP-Za-km-z]+|u[A-Za-z0-9_-]+)$\",\n \"title\": \"DigestMultibase\",\n \"type\": \"string\"\n },\n \"Evidence\": {\n \"$anchor\": \"evidence\",\n \"description\": \"An additional factor backing the decision, tagged on `kind`. It never replaces the document's proof — that proof is still REQUIRED and is by the approver's own DID — and it is verified by the executor on top of it. Absent, the proof alone is the authorization, exactly as in 0.1.\",\n \"oneOf\": [\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"assertion\": {\n \"$ref\": \"#/$defs/AssertionResponse\",\n \"description\": \"The unmodified AuthenticatorAssertionResponse from the platform WebAuthn API, the same shape auth/step-up/approve-response/0.5 carries. The WebAuthn challenge the approver's client passed to the authenticator MUST be the UTF-8 bytes of this decision's `challenge` value, so `clientDataJSON.challenge` is their base64url (no padding) encoding; the executor, as relying party, verifies it per WebAuthn Level 2 §7.2 against a credential enrolled to the approver whose DID made the document's proof. The commitment to the payload is the executor's binding: it issued that challenge for exactly one pending request, whose `payloadDigest` is salted with it.\"\n },\n \"kind\": {\n \"const\": \"webauthn\"\n }\n },\n \"required\": [\n \"kind\",\n \"assertion\"\n ],\n \"title\": \"WebAuthn\",\n \"type\": \"object\"\n },\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"kind\": {\n \"const\": \"approverSigned\"\n },\n \"statement\": {\n \"description\": \"A complete, signed https://trusttasks.org/spec/auth/step-up/approver/attest/0.1 Trust Task document whose `purpose` is `decision`, issued by a step-up approver enrolled to the decision's signer: its `subject` is the DID that made this document's proof, its `audience` the executor, its `challenge` this decision's `challenge`, and its `boundTo` this decision's `payloadDigest`. The executor verifies it as a document in its own right — envelope, proof and payload against that specification's schemas — and over its members exactly as received: its proof covers every member, including ones this schema does not name, so it is deliberately an open object here rather than a typed one a binding could narrow.\",\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"kind\",\n \"statement\"\n ],\n \"title\": \"ApproverSigned\",\n \"type\": \"object\"\n }\n ],\n \"title\": \"Decision Evidence\"\n },\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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Acknowledgement of the recorded decision, and whether the approval threshold is now met.\",\n \"properties\": {\n \"actionId\": {\n \"description\": \"Echoed when the decision carried one.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"approvals\": {\n \"description\": \"Distinct approvals recorded so far.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"needed\": {\n \"description\": \"Distinct approvals required. Present when status is `pending`.\",\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"payloadDigest\": {\n \"$ref\": \"#/$defs/DigestMultibase\",\n \"description\": \"The digest this decision concerned, in the encoding the pending request carried it.\"\n },\n \"status\": {\n \"description\": \"`granted` = the threshold is met: the requester's re-submit will now execute, or — for a VTC action — the executor has executed (or is executing) the parked operation itself. `pending` = the approval was recorded but more are needed. `denied` = the request was aborted.\",\n \"enum\": [\n \"granted\",\n \"pending\",\n \"denied\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"status\",\n \"payloadDigest\"\n ],\n \"title\": \"Task Consent Decision — 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::NO_PENDING,
error_codes::CHALLENGE_MISMATCH,
error_codes::NOT_AN_APPROVER,
error_codes::REQUESTER_EXCLUDED,
error_codes::ACTION_MISMATCH,
error_codes::EVIDENCE_INVALID,
error_codes::EVIDENCE_REQUIRED,
];
/// 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 {
/// `task-consent/decision:noPending`
///
/// No live pending consent exists for the `payloadDigest` — never raised, already decided, or lapsed.
///
/// Declared `retryable: false`.
pub const NO_PENDING: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:noPending",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `task-consent/decision:challengeMismatch`
///
/// The `challenge` does not match the pending request for this digest, or is not the one issued to this approver.
///
/// Declared `retryable: false`.
pub const CHALLENGE_MISMATCH: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:challengeMismatch",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `task-consent/decision:notAnApprover`
///
/// The proven signer is not a member of the approver set the policy named — including a signer that is a delegated or console key rather than an approver's own DID.
///
/// Declared `retryable: false`.
pub const NOT_AN_APPROVER: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:notAnApprover",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `task-consent/decision:requesterExcluded`
///
/// The proven signer is the task's requester and the policy set `excludeRequester`.
///
/// Declared `retryable: false`.
pub const REQUESTER_EXCLUDED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:requesterExcluded",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `task-consent/decision:actionMismatch`
///
/// The `actionId` names a different action from the pending request that `payloadDigest` and `challenge` resolve to.
///
/// Declared `retryable: false`.
pub const ACTION_MISMATCH: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:actionMismatch",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `task-consent/decision:evidenceInvalid`
///
/// `evidence` was supplied and failed verification: the assertion or statement did not verify, was not bound to this decision's challenge and digest, or was made by a factor not enrolled to the proven signer.
///
/// Declared `retryable: false`.
pub const EVIDENCE_INVALID: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:evidenceInvalid",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `task-consent/decision:evidenceRequired`
///
/// The executor's policy for this pending request calls for an evidence kind the decision did not carry.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const EVIDENCE_REQUIRED: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "task-consent/decision:evidenceRequired",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"acceptedKinds\":{\"items\":{\"enum\":[\"webauthn\",\"approverSigned\"],\"type\":\"string\"},\"type\":\"array\"}},\"type\":\"object\"}",
),
};
}