//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `rooms/info`. 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())
}
}
}
///What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "AuthorityPresentation",
/// "description": "What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.",
/// "type": "object",
/// "required": [
/// "authority",
/// "membership"
/// ],
/// "properties": {
/// "authority": {
/// "description": "The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// },
/// "maxItems": 8,
/// "minItems": 1
/// },
/// "membership": {
/// "description": "The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.",
/// "type": "string"
/// },
/// "subjectBinding": {
/// "description": "REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.",
/// "type": "string"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct AuthorityPresentation {
///The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.
pub authority: ::std::vec::Vec<::std::string::String>,
///The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.
pub membership: ::std::string::String,
///REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.
#[serde(
rename = "subjectBinding",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub subject_binding: ::std::option::Option<::std::string::String>,
}
impl AuthorityPresentation {
pub fn builder() -> builder::AuthorityPresentation {
Default::default()
}
}
///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 asks a room's host what it holds about the room: its tier, its current epoch, the limits the host applies to its files, and how much of them the room and the member have used.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/rooms/info/0.1",
/// "title": "Payload",
/// "description": "A member asks a room's host what it holds about the room: its tier, its current epoch, the limits the host applies to its files, and how much of them the room and the member have used.",
/// "type": "object",
/// "required": [
/// "presentation",
/// "roomId"
/// ],
/// "properties": {
/// "ext": {
/// "description": "Ecosystem-defined extension members per SPEC.md §4.5.1.",
/// "$ref": "#/definitions/Ext"
/// },
/// "presentation": {
/// "description": "Must confer the `read` action at this room's scope.",
/// "$ref": "#/definitions/AuthorityPresentation"
/// },
/// "roomId": {
/// "description": "The room's identifier. The host verifies the presentation against credentials issued by this identifier, never against a member list of its own.",
/// "type": "string"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///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>,
///Must confer the `read` action at this room's scope.
pub presentation: AuthorityPresentation,
///The room's identifier. The host verifies the presentation against credentials issued by this identifier, never against a member list of its own.
#[serde(rename = "roomId")]
pub room_id: ::std::string::String,
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.1#response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.1#response.",
/// "type": "object",
/// "required": [
/// "epoch",
/// "limits",
/// "roomId",
/// "usage",
/// "visibility"
/// ],
/// "properties": {
/// "epoch": {
/// "description": "The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.",
/// "type": "integer",
/// "minimum": 1.0
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "limits": {
/// "description": "The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.",
/// "$ref": "#/definitions/RoomLimits"
/// },
/// "retentionPolicy": {
/// "description": "Absent means `chained`, as everywhere in this family.",
/// "$ref": "#/definitions/RetentionPolicy"
/// },
/// "roomId": {
/// "description": "The room this describes, echoed so a response cannot be mistaken for another room's.",
/// "type": "string"
/// },
/// "usage": {
/// "type": "object",
/// "required": [
/// "room"
/// ],
/// "properties": {
/// "member": {
/// "description": "The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.",
/// "type": "object",
/// "required": [
/// "limits",
/// "usage"
/// ],
/// "properties": {
/// "limits": {
/// "description": "The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.",
/// "$ref": "#/definitions/ScopeLimits"
/// },
/// "usage": {
/// "$ref": "#/definitions/Usage"
/// }
/// },
/// "additionalProperties": false
/// },
/// "room": {
/// "description": "The room as a whole.",
/// "$ref": "#/definitions/Usage"
/// }
/// },
/// "additionalProperties": false
/// },
/// "visibility": {
/// "$ref": "#/definitions/Visibility"
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
///The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.
pub epoch: ::std::num::NonZeroU64,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.
pub limits: RoomLimits,
///Absent means `chained`, as everywhere in this family.
#[serde(
rename = "retentionPolicy",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub retention_policy: ::std::option::Option<RetentionPolicy>,
///The room this describes, echoed so a response cannot be mistaken for another room's.
#[serde(rename = "roomId")]
pub room_id: ::std::string::String,
pub usage: ResponseUsage,
pub visibility: Visibility,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///`ResponseUsage`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "room"
/// ],
/// "properties": {
/// "member": {
/// "description": "The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.",
/// "type": "object",
/// "required": [
/// "limits",
/// "usage"
/// ],
/// "properties": {
/// "limits": {
/// "description": "The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.",
/// "$ref": "#/definitions/ScopeLimits"
/// },
/// "usage": {
/// "$ref": "#/definitions/Usage"
/// }
/// },
/// "additionalProperties": false
/// },
/// "room": {
/// "description": "The room as a whole.",
/// "$ref": "#/definitions/Usage"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseUsage {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub member: ::std::option::Option<ResponseUsageMember>,
///The room as a whole.
pub room: Usage,
}
impl ResponseUsage {
pub fn builder() -> builder::ResponseUsage {
Default::default()
}
}
///The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.",
/// "type": "object",
/// "required": [
/// "limits",
/// "usage"
/// ],
/// "properties": {
/// "limits": {
/// "description": "The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.",
/// "$ref": "#/definitions/ScopeLimits"
/// },
/// "usage": {
/// "$ref": "#/definitions/Usage"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseUsageMember {
///The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.
pub limits: ScopeLimits,
pub usage: Usage,
}
impl ResponseUsageMember {
pub fn builder() -> builder::ResponseUsageMember {
Default::default()
}
}
///Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "RetentionPolicy",
/// "description": "Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.",
/// "type": "string",
/// "enum": [
/// "chained",
/// "fromJoin"
/// ],
/// "$comment": "Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it."
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum RetentionPolicy {
#[serde(rename = "chained")]
Chained,
#[serde(rename = "fromJoin")]
FromJoin,
}
impl ::std::fmt::Display for RetentionPolicy {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Chained => f.write_str("chained"),
Self::FromJoin => f.write_str("fromJoin"),
}
}
}
impl ::std::str::FromStr for RetentionPolicy {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"chained" => Ok(Self::Chained),
"fromJoin" => Ok(Self::FromJoin),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for RetentionPolicy {
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 RetentionPolicy {
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 RetentionPolicy {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "RoomLimits",
/// "description": "How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.",
/// "type": "object",
/// "required": [
/// "filesEnabled"
/// ],
/// "properties": {
/// "filesEnabled": {
/// "description": "False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.",
/// "type": "boolean"
/// },
/// "member": {
/// "description": "Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.",
/// "$ref": "#/definitions/ScopeLimits"
/// },
/// "room": {
/// "description": "Limits on the room as a whole.",
/// "$ref": "#/definitions/ScopeLimits"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RoomLimits {
///False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.
#[serde(rename = "filesEnabled")]
pub files_enabled: bool,
///Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub member: ::std::option::Option<ScopeLimits>,
///Limits on the room as a whole.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub room: ::std::option::Option<ScopeLimits>,
}
impl RoomLimits {
pub fn builder() -> builder::RoomLimits {
Default::default()
}
}
///Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ScopeLimits",
/// "description": "Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.",
/// "type": "object",
/// "properties": {
/// "maxBytes": {
/// "description": "The total size of the committed and reserved blobs the scope may hold.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "maxFileBytes": {
/// "description": "The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).",
/// "type": "integer",
/// "maximum": 1073741824.0,
/// "minimum": 0.0
/// },
/// "maxFiles": {
/// "description": "The number of committed blobs the scope may hold. 0 refuses every upload at this scope.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ScopeLimits {
///The total size of the committed and reserved blobs the scope may hold.
#[serde(
rename = "maxBytes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_bytes: ::std::option::Option<u64>,
///The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).
#[serde(
rename = "maxFileBytes",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_file_bytes: ::std::option::Option<i64>,
///The number of committed blobs the scope may hold. 0 refuses every upload at this scope.
#[serde(
rename = "maxFiles",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub max_files: ::std::option::Option<u64>,
}
impl ::std::default::Default for ScopeLimits {
fn default() -> Self {
Self {
max_bytes: Default::default(),
max_file_bytes: Default::default(),
max_files: Default::default(),
}
}
}
impl ScopeLimits {
pub fn builder() -> builder::ScopeLimits {
Default::default()
}
}
///What one scope holds now. Ciphertext bytes throughout.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Usage",
/// "description": "What one scope holds now. Ciphertext bytes throughout.",
/// "type": "object",
/// "required": [
/// "bytes",
/// "files",
/// "reservedBytes"
/// ],
/// "properties": {
/// "bytes": {
/// "description": "Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "files": {
/// "description": "Committed blobs that are not orphaned.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "reservedBytes": {
/// "description": "Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.",
/// "type": "integer",
/// "minimum": 0.0
/// },
/// "reservedFiles": {
/// "description": "Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.",
/// "type": "integer",
/// "minimum": 0.0
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Usage {
///Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.
pub bytes: u64,
///Committed blobs that are not orphaned.
pub files: u64,
///Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.
#[serde(rename = "reservedBytes")]
pub reserved_bytes: u64,
///Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.
#[serde(
rename = "reservedFiles",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub reserved_files: ::std::option::Option<u64>,
}
impl Usage {
pub fn builder() -> builder::Usage {
Default::default()
}
}
///How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Visibility",
/// "description": "How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.",
/// "type": "string",
/// "enum": [
/// "open",
/// "attributed",
/// "private"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum Visibility {
#[serde(rename = "open")]
Open,
#[serde(rename = "attributed")]
Attributed,
#[serde(rename = "private")]
Private,
}
impl ::std::fmt::Display for Visibility {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Open => f.write_str("open"),
Self::Attributed => f.write_str("attributed"),
Self::Private => f.write_str("private"),
}
}
}
impl ::std::str::FromStr for Visibility {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"open" => Ok(Self::Open),
"attributed" => Ok(Self::Attributed),
"private" => Ok(Self::Private),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for Visibility {
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 Visibility {
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 Visibility {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct AuthorityPresentation {
authority:
::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>,
membership: ::std::result::Result<::std::string::String, ::std::string::String>,
subject_binding: ::std::result::Result<
::std::option::Option<::std::string::String>,
::std::string::String,
>,
}
impl ::std::default::Default for AuthorityPresentation {
fn default() -> Self {
Self {
authority: Err("no value supplied for authority".to_string()),
membership: Err("no value supplied for membership".to_string()),
subject_binding: Ok(Default::default()),
}
}
}
impl AuthorityPresentation {
pub fn authority<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.authority = value
.try_into()
.map_err(|e| format!("error converting supplied value for authority: {e}"));
self
}
pub fn membership<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.membership = value
.try_into()
.map_err(|e| format!("error converting supplied value for membership: {e}"));
self
}
pub fn subject_binding<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
T::Error: ::std::fmt::Display,
{
self.subject_binding = value
.try_into()
.map_err(|e| format!("error converting supplied value for subject_binding: {e}"));
self
}
}
impl ::std::convert::TryFrom<AuthorityPresentation> for super::AuthorityPresentation {
type Error = super::error::ConversionError;
fn try_from(
value: AuthorityPresentation,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
authority: value.authority?,
membership: value.membership?,
subject_binding: value.subject_binding?,
})
}
}
impl ::std::convert::From<super::AuthorityPresentation> for AuthorityPresentation {
fn from(value: super::AuthorityPresentation) -> Self {
Self {
authority: Ok(value.authority),
membership: Ok(value.membership),
subject_binding: Ok(value.subject_binding),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
presentation: ::std::result::Result<super::AuthorityPresentation, ::std::string::String>,
room_id: ::std::result::Result<::std::string::String, ::std::string::String>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
ext: Ok(Default::default()),
presentation: Err("no value supplied for presentation".to_string()),
room_id: Err("no value supplied for room_id".to_string()),
}
}
}
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
}
pub fn presentation<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::AuthorityPresentation>,
T::Error: ::std::fmt::Display,
{
self.presentation = value
.try_into()
.map_err(|e| format!("error converting supplied value for presentation: {e}"));
self
}
pub fn room_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.room_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for room_id: {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?,
presentation: value.presentation?,
room_id: value.room_id?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
ext: Ok(value.ext),
presentation: Ok(value.presentation),
room_id: Ok(value.room_id),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
epoch: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
limits: ::std::result::Result<super::RoomLimits, ::std::string::String>,
retention_policy: ::std::result::Result<
::std::option::Option<super::RetentionPolicy>,
::std::string::String,
>,
room_id: ::std::result::Result<::std::string::String, ::std::string::String>,
usage: ::std::result::Result<super::ResponseUsage, ::std::string::String>,
visibility: ::std::result::Result<super::Visibility, ::std::string::String>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
epoch: Err("no value supplied for epoch".to_string()),
ext: Ok(Default::default()),
limits: Err("no value supplied for limits".to_string()),
retention_policy: Ok(Default::default()),
room_id: Err("no value supplied for room_id".to_string()),
usage: Err("no value supplied for usage".to_string()),
visibility: Err("no value supplied for visibility".to_string()),
}
}
}
impl Response {
pub fn epoch<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.epoch = value
.try_into()
.map_err(|e| format!("error converting supplied value for epoch: {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 limits<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::RoomLimits>,
T::Error: ::std::fmt::Display,
{
self.limits = value
.try_into()
.map_err(|e| format!("error converting supplied value for limits: {e}"));
self
}
pub fn retention_policy<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::RetentionPolicy>>,
T::Error: ::std::fmt::Display,
{
self.retention_policy = value
.try_into()
.map_err(|e| format!("error converting supplied value for retention_policy: {e}"));
self
}
pub fn room_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::string::String>,
T::Error: ::std::fmt::Display,
{
self.room_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for room_id: {e}"));
self
}
pub fn usage<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ResponseUsage>,
T::Error: ::std::fmt::Display,
{
self.usage = value
.try_into()
.map_err(|e| format!("error converting supplied value for usage: {e}"));
self
}
pub fn visibility<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Visibility>,
T::Error: ::std::fmt::Display,
{
self.visibility = value
.try_into()
.map_err(|e| format!("error converting supplied value for visibility: {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 {
epoch: value.epoch?,
ext: value.ext?,
limits: value.limits?,
retention_policy: value.retention_policy?,
room_id: value.room_id?,
usage: value.usage?,
visibility: value.visibility?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
epoch: Ok(value.epoch),
ext: Ok(value.ext),
limits: Ok(value.limits),
retention_policy: Ok(value.retention_policy),
room_id: Ok(value.room_id),
usage: Ok(value.usage),
visibility: Ok(value.visibility),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseUsage {
member: ::std::result::Result<
::std::option::Option<super::ResponseUsageMember>,
::std::string::String,
>,
room: ::std::result::Result<super::Usage, ::std::string::String>,
}
impl ::std::default::Default for ResponseUsage {
fn default() -> Self {
Self {
member: Ok(Default::default()),
room: Err("no value supplied for room".to_string()),
}
}
}
impl ResponseUsage {
pub fn member<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseUsageMember>>,
T::Error: ::std::fmt::Display,
{
self.member = value
.try_into()
.map_err(|e| format!("error converting supplied value for member: {e}"));
self
}
pub fn room<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Usage>,
T::Error: ::std::fmt::Display,
{
self.room = value
.try_into()
.map_err(|e| format!("error converting supplied value for room: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseUsage> for super::ResponseUsage {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseUsage,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
member: value.member?,
room: value.room?,
})
}
}
impl ::std::convert::From<super::ResponseUsage> for ResponseUsage {
fn from(value: super::ResponseUsage) -> Self {
Self {
member: Ok(value.member),
room: Ok(value.room),
}
}
}
#[derive(Clone, Debug)]
pub struct ResponseUsageMember {
limits: ::std::result::Result<super::ScopeLimits, ::std::string::String>,
usage: ::std::result::Result<super::Usage, ::std::string::String>,
}
impl ::std::default::Default for ResponseUsageMember {
fn default() -> Self {
Self {
limits: Err("no value supplied for limits".to_string()),
usage: Err("no value supplied for usage".to_string()),
}
}
}
impl ResponseUsageMember {
pub fn limits<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ScopeLimits>,
T::Error: ::std::fmt::Display,
{
self.limits = value
.try_into()
.map_err(|e| format!("error converting supplied value for limits: {e}"));
self
}
pub fn usage<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Usage>,
T::Error: ::std::fmt::Display,
{
self.usage = value
.try_into()
.map_err(|e| format!("error converting supplied value for usage: {e}"));
self
}
}
impl ::std::convert::TryFrom<ResponseUsageMember> for super::ResponseUsageMember {
type Error = super::error::ConversionError;
fn try_from(
value: ResponseUsageMember,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
limits: value.limits?,
usage: value.usage?,
})
}
}
impl ::std::convert::From<super::ResponseUsageMember> for ResponseUsageMember {
fn from(value: super::ResponseUsageMember) -> Self {
Self {
limits: Ok(value.limits),
usage: Ok(value.usage),
}
}
}
#[derive(Clone, Debug)]
pub struct RoomLimits {
files_enabled: ::std::result::Result<bool, ::std::string::String>,
member:
::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
room:
::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
}
impl ::std::default::Default for RoomLimits {
fn default() -> Self {
Self {
files_enabled: Err("no value supplied for files_enabled".to_string()),
member: Ok(Default::default()),
room: Ok(Default::default()),
}
}
}
impl RoomLimits {
pub fn files_enabled<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.files_enabled = value
.try_into()
.map_err(|e| format!("error converting supplied value for files_enabled: {e}"));
self
}
pub fn member<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
T::Error: ::std::fmt::Display,
{
self.member = value
.try_into()
.map_err(|e| format!("error converting supplied value for member: {e}"));
self
}
pub fn room<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
T::Error: ::std::fmt::Display,
{
self.room = value
.try_into()
.map_err(|e| format!("error converting supplied value for room: {e}"));
self
}
}
impl ::std::convert::TryFrom<RoomLimits> for super::RoomLimits {
type Error = super::error::ConversionError;
fn try_from(
value: RoomLimits,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
files_enabled: value.files_enabled?,
member: value.member?,
room: value.room?,
})
}
}
impl ::std::convert::From<super::RoomLimits> for RoomLimits {
fn from(value: super::RoomLimits) -> Self {
Self {
files_enabled: Ok(value.files_enabled),
member: Ok(value.member),
room: Ok(value.room),
}
}
}
#[derive(Clone, Debug)]
pub struct ScopeLimits {
max_bytes: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
max_file_bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
max_files: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for ScopeLimits {
fn default() -> Self {
Self {
max_bytes: Ok(Default::default()),
max_file_bytes: Ok(Default::default()),
max_files: Ok(Default::default()),
}
}
}
impl ScopeLimits {
pub fn max_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.max_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for max_bytes: {e}"));
self
}
pub fn max_file_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<i64>>,
T::Error: ::std::fmt::Display,
{
self.max_file_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for max_file_bytes: {e}"));
self
}
pub fn max_files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.max_files = value
.try_into()
.map_err(|e| format!("error converting supplied value for max_files: {e}"));
self
}
}
impl ::std::convert::TryFrom<ScopeLimits> for super::ScopeLimits {
type Error = super::error::ConversionError;
fn try_from(
value: ScopeLimits,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
max_bytes: value.max_bytes?,
max_file_bytes: value.max_file_bytes?,
max_files: value.max_files?,
})
}
}
impl ::std::convert::From<super::ScopeLimits> for ScopeLimits {
fn from(value: super::ScopeLimits) -> Self {
Self {
max_bytes: Ok(value.max_bytes),
max_file_bytes: Ok(value.max_file_bytes),
max_files: Ok(value.max_files),
}
}
}
#[derive(Clone, Debug)]
pub struct Usage {
bytes: ::std::result::Result<u64, ::std::string::String>,
files: ::std::result::Result<u64, ::std::string::String>,
reserved_bytes: ::std::result::Result<u64, ::std::string::String>,
reserved_files: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
}
impl ::std::default::Default for Usage {
fn default() -> Self {
Self {
bytes: Err("no value supplied for bytes".to_string()),
files: Err("no value supplied for files".to_string()),
reserved_bytes: Err("no value supplied for reserved_bytes".to_string()),
reserved_files: Ok(Default::default()),
}
}
}
impl Usage {
pub fn bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for bytes: {e}"));
self
}
pub fn files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.files = value
.try_into()
.map_err(|e| format!("error converting supplied value for files: {e}"));
self
}
pub fn reserved_bytes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<u64>,
T::Error: ::std::fmt::Display,
{
self.reserved_bytes = value
.try_into()
.map_err(|e| format!("error converting supplied value for reserved_bytes: {e}"));
self
}
pub fn reserved_files<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<u64>>,
T::Error: ::std::fmt::Display,
{
self.reserved_files = value
.try_into()
.map_err(|e| format!("error converting supplied value for reserved_files: {e}"));
self
}
}
impl ::std::convert::TryFrom<Usage> for super::Usage {
type Error = super::error::ConversionError;
fn try_from(value: Usage) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
bytes: value.bytes?,
files: value.files?,
reserved_bytes: value.reserved_bytes?,
reserved_files: value.reserved_files?,
})
}
}
impl ::std::convert::From<super::Usage> for Usage {
fn from(value: super::Usage) -> Self {
Self {
bytes: Ok(value.bytes),
files: Ok(value.files),
reserved_bytes: Ok(value.reserved_bytes),
reserved_files: Ok(value.reserved_files),
}
}
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/rooms/info/0.1";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"AuthorityPresentation\": {\n \"additionalProperties\": false,\n \"description\": \"What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.\",\n \"properties\": {\n \"authority\": {\n \"description\": \"The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"maxItems\": 8,\n \"minItems\": 1,\n \"type\": \"array\"\n },\n \"membership\": {\n \"description\": \"The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.\",\n \"type\": \"string\"\n },\n \"subjectBinding\": {\n \"description\": \"REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"membership\",\n \"authority\"\n ],\n \"title\": \"AuthorityPresentation\",\n \"type\": \"object\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.1#response.\",\n \"properties\": {\n \"epoch\": {\n \"description\": \"The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.\",\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"limits\": {\n \"$ref\": \"#/$defs/RoomLimits\",\n \"description\": \"The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.\"\n },\n \"retentionPolicy\": {\n \"$ref\": \"#/$defs/RetentionPolicy\",\n \"description\": \"Absent means `chained`, as everywhere in this family.\"\n },\n \"roomId\": {\n \"description\": \"The room this describes, echoed so a response cannot be mistaken for another room's.\",\n \"type\": \"string\"\n },\n \"usage\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"member\": {\n \"additionalProperties\": false,\n \"description\": \"The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.\",\n \"properties\": {\n \"limits\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.\"\n },\n \"usage\": {\n \"$ref\": \"#/$defs/Usage\"\n }\n },\n \"required\": [\n \"usage\",\n \"limits\"\n ],\n \"type\": \"object\"\n },\n \"room\": {\n \"$ref\": \"#/$defs/Usage\",\n \"description\": \"The room as a whole.\"\n }\n },\n \"required\": [\n \"room\"\n ],\n \"type\": \"object\"\n },\n \"visibility\": {\n \"$ref\": \"#/$defs/Visibility\"\n }\n },\n \"required\": [\n \"roomId\",\n \"visibility\",\n \"epoch\",\n \"limits\",\n \"usage\"\n ],\n \"title\": \"Rooms Info — response payload\",\n \"type\": \"object\"\n },\n \"RetentionPolicy\": {\n \"$comment\": \"Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it.\",\n \"description\": \"Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.\",\n \"enum\": [\n \"chained\",\n \"fromJoin\"\n ],\n \"title\": \"RetentionPolicy\",\n \"type\": \"string\"\n },\n \"RoomLimits\": {\n \"additionalProperties\": false,\n \"description\": \"How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.\",\n \"properties\": {\n \"filesEnabled\": {\n \"description\": \"False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.\",\n \"type\": \"boolean\"\n },\n \"member\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.\"\n },\n \"room\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"Limits on the room as a whole.\"\n }\n },\n \"required\": [\n \"filesEnabled\"\n ],\n \"title\": \"RoomLimits\",\n \"type\": \"object\"\n },\n \"ScopeLimits\": {\n \"additionalProperties\": false,\n \"description\": \"Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.\",\n \"properties\": {\n \"maxBytes\": {\n \"description\": \"The total size of the committed and reserved blobs the scope may hold.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFileBytes\": {\n \"description\": \"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\n \"maximum\": 1073741824,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFiles\": {\n \"description\": \"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"title\": \"ScopeLimits\",\n \"type\": \"object\"\n },\n \"Usage\": {\n \"additionalProperties\": false,\n \"description\": \"What one scope holds now. Ciphertext bytes throughout.\",\n \"properties\": {\n \"bytes\": {\n \"description\": \"Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"files\": {\n \"description\": \"Committed blobs that are not orphaned.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"reservedBytes\": {\n \"description\": \"Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"reservedFiles\": {\n \"description\": \"Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"files\",\n \"bytes\",\n \"reservedBytes\"\n ],\n \"title\": \"Usage\",\n \"type\": \"object\"\n },\n \"Visibility\": {\n \"description\": \"How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.\",\n \"enum\": [\n \"open\",\n \"attributed\",\n \"private\"\n ],\n \"title\": \"Visibility\",\n \"type\": \"string\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/rooms/info/0.1\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"A member asks a room's host what it holds about the room: its tier, its current epoch, the limits the host applies to its files, and how much of them the room and the member have used.\",\n \"properties\": {\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\",\n \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1.\"\n },\n \"presentation\": {\n \"$ref\": \"#/$defs/AuthorityPresentation\",\n \"description\": \"Must confer the `read` action at this room's scope.\"\n },\n \"roomId\": {\n \"description\": \"The room's identifier. The host verifies the presentation against credentials issued by this identifier, never against a member list of its own.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"roomId\",\n \"presentation\"\n ],\n \"title\": \"Rooms Info — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/rooms/info/0.1#response";
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"AuthorityPresentation\": {\n \"additionalProperties\": false,\n \"description\": \"What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.\",\n \"properties\": {\n \"authority\": {\n \"description\": \"The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"maxItems\": 8,\n \"minItems\": 1,\n \"type\": \"array\"\n },\n \"membership\": {\n \"description\": \"The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.\",\n \"type\": \"string\"\n },\n \"subjectBinding\": {\n \"description\": \"REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"membership\",\n \"authority\"\n ],\n \"title\": \"AuthorityPresentation\",\n \"type\": \"object\"\n },\n \"Ext\": {\n \"additionalProperties\": true,\n \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n \"minProperties\": 1,\n \"propertyNames\": {\n \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n },\n \"title\": \"Ext\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.1#response.\",\n \"properties\": {\n \"epoch\": {\n \"description\": \"The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.\",\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"limits\": {\n \"$ref\": \"#/$defs/RoomLimits\",\n \"description\": \"The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.\"\n },\n \"retentionPolicy\": {\n \"$ref\": \"#/$defs/RetentionPolicy\",\n \"description\": \"Absent means `chained`, as everywhere in this family.\"\n },\n \"roomId\": {\n \"description\": \"The room this describes, echoed so a response cannot be mistaken for another room's.\",\n \"type\": \"string\"\n },\n \"usage\": {\n \"additionalProperties\": false,\n \"properties\": {\n \"member\": {\n \"additionalProperties\": false,\n \"description\": \"The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.\",\n \"properties\": {\n \"limits\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.\"\n },\n \"usage\": {\n \"$ref\": \"#/$defs/Usage\"\n }\n },\n \"required\": [\n \"usage\",\n \"limits\"\n ],\n \"type\": \"object\"\n },\n \"room\": {\n \"$ref\": \"#/$defs/Usage\",\n \"description\": \"The room as a whole.\"\n }\n },\n \"required\": [\n \"room\"\n ],\n \"type\": \"object\"\n },\n \"visibility\": {\n \"$ref\": \"#/$defs/Visibility\"\n }\n },\n \"required\": [\n \"roomId\",\n \"visibility\",\n \"epoch\",\n \"limits\",\n \"usage\"\n ],\n \"title\": \"Rooms Info — response payload\",\n \"type\": \"object\"\n },\n \"RetentionPolicy\": {\n \"$comment\": \"Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it.\",\n \"description\": \"Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.\",\n \"enum\": [\n \"chained\",\n \"fromJoin\"\n ],\n \"title\": \"RetentionPolicy\",\n \"type\": \"string\"\n },\n \"RoomLimits\": {\n \"additionalProperties\": false,\n \"description\": \"How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.\",\n \"properties\": {\n \"filesEnabled\": {\n \"description\": \"False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.\",\n \"type\": \"boolean\"\n },\n \"member\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.\"\n },\n \"room\": {\n \"$ref\": \"#/$defs/ScopeLimits\",\n \"description\": \"Limits on the room as a whole.\"\n }\n },\n \"required\": [\n \"filesEnabled\"\n ],\n \"title\": \"RoomLimits\",\n \"type\": \"object\"\n },\n \"ScopeLimits\": {\n \"additionalProperties\": false,\n \"description\": \"Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.\",\n \"properties\": {\n \"maxBytes\": {\n \"description\": \"The total size of the committed and reserved blobs the scope may hold.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFileBytes\": {\n \"description\": \"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\n \"maximum\": 1073741824,\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"maxFiles\": {\n \"description\": \"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"title\": \"ScopeLimits\",\n \"type\": \"object\"\n },\n \"Usage\": {\n \"additionalProperties\": false,\n \"description\": \"What one scope holds now. Ciphertext bytes throughout.\",\n \"properties\": {\n \"bytes\": {\n \"description\": \"Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"files\": {\n \"description\": \"Committed blobs that are not orphaned.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"reservedBytes\": {\n \"description\": \"Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n },\n \"reservedFiles\": {\n \"description\": \"Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.\",\n \"minimum\": 0,\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"files\",\n \"bytes\",\n \"reservedBytes\"\n ],\n \"title\": \"Usage\",\n \"type\": \"object\"\n },\n \"Visibility\": {\n \"description\": \"How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.\",\n \"enum\": [\n \"open\",\n \"attributed\",\n \"private\"\n ],\n \"title\": \"Visibility\",\n \"type\": \"string\"\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::CHAIN_TOO_DEEP,
error_codes::SUBJECT_BINDING_MISSING,
];
/// 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/info:chainTooDeep`
///
/// The authority chain exceeds the maximum of 8 links.
///
/// Declared `retryable: false`.
pub const CHAIN_TOO_DEEP: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/info:chainTooDeep",
retryable: false,
details_schema: ::core::option::Option::None,
};
/// `rooms/info:subjectBindingMissing`
///
/// A `private` room presentation omitted the required same-subject proof.
///
/// Declared `retryable: false`.
pub const SUBJECT_BINDING_MISSING: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
code: "rooms/info:subjectBindingMissing",
retryable: false,
details_schema: ::core::option::Option::None,
};
}