//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `rooms/keys/act`. Version: `0.3`.
#[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())
})
}
}
///A member's own client asks the member's key holder to complete one host-bound room request — or one of the two requests by which a member takes up a community's offer of admission to a room — as the member: the member's own authority narrowed to the one action the request's type needs, the member as issuer, and the member's signature. The outer document members are owned by the framework — SPEC §6.3.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/rooms/keys/act/0.3",
/// "title": "Payload",
/// "description": "A member's own client asks the member's key holder to complete one host-bound room request — or one of the two requests by which a member takes up a community's offer of admission to a room — as the member: the member's own authority narrowed to the one action the request's type needs, the member as issuer, and the member's signature. The outer document members are owned by the framework — SPEC §6.3.",
/// "type": "object",
/// "required": [
/// "document"
/// ],
/// "properties": {
/// "document": {
/// "description": "The room request to complete, as the client will send it, minus its presentation and its proof.",
/// "$ref": "#/definitions/UnsignedRoomRequest"
/// },
/// "ext": {
/// "description": "Ecosystem-defined extension members per SPEC.md §4.5.1.",
/// "$ref": "#/definitions/Ext"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///The room request to complete, as the client will send it, minus its presentation and its proof.
pub document: UnsignedRoomRequest,
///Ecosystem-defined extension members per SPEC.md §4.5.1.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.3#response. The request, completed as the member, for the caller to send to its recipient unaltered.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.3#response. The request, completed as the member, for the caller to send to its recipient unaltered.",
/// "type": "object",
/// "required": [
/// "document",
/// "principal"
/// ],
/// "properties": {
/// "document": {
/// "description": "The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged.",
/// "type": "object",
/// "required": [
/// "id",
/// "issuedAt",
/// "issuer",
/// "payload",
/// "proof",
/// "recipient",
/// "type"
/// ]
/// },
/// "expiresAt": {
/// "description": "When the inserted presentation's leaf lapses. Absent when the type takes no presentation.",
/// "type": "string",
/// "format": "date-time"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "principal": {
/// "description": "The member the recipient signed as: the completed document's `issuer`.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
pub document: ResponseDocument,
///When the inserted presentation's leaf lapses. Absent when the type takes no presentation.
#[serde(
rename = "expiresAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub expires_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The member the recipient signed as: the completed document's `issuer`.
pub principal: ResponsePrincipal,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged.",
/// "type": "object",
/// "required": [
/// "id",
/// "issuedAt",
/// "issuer",
/// "payload",
/// "proof",
/// "recipient",
/// "type"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[non_exhaustive]
pub struct ResponseDocument {
pub id: ::serde_json::Value,
#[serde(rename = "issuedAt")]
pub issued_at: ::serde_json::Value,
pub issuer: ::serde_json::Value,
pub payload: ::serde_json::Value,
pub proof: ::serde_json::Value,
pub recipient: ::serde_json::Value,
#[serde(rename = "type")]
pub type_: ::serde_json::Value,
}
impl ResponseDocument {
pub fn builder() -> builder::ResponseDocument {
Default::default()
}
}
///The member the recipient signed as: the completed document's `issuer`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The member the recipient signed as: the completed document's `issuer`.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponsePrincipal(::std::string::String);
impl ::std::ops::Deref for ResponsePrincipal {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponsePrincipal> for ::std::string::String {
fn from(value: ResponsePrincipal) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponsePrincipal {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^did:").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^did:\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponsePrincipal {
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 ResponsePrincipal {
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 ResponsePrincipal {
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 ResponsePrincipal {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///A Trust Task document of a type in the rooms/keys/act table, built by the member's client: no proof, and no presentation in its payload. The recipient validates the payload against the named type's own schema; this one fixes only the envelope.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Unsigned room request",
/// "description": "A Trust Task document of a type in the rooms/keys/act table, built by the member's client: no proof, and no presentation in its payload. The recipient validates the payload against the named type's own schema; this one fixes only the envelope.",
/// "type": "object",
/// "not": {
/// "required": [
/// "proof"
/// ]
/// },
/// "required": [
/// "id",
/// "issuedAt",
/// "payload",
/// "recipient",
/// "type"
/// ],
/// "properties": {
/// "expiresAt": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "id": {
/// "description": "The request's identifier, set by the client. The host keys duplicate-execution protection on it.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
/// },
/// "issuedAt": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "issuer": {
/// "description": "The member to act as, and this task's subject (subjectPath /document/issuer). REQUIRED for a type that names no room (rooms/blobs/chunk/0.1, rooms/blobs/upload/{commit,abort}/0.2), where it is the member whose request opened the transfer; REQUIRED for the offer types (vtc/rooms/offers/list/0.1, vtc/rooms/offers/accept/0.1), where it is the DID the community addressed its offer to; REQUIRED where the caller may act as more than one member of the room; optional where it may act as exactly one. A rule over two members this schema does not express: the recipient refuses an absent issuer it needs with principalAmbiguous. Never the client's own identifier.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
/// },
/// "payload": {
/// "description": "The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, where the type takes one, and refuses a payload that already carries one. For vtc/rooms/offers/accept/0.1 a `keyPackage`, where present, MUST be one the recipient minted (Recipient item 10).",
/// "type": "object"
/// },
/// "recipient": {
/// "description": "The room's host, or for the offer types the community that made the offer: the party the completed document is for. Covered by the member's proof.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
/// },
/// "threadId": {
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
/// },
/// "type": {
/// "description": "The room request's Type URI: a rooms/* request, or vtc/rooms/offers/{list,accept}. Only the types in this task's table are completed; any other is `typeNotActable`.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^https://trusttasks\\.org/spec/(rooms|vtc/rooms/offers)/"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "unsigned-room-request"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct UnsignedRoomRequest {
#[serde(
rename = "expiresAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub expires_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The request's identifier, set by the client. The host keys duplicate-execution protection on it.
pub id: UnsignedRoomRequestId,
#[serde(rename = "issuedAt")]
pub issued_at: ::chrono::DateTime<::chrono::offset::Utc>,
///The member to act as, and this task's subject (subjectPath /document/issuer). REQUIRED for a type that names no room (rooms/blobs/chunk/0.1, rooms/blobs/upload/{commit,abort}/0.2), where it is the member whose request opened the transfer; REQUIRED for the offer types (vtc/rooms/offers/list/0.1, vtc/rooms/offers/accept/0.1), where it is the DID the community addressed its offer to; REQUIRED where the caller may act as more than one member of the room; optional where it may act as exactly one. A rule over two members this schema does not express: the recipient refuses an absent issuer it needs with principalAmbiguous. Never the client's own identifier.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub issuer: ::std::option::Option<UnsignedRoomRequestIssuer>,
///The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, where the type takes one, and refuses a payload that already carries one. For vtc/rooms/offers/accept/0.1 a `keyPackage`, where present, MUST be one the recipient minted (Recipient item 10).
pub payload: ::serde_json::Map<::std::string::String, ::serde_json::Value>,
///The room's host, or for the offer types the community that made the offer: the party the completed document is for. Covered by the member's proof.
pub recipient: UnsignedRoomRequestRecipient,
#[serde(
rename = "threadId",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub thread_id: ::std::option::Option<UnsignedRoomRequestThreadId>,
///The room request's Type URI: a rooms/* request, or vtc/rooms/offers/{list,accept}. Only the types in this task's table are completed; any other is `typeNotActable`.
#[serde(rename = "type")]
pub type_: UnsignedRoomRequestType,
}
impl UnsignedRoomRequest {
pub fn builder() -> builder::UnsignedRoomRequest {
Default::default()
}
}
///The request's identifier, set by the client. The host keys duplicate-execution protection on it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The request's identifier, set by the client. The host keys duplicate-execution protection on it.",
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UnsignedRoomRequestId(::std::string::String);
impl ::std::ops::Deref for UnsignedRoomRequestId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UnsignedRoomRequestId> for ::std::string::String {
fn from(value: UnsignedRoomRequestId) -> Self {
value.0
}
}
impl ::std::str::FromStr for UnsignedRoomRequestId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 512usize {
return Err("longer than 512 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 UnsignedRoomRequestId {
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 UnsignedRoomRequestId {
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 UnsignedRoomRequestId {
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 UnsignedRoomRequestId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The member to act as, and this task's subject (subjectPath /document/issuer). REQUIRED for a type that names no room (rooms/blobs/chunk/0.1, rooms/blobs/upload/{commit,abort}/0.2), where it is the member whose request opened the transfer; REQUIRED for the offer types (vtc/rooms/offers/list/0.1, vtc/rooms/offers/accept/0.1), where it is the DID the community addressed its offer to; REQUIRED where the caller may act as more than one member of the room; optional where it may act as exactly one. A rule over two members this schema does not express: the recipient refuses an absent issuer it needs with principalAmbiguous. Never the client's own identifier.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The member to act as, and this task's subject (subjectPath /document/issuer). REQUIRED for a type that names no room (rooms/blobs/chunk/0.1, rooms/blobs/upload/{commit,abort}/0.2), where it is the member whose request opened the transfer; REQUIRED for the offer types (vtc/rooms/offers/list/0.1, vtc/rooms/offers/accept/0.1), where it is the DID the community addressed its offer to; REQUIRED where the caller may act as more than one member of the room; optional where it may act as exactly one. A rule over two members this schema does not express: the recipient refuses an absent issuer it needs with principalAmbiguous. Never the client's own identifier.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UnsignedRoomRequestIssuer(::std::string::String);
impl ::std::ops::Deref for UnsignedRoomRequestIssuer {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UnsignedRoomRequestIssuer> for ::std::string::String {
fn from(value: UnsignedRoomRequestIssuer) -> Self {
value.0
}
}
impl ::std::str::FromStr for UnsignedRoomRequestIssuer {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^did:").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^did:\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for UnsignedRoomRequestIssuer {
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 UnsignedRoomRequestIssuer {
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 UnsignedRoomRequestIssuer {
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 UnsignedRoomRequestIssuer {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The room's host, or for the offer types the community that made the offer: the party the completed document is for. Covered by the member's proof.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The room's host, or for the offer types the community that made the offer: the party the completed document is for. Covered by the member's proof.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^did:"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UnsignedRoomRequestRecipient(::std::string::String);
impl ::std::ops::Deref for UnsignedRoomRequestRecipient {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UnsignedRoomRequestRecipient> for ::std::string::String {
fn from(value: UnsignedRoomRequestRecipient) -> Self {
value.0
}
}
impl ::std::str::FromStr for UnsignedRoomRequestRecipient {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| ::regress::Regex::new("^did:").unwrap());
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^did:\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for UnsignedRoomRequestRecipient {
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 UnsignedRoomRequestRecipient {
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 UnsignedRoomRequestRecipient {
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 UnsignedRoomRequestRecipient {
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())
})
}
}
///`UnsignedRoomRequestThreadId`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "string",
/// "maxLength": 512,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UnsignedRoomRequestThreadId(::std::string::String);
impl ::std::ops::Deref for UnsignedRoomRequestThreadId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UnsignedRoomRequestThreadId> for ::std::string::String {
fn from(value: UnsignedRoomRequestThreadId) -> Self {
value.0
}
}
impl ::std::str::FromStr for UnsignedRoomRequestThreadId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 512usize {
return Err("longer than 512 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 UnsignedRoomRequestThreadId {
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 UnsignedRoomRequestThreadId {
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 UnsignedRoomRequestThreadId {
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 UnsignedRoomRequestThreadId {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
///The room request's Type URI: a rooms/* request, or vtc/rooms/offers/{list,accept}. Only the types in this task's table are completed; any other is `typeNotActable`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The room request's Type URI: a rooms/* request, or vtc/rooms/offers/{list,accept}. Only the types in this task's table are completed; any other is `typeNotActable`.",
/// "type": "string",
/// "maxLength": 2048,
/// "pattern": "^https://trusttasks\\.org/spec/(rooms|vtc/rooms/offers)/"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct UnsignedRoomRequestType(::std::string::String);
impl ::std::ops::Deref for UnsignedRoomRequestType {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<UnsignedRoomRequestType> for ::std::string::String {
fn from(value: UnsignedRoomRequestType) -> Self {
value.0
}
}
impl ::std::str::FromStr for UnsignedRoomRequestType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 2048usize {
return Err("longer than 2048 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^https://trusttasks\\.org/spec/(rooms|vtc/rooms/offers)/")
.unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^https://trusttasks\\.org/spec/(rooms|vtc/rooms/offers)/\""
.into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for UnsignedRoomRequestType {
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 UnsignedRoomRequestType {
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 UnsignedRoomRequestType {
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 UnsignedRoomRequestType {
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: ::serde::Deserializer<'de>,
{
::std::string::String::deserialize(deserializer)?
.parse()
.map_err(|e: self::error::ConversionError| {
<D::Error as ::serde::de::Error>::custom(e.to_string())
})
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Payload {
document: ::std::result::Result<super::UnsignedRoomRequest, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
document: Err("no value supplied for document".to_string()),
ext: Ok(Default::default()),
}
}
}
impl Payload {
pub fn document<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::UnsignedRoomRequest>,
T::Error: ::std::fmt::Display,
{
self.document = value
.try_into()
.map_err(|e| format!("error converting supplied value for document: {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
}
}
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 {
document: value.document?,
ext: value.ext?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
document: Ok(value.document),
ext: Ok(value.ext),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
document: ::std::result::Result<super::ResponseDocument, ::std::string::String>,
expires_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
principal: ::std::result::Result<super::ResponsePrincipal, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
document: Err("no value supplied for document".to_string()),
expires_at: Ok(Default::default()),
ext: Ok(Default::default()),
principal: Err("no value supplied for principal".to_string()),
}
}
}
impl Response {
pub fn document<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseDocument>,
T::Error: ::std::fmt::Display,
{
self.document = value
.try_into()
.map_err(|e| format!("error converting supplied value for document: {e}"));
self
}
pub fn expires_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.expires_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for expires_at: {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 principal<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponsePrincipal>,
T::Error: ::std::fmt::Display,
{
self.principal = value
.try_into()
.map_err(|e| format!("error converting supplied value for principal: {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 {
document: value.document?,
expires_at: value.expires_at?,
ext: value.ext?,
principal: value.principal?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
document: Ok(value.document),
expires_at: Ok(value.expires_at),
ext: Ok(value.ext),
principal: Ok(value.principal),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseDocument {
id: ::std::result::Result<::serde_json::Value, ::std::string::String>,
issued_at: ::std::result::Result<::serde_json::Value, ::std::string::String>,
issuer: ::std::result::Result<::serde_json::Value, ::std::string::String>,
payload: ::std::result::Result<::serde_json::Value, ::std::string::String>,
proof: ::std::result::Result<::serde_json::Value, ::std::string::String>,
recipient: ::std::result::Result<::serde_json::Value, ::std::string::String>,
type_: ::std::result::Result<::serde_json::Value, ::std::string::String>,
}
impl ::std::default::Default for ResponseDocument {
fn default() -> Self {
Self {
id: Err("no value supplied for id".to_string()),
issued_at: Err("no value supplied for issued_at".to_string()),
issuer: Err("no value supplied for issuer".to_string()),
payload: Err("no value supplied for payload".to_string()),
proof: Err("no value supplied for proof".to_string()),
recipient: Err("no value supplied for recipient".to_string()),
type_: Err("no value supplied for type_".to_string()),
}
}
}
impl ResponseDocument {
pub fn id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {e}"));
self
}
pub fn issued_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.issued_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for issued_at: {e}"));
self
}
pub fn issuer<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.issuer = value
.try_into()
.map_err(|e| format!("error converting supplied value for issuer: {e}"));
self
}
pub fn payload<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.payload = value
.try_into()
.map_err(|e| format!("error converting supplied value for payload: {e}"));
self
}
pub fn proof<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.proof = value
.try_into()
.map_err(|e| format!("error converting supplied value for proof: {e}"));
self
}
pub fn recipient<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::serde_json::Value>,
T::Error: ::std::fmt::Display,
{
self.recipient = value
.try_into()
.map_err(|e| format!("error converting supplied value for recipient: {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<ResponseDocument> for super::ResponseDocument {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseDocument,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
id: value.id?,
issued_at: value.issued_at?,
issuer: value.issuer?,
payload: value.payload?,
proof: value.proof?,
recipient: value.recipient?,
type_: value.type_?,
})
}
}
impl ::std::convert::From<super::ResponseDocument> for ResponseDocument {
fn from(value: super::ResponseDocument) -> Self {
Self {
id: Ok(value.id),
issued_at: Ok(value.issued_at),
issuer: Ok(value.issuer),
payload: Ok(value.payload),
proof: Ok(value.proof),
recipient: Ok(value.recipient),
type_: Ok(value.type_),
}
}
}
#[derive(Clone, Debug)]
pub struct UnsignedRoomRequest {
expires_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
id: ::std::result::Result<super::UnsignedRoomRequestId, ::std::string::String>,
issued_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
issuer: ::std::result::Result<
::std::option::Option<super::UnsignedRoomRequestIssuer>,
::std::string::String,
>,
payload: ::std::result::Result<
::serde_json::Map<::std::string::String, ::serde_json::Value>,
::std::string::String,
>,
recipient:
::std::result::Result<super::UnsignedRoomRequestRecipient, ::std::string::String>,
thread_id: ::std::result::Result<
::std::option::Option<super::UnsignedRoomRequestThreadId>,
::std::string::String,
>,
type_: ::std::result::Result<super::UnsignedRoomRequestType, ::std::string::String>,
}
impl ::std::default::Default for UnsignedRoomRequest {
fn default() -> Self {
Self {
expires_at: Ok(Default::default()),
ext: Ok(Default::default()),
id: Err("no value supplied for id".to_string()),
issued_at: Err("no value supplied for issued_at".to_string()),
issuer: Ok(Default::default()),
payload: Err("no value supplied for payload".to_string()),
recipient: Err("no value supplied for recipient".to_string()),
thread_id: Ok(Default::default()),
type_: Err("no value supplied for type_".to_string()),
}
}
}
impl UnsignedRoomRequest {
pub fn expires_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
>,
T::Error: ::std::fmt::Display,
{
self.expires_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for expires_at: {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 id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::UnsignedRoomRequestId>,
T::Error: ::std::fmt::Display,
{
self.id = value
.try_into()
.map_err(|e| format!("error converting supplied value for id: {e}"));
self
}
pub fn issued_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.issued_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for issued_at: {e}"));
self
}
pub fn issuer<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::UnsignedRoomRequestIssuer>>,
T::Error: ::std::fmt::Display,
{
self.issuer = value
.try_into()
.map_err(|e| format!("error converting supplied value for issuer: {e}"));
self
}
pub fn payload<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.payload = value
.try_into()
.map_err(|e| format!("error converting supplied value for payload: {e}"));
self
}
pub fn recipient<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::UnsignedRoomRequestRecipient>,
T::Error: ::std::fmt::Display,
{
self.recipient = value
.try_into()
.map_err(|e| format!("error converting supplied value for recipient: {e}"));
self
}
pub fn thread_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::UnsignedRoomRequestThreadId>>,
T::Error: ::std::fmt::Display,
{
self.thread_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for thread_id: {e}"));
self
}
pub fn type_<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::UnsignedRoomRequestType>,
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<UnsignedRoomRequest> for super::UnsignedRoomRequest {
type Error = super::error::ConversionError;
fn try_from(
value: UnsignedRoomRequest,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
expires_at: value.expires_at?,
ext: value.ext?,
id: value.id?,
issued_at: value.issued_at?,
issuer: value.issuer?,
payload: value.payload?,
recipient: value.recipient?,
thread_id: value.thread_id?,
type_: value.type_?,
})
}
}
impl ::std::convert::From<super::UnsignedRoomRequest> for UnsignedRoomRequest {
fn from(value: super::UnsignedRoomRequest) -> Self {
Self {
expires_at: Ok(value.expires_at),
ext: Ok(value.ext),
id: Ok(value.id),
issued_at: Ok(value.issued_at),
issuer: Ok(value.issuer),
payload: Ok(value.payload),
recipient: Ok(value.recipient),
thread_id: Ok(value.thread_id),
type_: Ok(value.type_),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/rooms/keys/act/0.3";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const MAX_DOCUMENT_BYTES: Option<usize> = Some(327680usize);
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\": \"Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.3#response. The request, completed as the member, for the caller to send to its recipient unaltered.\",\n \"properties\": {\n \"document\": {\n \"description\": \"The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged.\",\n \"required\": [\n \"id\",\n \"type\",\n \"issuer\",\n \"recipient\",\n \"issuedAt\",\n \"payload\",\n \"proof\"\n ],\n \"type\": \"object\"\n },\n \"expiresAt\": {\n \"description\": \"When the inserted presentation's leaf lapses. Absent when the type takes no presentation.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"principal\": {\n \"description\": \"The member the recipient signed as: the completed document's `issuer`.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"principal\",\n \"document\"\n ],\n \"title\": \"Rooms Keys Act — response payload\",\n \"type\": \"object\"\n },\n \"UnsignedRoomRequest\": {\n \"$anchor\": \"unsigned-room-request\",\n \"additionalProperties\": false,\n \"description\": \"A Trust Task document of a type in the rooms/keys/act table, built by the member's client: no proof, and no presentation in its payload. The recipient validates the payload against the named type's own schema; this one fixes only the envelope.\",\n \"not\": {\n \"required\": [\n \"proof\"\n ]\n },\n \"properties\": {\n \"expiresAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"id\": {\n \"description\": \"The request's identifier, set by the client. The host keys duplicate-execution protection on it.\",\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"issuedAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"issuer\": {\n \"description\": \"The member to act as, and this task's subject (subjectPath /document/issuer). REQUIRED for a type that names no room (rooms/blobs/chunk/0.1, rooms/blobs/upload/{commit,abort}/0.2), where it is the member whose request opened the transfer; REQUIRED for the offer types (vtc/rooms/offers/list/0.1, vtc/rooms/offers/accept/0.1), where it is the DID the community addressed its offer to; REQUIRED where the caller may act as more than one member of the room; optional where it may act as exactly one. A rule over two members this schema does not express: the recipient refuses an absent issuer it needs with principalAmbiguous. Never the client's own identifier.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"payload\": {\n \"description\": \"The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, where the type takes one, and refuses a payload that already carries one. For vtc/rooms/offers/accept/0.1 a `keyPackage`, where present, MUST be one the recipient minted (Recipient item 10).\",\n \"type\": \"object\"\n },\n \"recipient\": {\n \"description\": \"The room's host, or for the offer types the community that made the offer: the party the completed document is for. Covered by the member's proof.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"threadId\": {\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": {\n \"description\": \"The room request's Type URI: a rooms/* request, or vtc/rooms/offers/{list,accept}. Only the types in this task's table are completed; any other is `typeNotActable`.\",\n \"maxLength\": 2048,\n \"pattern\": \"^https://trusttasks\\\\.org/spec/(rooms|vtc/rooms/offers)/\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"recipient\",\n \"issuedAt\",\n \"payload\"\n ],\n \"title\": \"Unsigned room request\",\n \"type\": \"object\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/rooms/keys/act/0.3\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"A member's own client asks the member's key holder to complete one host-bound room request — or one of the two requests by which a member takes up a community's offer of admission to a room — as the member: the member's own authority narrowed to the one action the request's type needs, the member as issuer, and the member's signature. The outer document members are owned by the framework — SPEC §6.3.\",\n \"properties\": {\n \"document\": {\n \"$ref\": \"#/$defs/UnsignedRoomRequest\",\n \"description\": \"The room request to complete, as the client will send it, minus its presentation and its proof.\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\",\n \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1.\"\n }\n },\n \"required\": [\n \"document\"\n ],\n \"title\": \"Rooms Keys Act — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/rooms/keys/act/0.3#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_ISSUED_AT_REQUIRED: bool = true;
const MAX_DOCUMENT_BYTES: Option<usize> = Some(393216usize);
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\": \"Success response to rooms/keys/act. Type https://trusttasks.org/spec/rooms/keys/act/0.3#response. The request, completed as the member, for the caller to send to its recipient unaltered.\",\n \"properties\": {\n \"document\": {\n \"description\": \"The supplied document with `issuer` set to the member, `payload.presentation` inserted where the type takes one, and the member's Data Integrity `proof` (`proofPurpose: authentication`). Every other member is unchanged.\",\n \"required\": [\n \"id\",\n \"type\",\n \"issuer\",\n \"recipient\",\n \"issuedAt\",\n \"payload\",\n \"proof\"\n ],\n \"type\": \"object\"\n },\n \"expiresAt\": {\n \"description\": \"When the inserted presentation's leaf lapses. Absent when the type takes no presentation.\",\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"principal\": {\n \"description\": \"The member the recipient signed as: the completed document's `issuer`.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"principal\",\n \"document\"\n ],\n \"title\": \"Rooms Keys Act — response payload\",\n \"type\": \"object\"\n },\n \"UnsignedRoomRequest\": {\n \"$anchor\": \"unsigned-room-request\",\n \"additionalProperties\": false,\n \"description\": \"A Trust Task document of a type in the rooms/keys/act table, built by the member's client: no proof, and no presentation in its payload. The recipient validates the payload against the named type's own schema; this one fixes only the envelope.\",\n \"not\": {\n \"required\": [\n \"proof\"\n ]\n },\n \"properties\": {\n \"expiresAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"id\": {\n \"description\": \"The request's identifier, set by the client. The host keys duplicate-execution protection on it.\",\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"issuedAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"issuer\": {\n \"description\": \"The member to act as, and this task's subject (subjectPath /document/issuer). REQUIRED for a type that names no room (rooms/blobs/chunk/0.1, rooms/blobs/upload/{commit,abort}/0.2), where it is the member whose request opened the transfer; REQUIRED for the offer types (vtc/rooms/offers/list/0.1, vtc/rooms/offers/accept/0.1), where it is the DID the community addressed its offer to; REQUIRED where the caller may act as more than one member of the room; optional where it may act as exactly one. A rule over two members this schema does not express: the recipient refuses an absent issuer it needs with principalAmbiguous. Never the client's own identifier.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"payload\": {\n \"description\": \"The request's payload, as the named type's schema defines it but without `presentation`: the recipient inserts the member's own, narrowed to the table's action, where the type takes one, and refuses a payload that already carries one. For vtc/rooms/offers/accept/0.1 a `keyPackage`, where present, MUST be one the recipient minted (Recipient item 10).\",\n \"type\": \"object\"\n },\n \"recipient\": {\n \"description\": \"The room's host, or for the offer types the community that made the offer: the party the completed document is for. Covered by the member's proof.\",\n \"maxLength\": 2048,\n \"pattern\": \"^did:\",\n \"type\": \"string\"\n },\n \"threadId\": {\n \"maxLength\": 512,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"type\": {\n \"description\": \"The room request's Type URI: a rooms/* request, or vtc/rooms/offers/{list,accept}. Only the types in this task's table are completed; any other is `typeNotActable`.\",\n \"maxLength\": 2048,\n \"pattern\": \"^https://trusttasks\\\\.org/spec/(rooms|vtc/rooms/offers)/\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"recipient\",\n \"issuedAt\",\n \"payload\"\n ],\n \"title\": \"Unsigned room request\",\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::TYPE_NOT_ACTABLE,
error_codes::NOT_A_MEMBER,
error_codes::PRINCIPAL_AMBIGUOUS,
error_codes::ISSUER_NOT_PRINCIPAL,
error_codes::ACTION_NOT_HELD,
error_codes::KEY_PACKAGE_NOT_HELD,
error_codes::SEALED_ROOM_MINT,
];
/// 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 {
/// `rooms/keys/act:typeNotActable`
///
/// The document's `type` is not in this task's table of host-bound room requests, so the recipient will not sign it as the member. `details.type` repeats it.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const TYPE_NOT_ACTABLE: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:typeNotActable",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"type\":{\"maxLength\":2048,\"type\":\"string\"}},\"required\":[\"type\"],\"type\":\"object\"}",
),
};
/// `rooms/keys/act:notAMember`
///
/// The recipient holds no credential issued by the document's room to a member its caller may act as.
///
/// Declared `retryable: false`.
pub const NOT_A_MEMBER: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:notAMember",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `rooms/keys/act:principalAmbiguous`
///
/// The document's `issuer` is absent and the recipient cannot tell which member to act as: the caller may act as more than one member of the document's room, or the document's type names no room (a download chunk, a direct upload's commit or abort), for which `issuer` is the only way to name the member. Name the member in `issuer` and ask again.
///
/// Declared `retryable: false`.
pub const PRINCIPAL_AMBIGUOUS: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:principalAmbiguous",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `rooms/keys/act:issuerNotPrincipal`
///
/// The document's `issuer` is not a member the recipient may act as for its caller: for a type that names a room, not a member of that room the caller may act as; for a type that names no room, not a member whose keys the recipient holds and the caller may act as. `details.issuer` repeats it.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const ISSUER_NOT_PRINCIPAL: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:issuerNotPrincipal",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"issuer\":{\"maxLength\":2048,\"type\":\"string\"}},\"required\":[\"issuer\"],\"type\":\"object\"}",
),
};
/// `rooms/keys/act:actionNotHeld`
///
/// The member's own credentials do not confer the action the document's type requires. `details.action` names it.
///
/// Declared `retryable: false`.
/// Declares a `detailsSchema` for the error's `details` member.
pub const ACTION_NOT_HELD: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:actionNotHeld",
retryable: false,
details_schema: ::core::option::Option::Some(
"{\"additionalProperties\":false,\"properties\":{\"action\":{\"enum\":[\"read\",\"write\",\"curate\",\"admin\"],\"type\":\"string\"}},\"required\":[\"action\"],\"type\":\"object\"}",
),
};
/// `rooms/keys/act:keyPackageNotHeld`
///
/// The document is a vtc/rooms/offers/accept carrying a `keyPackage` the recipient did not mint for this room and this member with rooms/keys/key-package, or one whose private half it no longer holds (used, or expired). Mint one with rooms/keys/key-package and build the acceptance with it (Recipient item 10).
///
/// Declared `retryable: false`.
pub const KEY_PACKAGE_NOT_HELD: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:keyPackageNotHeld",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `rooms/keys/act:sealedRoomMint`
///
/// The document is a rooms/epoch/mint for a room whose MLS group the recipient holds. A sealed room's epoch advances only with a commit of its group, which a client cannot make, and a mint without one leaves every member's key holder behind the host. Renew a sealed room with rooms/owner/group/renew, which the owner's key holder performs.
///
/// Declared `retryable: false`.
pub const SEALED_ROOM_MINT: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/keys/act:sealedRoomMint",
retryable: false,
details_schema: ::core::option::Option::None,
};
}