//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `did-management/server/config`. 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())
})
}
}
///`Payload`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/did-management/server/config/0.1",
/// "title": "Payload",
/// "type": "object",
/// "properties": {
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Default::default(),
}
}
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///The hosting service's effective, non-secret configuration. Members the deployment does not configure are absent; nothing here is a secret, and a consumer MUST NOT add one under ext.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "The hosting service's effective, non-secret configuration. Members the deployment does not configure are absent; nothing here is a secret, and a consumer MUST NOT add one under ext.",
/// "type": "object",
/// "required": [
/// "agentNames",
/// "deploymentMode",
/// "enabledMethods",
/// "serviceDid",
/// "softwareVersion",
/// "transports"
/// ],
/// "properties": {
/// "advertisedServices": {
/// "description": "`service[].type` values of the service's own resolved DID document. Absent when it could not be resolved. What the configuration enables and what the document advertises can differ; both are shown so an operator can see it.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "agentNames": {
/// "description": "Whether agent-name redirects (`/@name`) are served.",
/// "type": "boolean"
/// },
/// "deploymentMode": {
/// "description": "Implementation-defined deployment shape (e.g. a single-process daemon, or a control plane driving remote edges).",
/// "type": "string",
/// "minLength": 1
/// },
/// "didHostingUrl": {
/// "description": "Base URL hosted DIDs are published under. Absent when not configured.",
/// "type": "string",
/// "format": "uri"
/// },
/// "enabledMethods": {
/// "description": "DID methods this build can host.",
/// "type": "array",
/// "items": {
/// "type": "string",
/// "minLength": 1
/// }
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "listenAddress": {
/// "description": "The address the service's HTTP listener is bound to.",
/// "type": "string"
/// },
/// "logging": {
/// "type": "object",
/// "required": [
/// "format",
/// "level"
/// ],
/// "properties": {
/// "format": {
/// "type": "string"
/// },
/// "level": {
/// "type": "string"
/// }
/// },
/// "additionalProperties": false
/// },
/// "mediatorDid": {
/// "description": "The messaging mediator the service is reached through. Absent when it runs without one.",
/// "type": "string"
/// },
/// "publicUrl": {
/// "description": "Base URL of the service's own web surface. Absent when not configured.",
/// "type": "string",
/// "format": "uri"
/// },
/// "registry": {
/// "type": "object",
/// "required": [
/// "configuredInstances",
/// "healthCheckIntervalSeconds"
/// ],
/// "properties": {
/// "configuredInstances": {
/// "description": "Instances seeded from configuration rather than registered.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "healthCheckIntervalSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// }
/// },
/// "additionalProperties": false
/// },
/// "serviceDid": {
/// "description": "The service's own DID — the issuer of its replies.",
/// "type": "string",
/// "minLength": 1
/// },
/// "sessions": {
/// "type": "object",
/// "required": [
/// "accessTokenSeconds",
/// "adminIdleTimeoutSeconds",
/// "passkeyEnrollmentSeconds",
/// "refreshTokenSeconds"
/// ],
/// "properties": {
/// "accessTokenSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "adminIdleTimeoutSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "passkeyEnrollmentSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "refreshTokenSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// }
/// },
/// "additionalProperties": false
/// },
/// "softwareVersion": {
/// "description": "The running implementation's version string.",
/// "type": "string",
/// "minLength": 1
/// },
/// "storage": {
/// "type": "object",
/// "required": [
/// "dataDir"
/// ],
/// "properties": {
/// "dataDir": {
/// "type": "string"
/// }
/// },
/// "additionalProperties": false
/// },
/// "transports": {
/// "description": "Which messaging transports the configuration enables.",
/// "type": "object",
/// "required": [
/// "didcomm",
/// "tsp"
/// ],
/// "properties": {
/// "didcomm": {
/// "type": "boolean"
/// },
/// "tsp": {
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
/// },
/// "vta": {
/// "description": "The verifiable trust agent holding the service's identity. Absent for a self-managed deployment.",
/// "type": "object",
/// "properties": {
/// "did": {
/// "type": "string"
/// },
/// "url": {
/// "type": "string",
/// "format": "uri"
/// }
/// },
/// "additionalProperties": false
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
///`service[].type` values of the service's own resolved DID document. Absent when it could not be resolved. What the configuration enables and what the document advertises can differ; both are shown so an operator can see it.
#[serde(
rename = "advertisedServices",
default,
skip_serializing_if = "::std::vec::Vec::is_empty"
)]
pub advertised_services: ::std::vec::Vec<ResponseAdvertisedServicesItem>,
///Whether agent-name redirects (`/@name`) are served.
#[serde(rename = "agentNames")]
pub agent_names: bool,
///Implementation-defined deployment shape (e.g. a single-process daemon, or a control plane driving remote edges).
#[serde(rename = "deploymentMode")]
pub deployment_mode: ResponseDeploymentMode,
///Base URL hosted DIDs are published under. Absent when not configured.
#[serde(
rename = "didHostingUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub did_hosting_url: ::std::option::Option<::std::string::String>,
///DID methods this build can host.
#[serde(rename = "enabledMethods")]
pub enabled_methods: ::std::vec::Vec<ResponseEnabledMethodsItem>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The address the service's HTTP listener is bound to.
#[serde(
rename = "listenAddress",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub listen_address: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub logging: ::std::option::Option<ResponseLogging>,
///The messaging mediator the service is reached through. Absent when it runs without one.
#[serde(
rename = "mediatorDid",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub mediator_did: ::std::option::Option<::std::string::String>,
///Base URL of the service's own web surface. Absent when not configured.
#[serde(
rename = "publicUrl",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub public_url: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub registry: ::std::option::Option<ResponseRegistry>,
///The service's own DID — the issuer of its replies.
#[serde(rename = "serviceDid")]
pub service_did: ResponseServiceDid,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sessions: ::std::option::Option<ResponseSessions>,
///The running implementation's version string.
#[serde(rename = "softwareVersion")]
pub software_version: ResponseSoftwareVersion,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub storage: ::std::option::Option<ResponseStorage>,
pub transports: ResponseTransports,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub vta: ::std::option::Option<ResponseVta>,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponseAdvertisedServicesItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseAdvertisedServicesItem(::std::string::String);
impl ::std::ops::Deref for ResponseAdvertisedServicesItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseAdvertisedServicesItem> for ::std::string::String {
fn from(value: ResponseAdvertisedServicesItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseAdvertisedServicesItem {
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 ResponseAdvertisedServicesItem {
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 ResponseAdvertisedServicesItem {
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 ResponseAdvertisedServicesItem {
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 ResponseAdvertisedServicesItem {
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())
})
}
}
///Implementation-defined deployment shape (e.g. a single-process daemon, or a control plane driving remote edges).
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Implementation-defined deployment shape (e.g. a single-process daemon, or a control plane driving remote edges).",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseDeploymentMode(::std::string::String);
impl ::std::ops::Deref for ResponseDeploymentMode {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseDeploymentMode> for ::std::string::String {
fn from(value: ResponseDeploymentMode) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseDeploymentMode {
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 ResponseDeploymentMode {
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 ResponseDeploymentMode {
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 ResponseDeploymentMode {
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 ResponseDeploymentMode {
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())
})
}
}
///`ResponseEnabledMethodsItem`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseEnabledMethodsItem(::std::string::String);
impl ::std::ops::Deref for ResponseEnabledMethodsItem {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseEnabledMethodsItem> for ::std::string::String {
fn from(value: ResponseEnabledMethodsItem) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseEnabledMethodsItem {
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 ResponseEnabledMethodsItem {
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 ResponseEnabledMethodsItem {
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 ResponseEnabledMethodsItem {
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 ResponseEnabledMethodsItem {
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())
})
}
}
///`ResponseLogging`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "format",
/// "level"
/// ],
/// "properties": {
/// "format": {
/// "type": "string"
/// },
/// "level": {
/// "type": "string"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseLogging {
pub format: ::std::string::String,
pub level: ::std::string::String,
}
impl ResponseLogging {
pub fn builder() -> builder::ResponseLogging {
Default::default()
}
}
///`ResponseRegistry`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "configuredInstances",
/// "healthCheckIntervalSeconds"
/// ],
/// "properties": {
/// "configuredInstances": {
/// "description": "Instances seeded from configuration rather than registered.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "healthCheckIntervalSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseRegistry {
///Instances seeded from configuration rather than registered.
#[serde(rename = "configuredInstances")]
pub configured_instances: u64,
#[serde(rename = "healthCheckIntervalSeconds")]
pub health_check_interval_seconds: ::std::num::NonZeroU64,
}
impl ResponseRegistry {
pub fn builder() -> builder::ResponseRegistry {
Default::default()
}
}
///The service's own DID — the issuer of its replies.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The service's own DID — the issuer of its replies.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseServiceDid(::std::string::String);
impl ::std::ops::Deref for ResponseServiceDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseServiceDid> for ::std::string::String {
fn from(value: ResponseServiceDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseServiceDid {
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 ResponseServiceDid {
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 ResponseServiceDid {
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 ResponseServiceDid {
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 ResponseServiceDid {
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())
})
}
}
///`ResponseSessions`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "accessTokenSeconds",
/// "adminIdleTimeoutSeconds",
/// "passkeyEnrollmentSeconds",
/// "refreshTokenSeconds"
/// ],
/// "properties": {
/// "accessTokenSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "adminIdleTimeoutSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "passkeyEnrollmentSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "refreshTokenSeconds": {
/// "type": "integer",
/// "minimum": 1.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseSessions {
#[serde(rename = "accessTokenSeconds")]
pub access_token_seconds: ::std::num::NonZeroU64,
#[serde(rename = "adminIdleTimeoutSeconds")]
pub admin_idle_timeout_seconds: ::std::num::NonZeroU64,
#[serde(rename = "passkeyEnrollmentSeconds")]
pub passkey_enrollment_seconds: ::std::num::NonZeroU64,
#[serde(rename = "refreshTokenSeconds")]
pub refresh_token_seconds: ::std::num::NonZeroU64,
}
impl ResponseSessions {
pub fn builder() -> builder::ResponseSessions {
Default::default()
}
}
///The running implementation's version string.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The running implementation's version string.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseSoftwareVersion(::std::string::String);
impl ::std::ops::Deref for ResponseSoftwareVersion {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseSoftwareVersion> for ::std::string::String {
fn from(value: ResponseSoftwareVersion) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseSoftwareVersion {
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 ResponseSoftwareVersion {
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 ResponseSoftwareVersion {
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 ResponseSoftwareVersion {
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 ResponseSoftwareVersion {
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())
})
}
}
///`ResponseStorage`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "dataDir"
/// ],
/// "properties": {
/// "dataDir": {
/// "type": "string"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseStorage {
#[serde(rename = "dataDir")]
pub data_dir: ::std::string::String,
}
impl ResponseStorage {
pub fn builder() -> builder::ResponseStorage {
Default::default()
}
}
///Which messaging transports the configuration enables.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Which messaging transports the configuration enables.",
/// "type": "object",
/// "required": [
/// "didcomm",
/// "tsp"
/// ],
/// "properties": {
/// "didcomm": {
/// "type": "boolean"
/// },
/// "tsp": {
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseTransports {
pub didcomm: bool,
pub tsp: bool,
}
impl ResponseTransports {
pub fn builder() -> builder::ResponseTransports {
Default::default()
}
}
///The verifiable trust agent holding the service's identity. Absent for a self-managed deployment.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The verifiable trust agent holding the service's identity. Absent for a self-managed deployment.",
/// "type": "object",
/// "properties": {
/// "did": {
/// "type": "string"
/// },
/// "url": {
/// "type": "string",
/// "format": "uri"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseVta {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub did: ::std::option::Option<::std::string::String>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub url: ::std::option::Option<::std::string::String>,
}
impl ::std::default::Default for ResponseVta {
fn default() -> Self {
Self {
did: Default::default(),
url: Default::default(),
}
}
}
impl ResponseVta {
pub fn builder() -> builder::ResponseVta {
Default::default()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
}
}
}
impl Payload {
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
}
}
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 { ext: value.ext? })
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self { ext: Ok(value.ext) }
}
}
#[derive(Clone, Debug)]
pub struct Response {
advertised_services: ::std::result::Result<
::std::vec::Vec<super::ResponseAdvertisedServicesItem>,
::std::string::String,
>,
agent_names: ::std::result::Result<bool, ::std::string::String>,
deployment_mode:
::std::result::Result<super::ResponseDeploymentMode, ::std::string::String>,
did_hosting_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
enabled_methods: ::std::result::Result<
::std::vec::Vec<super::ResponseEnabledMethodsItem>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
listen_address: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
logging: ::std::result::Result<
::std::option::Option<super::ResponseLogging>,
::std::string::String,
>,
mediator_did: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
public_url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
registry: ::std::result::Result<
::std::option::Option<super::ResponseRegistry>,
::std::string::String,
>,
service_did: ::std::result::Result<super::ResponseServiceDid, ::std::string::String>,
sessions: ::std::result::Result<
::std::option::Option<super::ResponseSessions>,
::std::string::String,
>,
software_version:
::std::result::Result<super::ResponseSoftwareVersion, ::std::string::String>,
storage: ::std::result::Result<
::std::option::Option<super::ResponseStorage>,
::std::string::String,
>,
transports: ::std::result::Result<super::ResponseTransports, ::std::string::String>,
vta:
::std::result::Result<::std::option::Option<super::ResponseVta>, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
advertised_services: Ok(Default::default()),
agent_names: Err("no value supplied for agent_names".to_string()),
deployment_mode: Err("no value supplied for deployment_mode".to_string()),
did_hosting_url: Ok(Default::default()),
enabled_methods: Err("no value supplied for enabled_methods".to_string()),
ext: Ok(Default::default()),
listen_address: Ok(Default::default()),
logging: Ok(Default::default()),
mediator_did: Ok(Default::default()),
public_url: Ok(Default::default()),
registry: Ok(Default::default()),
service_did: Err("no value supplied for service_did".to_string()),
sessions: Ok(Default::default()),
software_version: Err("no value supplied for software_version".to_string()),
storage: Ok(Default::default()),
transports: Err("no value supplied for transports".to_string()),
vta: Ok(Default::default()),
}
}
}
impl Response {
pub fn advertised_services<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseAdvertisedServicesItem>>,
T::Error: ::std::fmt::Display,
{
self.advertised_services = value.try_into().map_err(|e| {
format!("error converting supplied value for advertised_services: {e}")
});
self
}
pub fn agent_names<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.agent_names = value
.try_into()
.map_err(|e| format!("error converting supplied value for agent_names: {e}"));
self
}
pub fn deployment_mode<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseDeploymentMode>,
T::Error: ::std::fmt::Display,
{
self.deployment_mode = value
.try_into()
.map_err(|e| format!("error converting supplied value for deployment_mode: {e}"));
self
}
pub fn did_hosting_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.did_hosting_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for did_hosting_url: {e}"));
self
}
pub fn enabled_methods<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::ResponseEnabledMethodsItem>>,
T::Error: ::std::fmt::Display,
{
self.enabled_methods = value
.try_into()
.map_err(|e| format!("error converting supplied value for enabled_methods: {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 listen_address<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.listen_address = value
.try_into()
.map_err(|e| format!("error converting supplied value for listen_address: {e}"));
self
}
pub fn logging<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseLogging>>,
T::Error: ::std::fmt::Display,
{
self.logging = value
.try_into()
.map_err(|e| format!("error converting supplied value for logging: {e}"));
self
}
pub fn mediator_did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.mediator_did = value
.try_into()
.map_err(|e| format!("error converting supplied value for mediator_did: {e}"));
self
}
pub fn public_url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.public_url = value
.try_into()
.map_err(|e| format!("error converting supplied value for public_url: {e}"));
self
}
pub fn registry<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseRegistry>>,
T::Error: ::std::fmt::Display,
{
self.registry = value
.try_into()
.map_err(|e| format!("error converting supplied value for registry: {e}"));
self
}
pub fn service_did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseServiceDid>,
T::Error: ::std::fmt::Display,
{
self.service_did = value
.try_into()
.map_err(|e| format!("error converting supplied value for service_did: {e}"));
self
}
pub fn sessions<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseSessions>>,
T::Error: ::std::fmt::Display,
{
self.sessions = value
.try_into()
.map_err(|e| format!("error converting supplied value for sessions: {e}"));
self
}
pub fn software_version<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseSoftwareVersion>,
T::Error: ::std::fmt::Display,
{
self.software_version = value
.try_into()
.map_err(|e| format!("error converting supplied value for software_version: {e}"));
self
}
pub fn storage<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseStorage>>,
T::Error: ::std::fmt::Display,
{
self.storage = value
.try_into()
.map_err(|e| format!("error converting supplied value for storage: {e}"));
self
}
pub fn transports<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseTransports>,
T::Error: ::std::fmt::Display,
{
self.transports = value
.try_into()
.map_err(|e| format!("error converting supplied value for transports: {e}"));
self
}
pub fn vta<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseVta>>,
T::Error: ::std::fmt::Display,
{
self.vta = value
.try_into()
.map_err(|e| format!("error converting supplied value for vta: {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 {
advertised_services: value.advertised_services?,
agent_names: value.agent_names?,
deployment_mode: value.deployment_mode?,
did_hosting_url: value.did_hosting_url?,
enabled_methods: value.enabled_methods?,
ext: value.ext?,
listen_address: value.listen_address?,
logging: value.logging?,
mediator_did: value.mediator_did?,
public_url: value.public_url?,
registry: value.registry?,
service_did: value.service_did?,
sessions: value.sessions?,
software_version: value.software_version?,
storage: value.storage?,
transports: value.transports?,
vta: value.vta?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
advertised_services: Ok(value.advertised_services),
agent_names: Ok(value.agent_names),
deployment_mode: Ok(value.deployment_mode),
did_hosting_url: Ok(value.did_hosting_url),
enabled_methods: Ok(value.enabled_methods),
ext: Ok(value.ext),
listen_address: Ok(value.listen_address),
logging: Ok(value.logging),
mediator_did: Ok(value.mediator_did),
public_url: Ok(value.public_url),
registry: Ok(value.registry),
service_did: Ok(value.service_did),
sessions: Ok(value.sessions),
software_version: Ok(value.software_version),
storage: Ok(value.storage),
transports: Ok(value.transports),
vta: Ok(value.vta),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseLogging {
format: ::std::result::Result<::std::string::String, ::std::string::String>,
level: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl ::std::default::Default for ResponseLogging {
fn default() -> Self {
Self {
format: Err("no value supplied for format".to_string()),
level: Err("no value supplied for level".to_string()),
}
}
}
impl ResponseLogging {
pub fn format<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.format = value
.try_into()
.map_err(|e| format!("error converting supplied value for format: {e}"));
self
}
pub fn level<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.level = value
.try_into()
.map_err(|e| format!("error converting supplied value for level: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseLogging> for super::ResponseLogging {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseLogging,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
format: value.format?,
level: value.level?,
})
}
}
impl ::std::convert::From<super::ResponseLogging> for ResponseLogging {
fn from(value: super::ResponseLogging) -> Self {
Self {
format: Ok(value.format),
level: Ok(value.level),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseRegistry {
configured_instances: ::std::result::Result<u64, ::std::string::String>,
health_check_interval_seconds:
::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
}
impl ::std::default::Default for ResponseRegistry {
fn default() -> Self {
Self {
configured_instances: Err("no value supplied for configured_instances".to_string()),
health_check_interval_seconds: Err(
"no value supplied for health_check_interval_seconds".to_string(),
),
}
}
}
impl ResponseRegistry {
pub fn configured_instances<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.configured_instances = value.try_into().map_err(|e| {
format!("error converting supplied value for configured_instances: {e}")
});
self
}
pub fn health_check_interval_seconds<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.health_check_interval_seconds = value.try_into().map_err(|e| {
format!("error converting supplied value for health_check_interval_seconds: {e}")
});
self
}
}
impl ::std::convert::TryFrom<ResponseRegistry> for super::ResponseRegistry {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseRegistry,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
configured_instances: value.configured_instances?,
health_check_interval_seconds: value.health_check_interval_seconds?,
})
}
}
impl ::std::convert::From<super::ResponseRegistry> for ResponseRegistry {
fn from(value: super::ResponseRegistry) -> Self {
Self {
configured_instances: Ok(value.configured_instances),
health_check_interval_seconds: Ok(value.health_check_interval_seconds),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseSessions {
access_token_seconds: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
admin_idle_timeout_seconds:
::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
passkey_enrollment_seconds:
::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
refresh_token_seconds: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
}
impl ::std::default::Default for ResponseSessions {
fn default() -> Self {
Self {
access_token_seconds: Err("no value supplied for access_token_seconds".to_string()),
admin_idle_timeout_seconds: Err(
"no value supplied for admin_idle_timeout_seconds".to_string()
),
passkey_enrollment_seconds: Err(
"no value supplied for passkey_enrollment_seconds".to_string()
),
refresh_token_seconds: Err(
"no value supplied for refresh_token_seconds".to_string()
),
}
}
}
impl ResponseSessions {
pub fn access_token_seconds<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.access_token_seconds = value.try_into().map_err(|e| {
format!("error converting supplied value for access_token_seconds: {e}")
});
self
}
pub fn admin_idle_timeout_seconds<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.admin_idle_timeout_seconds = value.try_into().map_err(|e| {
format!("error converting supplied value for admin_idle_timeout_seconds: {e}")
});
self
}
pub fn passkey_enrollment_seconds<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.passkey_enrollment_seconds = value.try_into().map_err(|e| {
format!("error converting supplied value for passkey_enrollment_seconds: {e}")
});
self
}
pub fn refresh_token_seconds<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.refresh_token_seconds = value.try_into().map_err(|e| {
format!("error converting supplied value for refresh_token_seconds: {e}")
});
self
}
}
impl ::std::convert::TryFrom<ResponseSessions> for super::ResponseSessions {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseSessions,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
access_token_seconds: value.access_token_seconds?,
admin_idle_timeout_seconds: value.admin_idle_timeout_seconds?,
passkey_enrollment_seconds: value.passkey_enrollment_seconds?,
refresh_token_seconds: value.refresh_token_seconds?,
})
}
}
impl ::std::convert::From<super::ResponseSessions> for ResponseSessions {
fn from(value: super::ResponseSessions) -> Self {
Self {
access_token_seconds: Ok(value.access_token_seconds),
admin_idle_timeout_seconds: Ok(value.admin_idle_timeout_seconds),
passkey_enrollment_seconds: Ok(value.passkey_enrollment_seconds),
refresh_token_seconds: Ok(value.refresh_token_seconds),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseStorage {
data_dir: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl ::std::default::Default for ResponseStorage {
fn default() -> Self {
Self {
data_dir: Err("no value supplied for data_dir".to_string()),
}
}
}
impl ResponseStorage {
pub fn data_dir<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.data_dir = value
.try_into()
.map_err(|e| format!("error converting supplied value for data_dir: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseStorage> for super::ResponseStorage {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseStorage,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
data_dir: value.data_dir?,
})
}
}
impl ::std::convert::From<super::ResponseStorage> for ResponseStorage {
fn from(value: super::ResponseStorage) -> Self {
Self {
data_dir: Ok(value.data_dir),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseTransports {
didcomm: ::std::result::Result<bool, ::std::string::String>,
tsp: ::std::result::Result<bool, ::std::string::String>,
}
impl ::std::default::Default for ResponseTransports {
fn default() -> Self {
Self {
didcomm: Err("no value supplied for didcomm".to_string()),
tsp: Err("no value supplied for tsp".to_string()),
}
}
}
impl ResponseTransports {
pub fn didcomm<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.didcomm = value
.try_into()
.map_err(|e| format!("error converting supplied value for didcomm: {e}"));
self
}
pub fn tsp<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.tsp = value
.try_into()
.map_err(|e| format!("error converting supplied value for tsp: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseTransports> for super::ResponseTransports {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseTransports,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
didcomm: value.didcomm?,
tsp: value.tsp?,
})
}
}
impl ::std::convert::From<super::ResponseTransports> for ResponseTransports {
fn from(value: super::ResponseTransports) -> Self {
Self {
didcomm: Ok(value.didcomm),
tsp: Ok(value.tsp),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseVta {
did: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
url: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
}
impl ::std::default::Default for ResponseVta {
fn default() -> Self {
Self {
did: Ok(Default::default()),
url: Ok(Default::default()),
}
}
}
impl ResponseVta {
pub fn did<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.did = value
.try_into()
.map_err(|e| format!("error converting supplied value for did: {e}"));
self
}
pub fn url<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.url = value
.try_into()
.map_err(|e| format!("error converting supplied value for url: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseVta> for super::ResponseVta {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseVta,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
did: value.did?,
url: value.url?,
})
}
}
impl ::std::convert::From<super::ResponseVta> for ResponseVta {
fn from(value: super::ResponseVta) -> Self {
Self {
did: Ok(value.did),
url: Ok(value.url),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/did-management/server/config/0.1";
const IS_PROOF_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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The hosting service's effective, non-secret configuration. Members the deployment does not configure are absent; nothing here is a secret, and a consumer MUST NOT add one under ext.\",\n \"properties\": {\n \"advertisedServices\": {\n \"description\": \"`service[].type` values of the service's own resolved DID document. Absent when it could not be resolved. What the configuration enables and what the document advertises can differ; both are shown so an operator can see it.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"agentNames\": {\n \"description\": \"Whether agent-name redirects (`/@name`) are served.\",\n \"type\": \"boolean\"\n },\n \"deploymentMode\": {\n \"description\": \"Implementation-defined deployment shape (e.g. a single-process daemon, or a control plane driving remote edges).\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"didHostingUrl\": {\n \"description\": \"Base URL hosted DIDs are published under. Absent when not configured.\",\n \"format\": \"uri\",\n \"type\": \"string\"\n },\n \"enabledMethods\": {\n \"description\": \"DID methods this build can host.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"listenAddress\": {\n \"description\": \"The address the service's HTTP listener is bound to.\",\n \"type\": \"string\"\n },\n \"logging\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"format\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"level\",\n \"format\"\n ],\n \"type\": \"object\"\n },\n \"mediatorDid\": {\n \"description\": \"The messaging mediator the service is reached through. Absent when it runs without one.\",\n \"type\": \"string\"\n },\n \"publicUrl\": {\n \"description\": \"Base URL of the service's own web surface. Absent when not configured.\",\n \"format\": \"uri\",\n \"type\": \"string\"\n },\n \"registry\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"configuredInstances\": {\n \"description\": \"Instances seeded from configuration rather than registered.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"healthCheckIntervalSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"healthCheckIntervalSeconds\",\n \"configuredInstances\"\n ],\n \"type\": \"object\"\n },\n \"serviceDid\": {\n \"description\": \"The service's own DID — the issuer of its replies.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"sessions\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"accessTokenSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"adminIdleTimeoutSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"passkeyEnrollmentSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"refreshTokenSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"accessTokenSeconds\",\n \"refreshTokenSeconds\",\n \"adminIdleTimeoutSeconds\",\n \"passkeyEnrollmentSeconds\"\n ],\n \"type\": \"object\"\n },\n \"softwareVersion\": {\n \"description\": \"The running implementation's version string.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"storage\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"dataDir\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"dataDir\"\n ],\n \"type\": \"object\"\n },\n \"transports\": {\n \"additionalProperties\": false,\n \"description\": \"Which messaging transports the configuration enables.\",\n \"properties\": {\n \"didcomm\": {\n \"type\": \"boolean\"\n },\n \"tsp\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"tsp\",\n \"didcomm\"\n ],\n \"type\": \"object\"\n },\n \"vta\": {\n \"additionalProperties\": false,\n \"description\": \"The verifiable trust agent holding the service's identity. Absent for a self-managed deployment.\",\n \"properties\": {\n \"did\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"format\": \"uri\",\n \"type\": \"string\"\n }\n },\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"serviceDid\",\n \"softwareVersion\",\n \"deploymentMode\",\n \"transports\",\n \"enabledMethods\",\n \"agentNames\"\n ],\n \"title\": \"Server Config — response payload\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/did-management/server/config/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n }\n },\n \"title\": \"Server Config — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/did-management/server/config/0.1#response";
const IS_PROOF_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 \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"The hosting service's effective, non-secret configuration. Members the deployment does not configure are absent; nothing here is a secret, and a consumer MUST NOT add one under ext.\",\n \"properties\": {\n \"advertisedServices\": {\n \"description\": \"`service[].type` values of the service's own resolved DID document. Absent when it could not be resolved. What the configuration enables and what the document advertises can differ; both are shown so an operator can see it.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"agentNames\": {\n \"description\": \"Whether agent-name redirects (`/@name`) are served.\",\n \"type\": \"boolean\"\n },\n \"deploymentMode\": {\n \"description\": \"Implementation-defined deployment shape (e.g. a single-process daemon, or a control plane driving remote edges).\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"didHostingUrl\": {\n \"description\": \"Base URL hosted DIDs are published under. Absent when not configured.\",\n \"format\": \"uri\",\n \"type\": \"string\"\n },\n \"enabledMethods\": {\n \"description\": \"DID methods this build can host.\",\n \"items\": {\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"listenAddress\": {\n \"description\": \"The address the service's HTTP listener is bound to.\",\n \"type\": \"string\"\n },\n \"logging\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"format\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"level\",\n \"format\"\n ],\n \"type\": \"object\"\n },\n \"mediatorDid\": {\n \"description\": \"The messaging mediator the service is reached through. Absent when it runs without one.\",\n \"type\": \"string\"\n },\n \"publicUrl\": {\n \"description\": \"Base URL of the service's own web surface. Absent when not configured.\",\n \"format\": \"uri\",\n \"type\": \"string\"\n },\n \"registry\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"configuredInstances\": {\n \"description\": \"Instances seeded from configuration rather than registered.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"healthCheckIntervalSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"healthCheckIntervalSeconds\",\n \"configuredInstances\"\n ],\n \"type\": \"object\"\n },\n \"serviceDid\": {\n \"description\": \"The service's own DID — the issuer of its replies.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"sessions\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"accessTokenSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"adminIdleTimeoutSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"passkeyEnrollmentSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"refreshTokenSeconds\": {\n \"minimum\": 1,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"accessTokenSeconds\",\n \"refreshTokenSeconds\",\n \"adminIdleTimeoutSeconds\",\n \"passkeyEnrollmentSeconds\"\n ],\n \"type\": \"object\"\n },\n \"softwareVersion\": {\n \"description\": \"The running implementation's version string.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"storage\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"dataDir\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"dataDir\"\n ],\n \"type\": \"object\"\n },\n \"transports\": {\n \"additionalProperties\": false,\n \"description\": \"Which messaging transports the configuration enables.\",\n \"properties\": {\n \"didcomm\": {\n \"type\": \"boolean\"\n },\n \"tsp\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"tsp\",\n \"didcomm\"\n ],\n \"type\": \"object\"\n },\n \"vta\": {\n \"additionalProperties\": false,\n \"description\": \"The verifiable trust agent holding the service's identity. Absent for a self-managed deployment.\",\n \"properties\": {\n \"did\": {\n \"type\": \"string\"\n },\n \"url\": {\n \"format\": \"uri\",\n \"type\": \"string\"\n }\n },\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"serviceDid\",\n \"softwareVersion\",\n \"deploymentMode\",\n \"transports\",\n \"enabledMethods\",\n \"agentNames\"\n ],\n \"title\": \"Server Config — 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] = &[];
#[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:b06c8fde-7d9b-4cef-9e8f-6b7c8d9e0f01\",\n \"type\": \"https://trusttasks.org/spec/did-management/server/config/0.1\",\n \"issuer\": \"did:webvh:QmAdminScid1:admin.example.com:alice\",\n \"recipient\": \"did:webvh:QmControlScid2:control.example.com\",\n \"issuedAt\": \"2026-09-27T09:00:00Z\",\n \"payload\": {}\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:b06c8fde-7d9b-4cef-9e8f-6b7c8d9e0f02\",\n \"type\": \"https://trusttasks.org/spec/did-management/server/config/0.1#response\",\n \"threadId\": \"urn:uuid:b06c8fde-7d9b-4cef-9e8f-6b7c8d9e0f01\",\n \"issuer\": \"did:webvh:QmControlScid2:control.example.com\",\n \"recipient\": \"did:webvh:QmAdminScid1:admin.example.com:alice\",\n \"issuedAt\": \"2026-09-27T09:00:01Z\",\n \"payload\": {\n \"serviceDid\": \"did:webvh:QmControlScid2:control.example.com\",\n \"softwareVersion\": \"0.9.0\",\n \"deploymentMode\": \"control-plane\",\n \"publicUrl\": \"https://control.example.com\",\n \"didHostingUrl\": \"https://did.example.com\",\n \"mediatorDid\": \"did:webvh:QmMediatorScid6:mediator.example.com\",\n \"transports\": { \"tsp\": true, \"didcomm\": true },\n \"advertisedServices\": [\"TSPTransport\", \"DIDCommMessaging\"],\n \"enabledMethods\": [\"webvh\", \"web\"],\n \"agentNames\": true,\n \"listenAddress\": \"0.0.0.0:8530\",\n \"vta\": { \"did\": \"did:webvh:QmVtaScid5:vta.example.com\", \"url\": \"https://vta.example.com\" },\n \"registry\": { \"healthCheckIntervalSeconds\": 60, \"configuredInstances\": 0 },\n \"sessions\": { \"accessTokenSeconds\": 900, \"refreshTokenSeconds\": 86400, \"adminIdleTimeoutSeconds\": 1800, \"passkeyEnrollmentSeconds\": 86400 },\n \"storage\": { \"dataDir\": \"/var/lib/did-hosting\" },\n \"logging\": { \"level\": \"info\", \"format\": \"json\" }\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");
}
/// Each fixture in `payload.invalid-examples.json` MUST be
/// rejected by at least one of: serde deserialization, or
/// JSON-Schema validation under the `validate` feature. The
/// fixture file documents the producer-side bug class that
/// each payload exemplifies; this generated test pins it.
#[cfg(feature = "validate")]
#[test]
fn rejects_invalid_examples() {
use crate::validate::ValidatedPayload;
let fixtures: &[(&str, &str)] = &[
(
"The read takes no selector — the whole non-secret configuration is returned.",
"{\n \"section\": \"sessions\"\n}",
),
(
"Asking for secrets is not a member.",
"{\n \"includeSecrets\": true\n}",
),
];
for (i, (note, raw)) in fixtures.iter().enumerate() {
let value: serde_json::Value = match serde_json::from_str(raw) {
Ok(v) => v,
Err(_) => continue,
};
let serde_ok = serde_json::from_value::<super::Payload>(value.clone()).is_ok();
let schema_ok = super::Payload::validate_value(&value).is_ok();
assert!(
!(serde_ok && schema_ok),
"invalid-example #{} ({:?}) was accepted by both serde and JSON Schema; \
the fixture's stated failure class is no longer caught:\n{}",
i + 1,
note,
raw
);
}
}
}