//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `persona/attribute/list`. Version: `1.0`.
#[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())
}
}
}
///One atomic fact a holder keeps about themselves. Several attributes MAY share a `type` — three phone numbers, a legal name and a preferred name — which is why `attributeId` is the identity of a fact and `type` is not. The pool is flat and unordered; ordering is a profile's concern.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Attribute",
/// "description": "One atomic fact a holder keeps about themselves. Several attributes MAY share a `type` — three phone numbers, a legal name and a preferred name — which is why `attributeId` is the identity of a fact and `type` is not. The pool is flat and unordered; ordering is a profile's concern.",
/// "type": "object",
/// "required": [
/// "attributeId",
/// "provenance",
/// "type",
/// "updatedAt",
/// "valueType",
/// "version"
/// ],
/// "properties": {
/// "attributeId": {
/// "$ref": "#/definitions/Ulid"
/// },
/// "createdAt": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "label": {
/// "description": "The holder's own words for this attribute, shown in a picker. Never disclosed to a verifier; it is a note to self.",
/// "type": "string",
/// "maxLength": 128
/// },
/// "provenance": {
/// "$ref": "#/definitions/Provenance"
/// },
/// "stale": {
/// "description": "Present and true when a `credentialBacked` value could not be re-derived. `staleReason` says why. A maintainer MUST refuse to disclose a stale attribute.",
/// "type": "boolean"
/// },
/// "staleReason": {
/// "description": "Why re-derivation failed. Present only alongside `stale`.",
/// "type": "string",
/// "enum": [
/// "revoked",
/// "expired",
/// "archived",
/// "deleted",
/// "notFound"
/// ]
/// },
/// "type": {
/// "$ref": "#/definitions/ClaimType"
/// },
/// "updatedAt": {
/// "type": "string",
/// "format": "date-time"
/// },
/// "value": {
/// "description": "\nThe fact itself, agreeing with `valueType`. Encrypted at rest by the maintainer.\n\nOPTIONAL, and its absence is meaningful in two distinct situations a consumer MUST NOT conflate: the caller asked for a metadata-only view (`list` without `includeValues`, which is the DEFAULT and the common case), or a credential-backed value could not be re-derived. `stale` tells them apart. Requiring this member would make the default listing unrepresentable — a maintainer would have to choose between disclosing every value in bulk and emitting a non-conformant response."
/// },
/// "valueType": {
/// "$ref": "#/definitions/ValueType"
/// },
/// "version": {
/// "$ref": "#/definitions/Version"
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Attribute {
#[serde(rename = "attributeId")]
pub attribute_id: Ulid,
#[serde(
rename = "createdAt",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub created_at: ::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
///The holder's own words for this attribute, shown in a picker. Never disclosed to a verifier; it is a note to self.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub label: ::std::option::Option<AttributeLabel>,
pub provenance: Provenance,
///Present and true when a `credentialBacked` value could not be re-derived. `staleReason` says why. A maintainer MUST refuse to disclose a stale attribute.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub stale: ::std::option::Option<bool>,
///Why re-derivation failed. Present only alongside `stale`.
#[serde(
rename = "staleReason",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub stale_reason: ::std::option::Option<AttributeStaleReason>,
#[serde(rename = "type")]
pub type_: ClaimType,
#[serde(rename = "updatedAt")]
pub updated_at: ::chrono::DateTime<::chrono::offset::Utc>,
/**
The fact itself, agreeing with `valueType`. Encrypted at rest by the maintainer.
OPTIONAL, and its absence is meaningful in two distinct situations a consumer MUST NOT conflate: the caller asked for a metadata-only view (`list` without `includeValues`, which is the DEFAULT and the common case), or a credential-backed value could not be re-derived. `stale` tells them apart. Requiring this member would make the default listing unrepresentable — a maintainer would have to choose between disclosing every value in bulk and emitting a non-conformant response.*/
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub value: ::std::option::Option<::serde_json::Value>,
#[serde(rename = "valueType")]
pub value_type: ValueType,
pub version: Version,
}
impl Attribute {
pub fn builder() -> builder::Attribute {
Default::default()
}
}
///The holder's own words for this attribute, shown in a picker. Never disclosed to a verifier; it is a note to self.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The holder's own words for this attribute, shown in a picker. Never disclosed to a verifier; it is a note to self.",
/// "type": "string",
/// "maxLength": 128
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct AttributeLabel(::std::string::String);
impl ::std::ops::Deref for AttributeLabel {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<AttributeLabel> for ::std::string::String {
fn from(value: AttributeLabel) -> Self {
value.0
}
}
impl ::std::str::FromStr for AttributeLabel {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for AttributeLabel {
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 AttributeLabel {
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 AttributeLabel {
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 AttributeLabel {
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())
})
}
}
///Why re-derivation failed. Present only alongside `stale`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Why re-derivation failed. Present only alongside `stale`.",
/// "type": "string",
/// "enum": [
/// "revoked",
/// "expired",
/// "archived",
/// "deleted",
/// "notFound"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum AttributeStaleReason {
#[serde(rename = "revoked")]
Revoked,
#[serde(rename = "expired")]
Expired,
#[serde(rename = "archived")]
Archived,
#[serde(rename = "deleted")]
Deleted,
#[serde(rename = "notFound")]
NotFound,
}
impl ::std::fmt::Display for AttributeStaleReason {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Revoked => f.write_str("revoked"),
Self::Expired => f.write_str("expired"),
Self::Archived => f.write_str("archived"),
Self::Deleted => f.write_str("deleted"),
Self::NotFound => f.write_str("notFound"),
}
}
}
impl ::std::str::FromStr for AttributeStaleReason {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"revoked" => Ok(Self::Revoked),
"expired" => Ok(Self::Expired),
"archived" => Ok(Self::Archived),
"deleted" => Ok(Self::Deleted),
"notFound" => Ok(Self::NotFound),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for AttributeStaleReason {
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 AttributeStaleReason {
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 AttributeStaleReason {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
The vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.
The token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.
The `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ClaimType",
/// "description": "\nThe vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.\n\nThe token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.\n\nThe `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.",
/// "type": "string",
/// "maxLength": 128,
/// "minLength": 1,
/// "pattern": "^(x:)?[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ClaimType(::std::string::String);
impl ::std::ops::Deref for ClaimType {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ClaimType> for ::std::string::String {
fn from(value: ClaimType) -> Self {
value.0
}
}
impl ::std::str::FromStr for ClaimType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
::std::sync::LazyLock::new(|| {
::regress::Regex::new("^(x:)?[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err(
"doesn't match pattern \"^(x:)?[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)*$\"".into(),
);
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ClaimType {
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 ClaimType {
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 ClaimType {
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 ClaimType {
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())
})
}
}
///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())
})
}
}
///Enumerate the holder's attribute pool, optionally narrowed to a vocabulary prefix. Cursor-paginated. Values are omitted unless asked for, so a picker can render the pool without decrypting every fact in it.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "$id": "https://trusttasks.org/spec/persona/attribute/list/1.0",
/// "title": "Payload",
/// "description": "Enumerate the holder's attribute pool, optionally narrowed to a vocabulary prefix. Cursor-paginated. Values are omitted unless asked for, so a picker can render the pool without decrypting every fact in it.",
/// "type": "object",
/// "properties": {
/// "cursor": {
/// "description": "Opaque continuation token from a prior response's `nextCursor`. A producer MUST NOT construct or parse one.",
/// "type": "string",
/// "maxLength": 4096
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "includeStale": {
/// "description": "When true (the default), credential-backed attributes whose backing could not be re-derived are returned carrying `stale` and `staleReason`. Set false to omit them. The default is true because a holder needs to SEE that a credential-backed fact has gone stale — silently dropping it would present a pool that looks smaller than it is, and the holder would not know a claim had stopped being presentable.",
/// "default": true,
/// "type": "boolean"
/// },
/// "includeValues": {
/// "description": "When false (the default), each returned attribute carries its metadata and no `value`. A pool listing is the common case and it does not need plaintext: a picker renders `type` and `label`. Defaulting to false means the expensive, sensitive path is the one a producer has to ask for.",
/// "default": false,
/// "type": "boolean"
/// },
/// "limit": {
/// "description": "Maximum attributes to return. The maintainer MAY return fewer for reasons of its own and a producer MUST NOT infer exhaustion from a short page — only an absent `nextCursor` means the end.",
/// "default": 100,
/// "type": "integer",
/// "maximum": 500.0,
/// "minimum": 1.0
/// },
/// "typePrefix": {
/// "description": "Narrows the result to attributes whose `type` begins with this string, compared over the UTF-8 encoding. Because the vocabulary is dotted most-general-segment-first, `phone` selects every phone number and `name` every name — which is the access pattern a builder actually has. The maintainer MUST NOT interpret the value further; a prefix that ends mid-segment is a byte comparison like any other.",
/// "type": "string",
/// "maxLength": 128
/// }
/// },
/// "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
///Opaque continuation token from a prior response's `nextCursor`. A producer MUST NOT construct or parse one.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub cursor: ::std::option::Option<PayloadCursor>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///When true (the default), credential-backed attributes whose backing could not be re-derived are returned carrying `stale` and `staleReason`. Set false to omit them. The default is true because a holder needs to SEE that a credential-backed fact has gone stale — silently dropping it would present a pool that looks smaller than it is, and the holder would not know a claim had stopped being presentable.
#[serde(rename = "includeStale", default = "defaults::default_bool::<true>")]
pub include_stale: bool,
///When false (the default), each returned attribute carries its metadata and no `value`. A pool listing is the common case and it does not need plaintext: a picker renders `type` and `label`. Defaulting to false means the expensive, sensitive path is the one a producer has to ask for.
#[serde(rename = "includeValues", default)]
pub include_values: bool,
///Maximum attributes to return. The maintainer MAY return fewer for reasons of its own and a producer MUST NOT infer exhaustion from a short page — only an absent `nextCursor` means the end.
#[serde(default = "defaults::default_nzu64::<::std::num::NonZeroU64, 100>")]
pub limit: ::std::num::NonZeroU64,
///Narrows the result to attributes whose `type` begins with this string, compared over the UTF-8 encoding. Because the vocabulary is dotted most-general-segment-first, `phone` selects every phone number and `name` every name — which is the access pattern a builder actually has. The maintainer MUST NOT interpret the value further; a prefix that ends mid-segment is a byte comparison like any other.
#[serde(
rename = "typePrefix",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub type_prefix: ::std::option::Option<PayloadTypePrefix>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
cursor: Default::default(),
ext: Default::default(),
include_stale: defaults::default_bool::<true>(),
include_values: Default::default(),
limit: defaults::default_nzu64::<::std::num::NonZeroU64, 100>(),
type_prefix: Default::default(),
}
}
}
impl Payload {
pub fn builder() -> builder::Payload {
Default::default()
}
}
///Opaque continuation token from a prior response's `nextCursor`. A producer MUST NOT construct or parse one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Opaque continuation token from a prior response's `nextCursor`. A producer MUST NOT construct or parse one.",
/// "type": "string",
/// "maxLength": 4096
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadCursor(::std::string::String);
impl ::std::ops::Deref for PayloadCursor {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadCursor> for ::std::string::String {
fn from(value: PayloadCursor) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadCursor {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 4096usize {
return Err("longer than 4096 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadCursor {
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 PayloadCursor {
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 PayloadCursor {
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 PayloadCursor {
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())
})
}
}
///Narrows the result to attributes whose `type` begins with this string, compared over the UTF-8 encoding. Because the vocabulary is dotted most-general-segment-first, `phone` selects every phone number and `name` every name — which is the access pattern a builder actually has. The maintainer MUST NOT interpret the value further; a prefix that ends mid-segment is a byte comparison like any other.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Narrows the result to attributes whose `type` begins with this string, compared over the UTF-8 encoding. Because the vocabulary is dotted most-general-segment-first, `phone` selects every phone number and `name` every name — which is the access pattern a builder actually has. The maintainer MUST NOT interpret the value further; a prefix that ends mid-segment is a byte comparison like any other.",
/// "type": "string",
/// "maxLength": 128
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct PayloadTypePrefix(::std::string::String);
impl ::std::ops::Deref for PayloadTypePrefix {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<PayloadTypePrefix> for ::std::string::String {
fn from(value: PayloadTypePrefix) -> Self {
value.0
}
}
impl ::std::str::FromStr for PayloadTypePrefix {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 128usize {
return Err("longer than 128 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for PayloadTypePrefix {
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 PayloadTypePrefix {
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 PayloadTypePrefix {
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 PayloadTypePrefix {
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())
})
}
}
/**
How strongly a credential-backed claim is hidden when presented, ordered most private first. `predicate` proves a statement over a claim without disclosing the claim. `derived` discloses exactly the claims needed via an unlinkable derived proof, so two presentations cannot be joined. `selectiveDisclosure` discloses exactly the claims needed but carries the issuer's signature unchanged, so two presentations ARE linkable. `whole` discloses the entire credential.
The distinction between the first two and the last two is of kind, not degree: only `predicate` and `derived` avoid handing two verifiers a join key. A maintainer MUST default to the highest rung the credential's format supports, and MUST NOT silently fall to a lower one — a request that cannot be satisfied at the rung a producer asked for is refused, because a silent privacy downgrade discloses material the holder believed was hidden.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ProofRung",
/// "description": "\nHow strongly a credential-backed claim is hidden when presented, ordered most private first. `predicate` proves a statement over a claim without disclosing the claim. `derived` discloses exactly the claims needed via an unlinkable derived proof, so two presentations cannot be joined. `selectiveDisclosure` discloses exactly the claims needed but carries the issuer's signature unchanged, so two presentations ARE linkable. `whole` discloses the entire credential.\n\nThe distinction between the first two and the last two is of kind, not degree: only `predicate` and `derived` avoid handing two verifiers a join key. A maintainer MUST default to the highest rung the credential's format supports, and MUST NOT silently fall to a lower one — a request that cannot be satisfied at the rung a producer asked for is refused, because a silent privacy downgrade discloses material the holder believed was hidden.",
/// "type": "string",
/// "enum": [
/// "predicate",
/// "derived",
/// "selectiveDisclosure",
/// "whole"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ProofRung {
#[serde(rename = "predicate")]
Predicate,
#[serde(rename = "derived")]
Derived,
#[serde(rename = "selectiveDisclosure")]
SelectiveDisclosure,
#[serde(rename = "whole")]
Whole,
}
impl ::std::fmt::Display for ProofRung {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::Predicate => f.write_str("predicate"),
Self::Derived => f.write_str("derived"),
Self::SelectiveDisclosure => f.write_str("selectiveDisclosure"),
Self::Whole => f.write_str("whole"),
}
}
}
impl ::std::str::FromStr for ProofRung {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"predicate" => Ok(Self::Predicate),
"derived" => Ok(Self::Derived),
"selectiveDisclosure" => Ok(Self::SelectiveDisclosure),
"whole" => Ok(Self::Whole),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ProofRung {
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 ProofRung {
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 ProofRung {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
/**
Where a value comes from, and the member that makes this family worth building on a trust stack rather than in an address book. It survives to the verifier, so a recipient can tell — per field — what the holder typed from what an issuer attested.
`selfAsserted` — the holder supplied it.
`credentialBacked` — the value is derived from a credential in the vault at `claimPath`. The stored value is a CACHE FOR DISPLAY; the credential is the truth. A maintainer MUST re-derive it on read and MUST fail closed (never presenting a stale value) when the credential has been revoked, has expired, or has been archived or deleted.
`generated` — the value is minted per verifier at disclosure time and recorded against that verifier, so every relying party receives a different one that routes back to the holder. This is the shape of the most widely adopted consumer privacy feature in this space; a maintainer need not operate a relay to conform, but the shape must exist, because retrofitting per-verifier values into a pool-of-values model is a migration rather than an addition.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Provenance",
/// "description": "\nWhere a value comes from, and the member that makes this family worth building on a trust stack rather than in an address book. It survives to the verifier, so a recipient can tell — per field — what the holder typed from what an issuer attested.\n\n`selfAsserted` — the holder supplied it.\n\n`credentialBacked` — the value is derived from a credential in the vault at `claimPath`. The stored value is a CACHE FOR DISPLAY; the credential is the truth. A maintainer MUST re-derive it on read and MUST fail closed (never presenting a stale value) when the credential has been revoked, has expired, or has been archived or deleted.\n\n`generated` — the value is minted per verifier at disclosure time and recorded against that verifier, so every relying party receives a different one that routes back to the holder. This is the shape of the most widely adopted consumer privacy feature in this space; a maintainer need not operate a relay to conform, but the shape must exist, because retrofitting per-verifier values into a pool-of-values model is a migration rather than an addition.",
/// "type": "object",
/// "oneOf": [
/// {
/// "required": [
/// "kind"
/// ],
/// "properties": {
/// "kind": {
/// "const": "selfAsserted"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "required": [
/// "claimPath",
/// "credentialId",
/// "kind"
/// ],
/// "properties": {
/// "claimPath": {
/// "description": "RFC 6901 JSON Pointer to the claim within the credential, e.g. `/credentialSubject/familyName`.",
/// "type": "string",
/// "pattern": "^(/[^/~]*(~[01][^/~]*)*)*$"
/// },
/// "credentialId": {
/// "description": "Vault identifier of the backing credential.",
/// "type": "string",
/// "minLength": 1
/// },
/// "issuerDid": {
/// "description": "Issuer of the backing credential. Advisory: a consumer MUST verify the credential rather than trusting this member.",
/// "type": "string",
/// "minLength": 1
/// },
/// "kind": {
/// "const": "credentialBacked"
/// },
/// "proof": {
/// "description": "The disclosure rung this claim was, or will be, presented at.",
/// "$ref": "#/definitions/ProofRung"
/// }
/// },
/// "additionalProperties": false
/// },
/// {
/// "required": [
/// "generator",
/// "kind"
/// ],
/// "properties": {
/// "generator": {
/// "description": "Names the minting scheme, e.g. `relayEmail`. Maintainer-defined.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
/// },
/// "kind": {
/// "const": "generated"
/// },
/// "perVerifier": {
/// "description": "When true (the default and the only useful setting), a distinct value is minted for each verifier.",
/// "default": true,
/// "type": "boolean"
/// }
/// },
/// "additionalProperties": false
/// }
/// ],
/// "required": [
/// "kind"
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged, deny_unknown_fields)]
#[non_exhaustive]
pub enum Provenance {
Variant0 {
kind: ::serde_json::Value,
},
Variant1 {
///RFC 6901 JSON Pointer to the claim within the credential, e.g. `/credentialSubject/familyName`.
#[serde(rename = "claimPath")]
claim_path: ProvenanceVariant1ClaimPath,
///Vault identifier of the backing credential.
#[serde(rename = "credentialId")]
credential_id: ProvenanceVariant1CredentialId,
///Issuer of the backing credential. Advisory: a consumer MUST verify the credential rather than trusting this member.
#[serde(
rename = "issuerDid",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
issuer_did: ::std::option::Option<ProvenanceVariant1IssuerDid>,
kind: ::serde_json::Value,
///The disclosure rung this claim was, or will be, presented at.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
proof: ::std::option::Option<ProofRung>,
},
Variant2 {
///Names the minting scheme, e.g. `relayEmail`. Maintainer-defined.
generator: ProvenanceVariant2Generator,
kind: ::serde_json::Value,
///When true (the default and the only useful setting), a distinct value is minted for each verifier.
#[serde(rename = "perVerifier", default = "defaults::default_bool::<true>")]
per_verifier: bool,
},
}
///RFC 6901 JSON Pointer to the claim within the credential, e.g. `/credentialSubject/familyName`.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "RFC 6901 JSON Pointer to the claim within the credential, e.g. `/credentialSubject/familyName`.",
/// "type": "string",
/// "pattern": "^(/[^/~]*(~[01][^/~]*)*)*$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ProvenanceVariant1ClaimPath(::std::string::String);
impl ::std::ops::Deref for ProvenanceVariant1ClaimPath {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ProvenanceVariant1ClaimPath> for ::std::string::String {
fn from(value: ProvenanceVariant1ClaimPath) -> Self {
value.0
}
}
impl ::std::str::FromStr for ProvenanceVariant1ClaimPath {
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("^(/[^/~]*(~[01][^/~]*)*)*$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^(/[^/~]*(~[01][^/~]*)*)*$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ProvenanceVariant1ClaimPath {
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 ProvenanceVariant1ClaimPath {
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 ProvenanceVariant1ClaimPath {
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 ProvenanceVariant1ClaimPath {
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())
})
}
}
///Vault identifier of the backing credential.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Vault identifier of the backing credential.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ProvenanceVariant1CredentialId(::std::string::String);
impl ::std::ops::Deref for ProvenanceVariant1CredentialId {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ProvenanceVariant1CredentialId> for ::std::string::String {
fn from(value: ProvenanceVariant1CredentialId) -> Self {
value.0
}
}
impl ::std::str::FromStr for ProvenanceVariant1CredentialId {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ProvenanceVariant1CredentialId {
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 ProvenanceVariant1CredentialId {
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 ProvenanceVariant1CredentialId {
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 ProvenanceVariant1CredentialId {
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())
})
}
}
///Issuer of the backing credential. Advisory: a consumer MUST verify the credential rather than trusting this member.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Issuer of the backing credential. Advisory: a consumer MUST verify the credential rather than trusting this member.",
/// "type": "string",
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ProvenanceVariant1IssuerDid(::std::string::String);
impl ::std::ops::Deref for ProvenanceVariant1IssuerDid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ProvenanceVariant1IssuerDid> for ::std::string::String {
fn from(value: ProvenanceVariant1IssuerDid) -> Self {
value.0
}
}
impl ::std::str::FromStr for ProvenanceVariant1IssuerDid {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() < 1usize {
return Err("shorter than 1 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ProvenanceVariant1IssuerDid {
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 ProvenanceVariant1IssuerDid {
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 ProvenanceVariant1IssuerDid {
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 ProvenanceVariant1IssuerDid {
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())
})
}
}
///Names the minting scheme, e.g. `relayEmail`. Maintainer-defined.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Names the minting scheme, e.g. `relayEmail`. Maintainer-defined.",
/// "type": "string",
/// "maxLength": 64,
/// "minLength": 1
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ProvenanceVariant2Generator(::std::string::String);
impl ::std::ops::Deref for ProvenanceVariant2Generator {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ProvenanceVariant2Generator> for ::std::string::String {
fn from(value: ProvenanceVariant2Generator) -> Self {
value.0
}
}
impl ::std::str::FromStr for ProvenanceVariant2Generator {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 64usize {
return Err("longer than 64 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 ProvenanceVariant2Generator {
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 ProvenanceVariant2Generator {
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 ProvenanceVariant2Generator {
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 ProvenanceVariant2Generator {
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())
})
}
}
///Success response to persona/attribute/list. Type https://trusttasks.org/spec/persona/attribute/list/1.0#response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Response",
/// "description": "Success response to persona/attribute/list. Type https://trusttasks.org/spec/persona/attribute/list/1.0#response.",
/// "type": "object",
/// "required": [
/// "attributes"
/// ],
/// "properties": {
/// "attributes": {
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/Attribute"
/// },
/// "maxItems": 500
/// },
/// "ext": {
/// "$ref": "#/definitions/Ext"
/// },
/// "nextCursor": {
/// "description": "Present when more attributes remain. Absent means the enumeration is complete — that absence is the only exhaustion signal.",
/// "type": "string",
/// "maxLength": 4096
/// }
/// },
/// "additionalProperties": false,
/// "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
pub attributes: ::std::vec::Vec<Attribute>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub ext: ::std::option::Option<Ext>,
///Present when more attributes remain. Absent means the enumeration is complete — that absence is the only exhaustion signal.
#[serde(
rename = "nextCursor",
default,
skip_serializing_if = "::std::option::Option::is_none"
)]
pub next_cursor: ::std::option::Option<ResponseNextCursor>,
}
impl Response {
pub fn builder() -> builder::Response {
Default::default()
}
}
///Present when more attributes remain. Absent means the enumeration is complete — that absence is the only exhaustion signal.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present when more attributes remain. Absent means the enumeration is complete — that absence is the only exhaustion signal.",
/// "type": "string",
/// "maxLength": 4096
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ResponseNextCursor(::std::string::String);
impl ::std::ops::Deref for ResponseNextCursor {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<ResponseNextCursor> for ::std::string::String {
fn from(value: ResponseNextCursor) -> Self {
value.0
}
}
impl ::std::str::FromStr for ResponseNextCursor {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
if value.chars().count() > 4096usize {
return Err("longer than 4096 characters".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for ResponseNextCursor {
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 ResponseNextCursor {
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 ResponseNextCursor {
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 ResponseNextCursor {
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 ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Ulid",
/// "description": "A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.",
/// "type": "string",
/// "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct Ulid(::std::string::String);
impl ::std::ops::Deref for Ulid {
type Target = ::std::string::String;
fn deref(&self) -> &::std::string::String {
&self.0
}
}
impl ::std::convert::From<Ulid> for ::std::string::String {
fn from(value: Ulid) -> Self {
value.0
}
}
impl ::std::str::FromStr for Ulid {
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("^[0-9A-HJKMNP-TV-Z]{26}$").unwrap()
});
if PATTERN.find(value).is_none() {
return Err("doesn't match pattern \"^[0-9A-HJKMNP-TV-Z]{26}$\"".into());
}
Ok(Self(value.to_string()))
}
}
impl ::std::convert::TryFrom<&str> for Ulid {
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 Ulid {
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 Ulid {
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 Ulid {
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 JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "ValueType",
/// "description": "The JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.",
/// "type": "string",
/// "enum": [
/// "string",
/// "number",
/// "boolean",
/// "date",
/// "object"
/// ]
///}
/// ```
/// </details>
#[derive(
::serde::Deserialize,
::serde::Serialize,
Clone,
Copy,
Debug,
Eq,
Hash,
Ord,
PartialEq,
PartialOrd,
)]
#[non_exhaustive]
pub enum ValueType {
#[serde(rename = "string")]
String,
#[serde(rename = "number")]
Number,
#[serde(rename = "boolean")]
Boolean,
#[serde(rename = "date")]
Date,
#[serde(rename = "object")]
Object,
}
impl ::std::fmt::Display for ValueType {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match *self {
Self::String => f.write_str("string"),
Self::Number => f.write_str("number"),
Self::Boolean => f.write_str("boolean"),
Self::Date => f.write_str("date"),
Self::Object => f.write_str("object"),
}
}
}
impl ::std::str::FromStr for ValueType {
type Err = self::error::ConversionError;
fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
match value {
"string" => Ok(Self::String),
"number" => Ok(Self::Number),
"boolean" => Ok(Self::Boolean),
"date" => Ok(Self::Date),
"object" => Ok(Self::Object),
_ => Err("invalid value".into()),
}
}
}
impl ::std::convert::TryFrom<&str> for ValueType {
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 ValueType {
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 ValueType {
type Error = self::error::ConversionError;
fn try_from(
value: ::std::string::String,
) -> ::std::result::Result<Self, self::error::ConversionError> {
value.parse()
}
}
///A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "title": "Version",
/// "description": "A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.",
/// "type": "integer",
/// "minimum": 1.0
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Version(pub ::std::num::NonZeroU64);
impl ::std::ops::Deref for Version {
type Target = ::std::num::NonZeroU64;
fn deref(&self) -> &::std::num::NonZeroU64 {
&self.0
}
}
impl ::std::convert::From<Version> for ::std::num::NonZeroU64 {
fn from(value: Version) -> Self {
value.0
}
}
impl ::std::convert::From<::std::num::NonZeroU64> for Version {
fn from(value: ::std::num::NonZeroU64) -> Self {
Self(value)
}
}
impl ::std::str::FromStr for Version {
type Err = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn from_str(value: &str) -> ::std::result::Result<Self, Self::Err> {
Ok(Self(value.parse()?))
}
}
impl ::std::convert::TryFrom<&str> for Version {
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn try_from(value: &str) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::convert::TryFrom<String> for Version {
type Error = <::std::num::NonZeroU64 as ::std::str::FromStr>::Err;
fn try_from(value: String) -> ::std::result::Result<Self, Self::Error> {
value.parse()
}
}
impl ::std::fmt::Display for Version {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}
/// Types for composing complex structures.
pub mod builder {
#[derive(Clone, Debug)]
pub struct Attribute {
attribute_id: ::std::result::Result<super::Ulid, ::std::string::String>,
created_at: ::std::result::Result<
::std::option::Option<::chrono::DateTime<::chrono::offset::Utc>>,
::std::string::String,
>,
label: ::std::result::Result<
::std::option::Option<super::AttributeLabel>,
::std::string::String,
>,
provenance: ::std::result::Result<super::Provenance, ::std::string::String>,
stale: ::std::result::Result<::std::option::Option<bool>, ::std::string::String>,
stale_reason: ::std::result::Result<
::std::option::Option<super::AttributeStaleReason>,
::std::string::String,
>,
type_: ::std::result::Result<super::ClaimType, ::std::string::String>,
updated_at:
::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
value: ::std::result::Result<
::std::option::Option<::serde_json::Value>,
::std::string::String,
>,
value_type: ::std::result::Result<super::ValueType, ::std::string::String>,
version: ::std::result::Result<super::Version, ::std::string::String>,
}
impl ::std::default::Default for Attribute {
fn default() -> Self {
Self {
attribute_id: Err("no value supplied for attribute_id".to_string()),
created_at: Ok(Default::default()),
label: Ok(Default::default()),
provenance: Err("no value supplied for provenance".to_string()),
stale: Ok(Default::default()),
stale_reason: Ok(Default::default()),
type_: Err("no value supplied for type_".to_string()),
updated_at: Err("no value supplied for updated_at".to_string()),
value: Ok(Default::default()),
value_type: Err("no value supplied for value_type".to_string()),
version: Err("no value supplied for version".to_string()),
}
}
}
impl Attribute {
pub fn attribute_id<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Ulid>,
T::Error: ::std::fmt::Display,
{
self.attribute_id = value
.try_into()
.map_err(|e| format!("error converting supplied value for attribute_id: {e}"));
self
}
pub fn created_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.created_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for created_at: {e}"));
self
}
pub fn label<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::AttributeLabel>>,
T::Error: ::std::fmt::Display,
{
self.label = value
.try_into()
.map_err(|e| format!("error converting supplied value for label: {e}"));
self
}
pub fn provenance<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Provenance>,
T::Error: ::std::fmt::Display,
{
self.provenance = value
.try_into()
.map_err(|e| format!("error converting supplied value for provenance: {e}"));
self
}
pub fn stale<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<bool>>,
T::Error: ::std::fmt::Display,
{
self.stale = value
.try_into()
.map_err(|e| format!("error converting supplied value for stale: {e}"));
self
}
pub fn stale_reason<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::AttributeStaleReason>>,
T::Error: ::std::fmt::Display,
{
self.stale_reason = value
.try_into()
.map_err(|e| format!("error converting supplied value for stale_reason: {e}"));
self
}
pub fn type_<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ClaimType>,
T::Error: ::std::fmt::Display,
{
self.type_ = value
.try_into()
.map_err(|e| format!("error converting supplied value for type_: {e}"));
self
}
pub fn updated_at<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
T::Error: ::std::fmt::Display,
{
self.updated_at = value
.try_into()
.map_err(|e| format!("error converting supplied value for updated_at: {e}"));
self
}
pub fn value<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<::serde_json::Value>>,
T::Error: ::std::fmt::Display,
{
self.value = value
.try_into()
.map_err(|e| format!("error converting supplied value for value: {e}"));
self
}
pub fn value_type<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::ValueType>,
T::Error: ::std::fmt::Display,
{
self.value_type = value
.try_into()
.map_err(|e| format!("error converting supplied value for value_type: {e}"));
self
}
pub fn version<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<super::Version>,
T::Error: ::std::fmt::Display,
{
self.version = value
.try_into()
.map_err(|e| format!("error converting supplied value for version: {e}"));
self
}
}
impl ::std::convert::TryFrom<Attribute> for super::Attribute {
type Error = super::error::ConversionError;
fn try_from(
value: Attribute,
) -> ::std::result::Result<Self, super::error::ConversionError> {
Ok(Self {
attribute_id: value.attribute_id?,
created_at: value.created_at?,
label: value.label?,
provenance: value.provenance?,
stale: value.stale?,
stale_reason: value.stale_reason?,
type_: value.type_?,
updated_at: value.updated_at?,
value: value.value?,
value_type: value.value_type?,
version: value.version?,
})
}
}
impl ::std::convert::From<super::Attribute> for Attribute {
fn from(value: super::Attribute) -> Self {
Self {
attribute_id: Ok(value.attribute_id),
created_at: Ok(value.created_at),
label: Ok(value.label),
provenance: Ok(value.provenance),
stale: Ok(value.stale),
stale_reason: Ok(value.stale_reason),
type_: Ok(value.type_),
updated_at: Ok(value.updated_at),
value: Ok(value.value),
value_type: Ok(value.value_type),
version: Ok(value.version),
}
}
}
#[derive(Clone, Debug)]
pub struct Payload {
cursor: ::std::result::Result<
::std::option::Option<super::PayloadCursor>,
::std::string::String,
>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
include_stale: ::std::result::Result<bool, ::std::string::String>,
include_values: ::std::result::Result<bool, ::std::string::String>,
limit: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
type_prefix: ::std::result::Result<
::std::option::Option<super::PayloadTypePrefix>,
::std::string::String,
>,
}
impl ::std::default::Default for Payload {
fn default() -> Self {
Self {
cursor: Ok(Default::default()),
ext: Ok(Default::default()),
include_stale: Ok(super::defaults::default_bool::<true>()),
include_values: Ok(Default::default()),
limit: Ok(super::defaults::default_nzu64::<::std::num::NonZeroU64, 100>()),
type_prefix: Ok(Default::default()),
}
}
}
impl Payload {
pub fn cursor<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadCursor>>,
T::Error: ::std::fmt::Display,
{
self.cursor = value
.try_into()
.map_err(|e| format!("error converting supplied value for cursor: {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 include_stale<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.include_stale = value
.try_into()
.map_err(|e| format!("error converting supplied value for include_stale: {e}"));
self
}
pub fn include_values<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<bool>,
T::Error: ::std::fmt::Display,
{
self.include_values = value
.try_into()
.map_err(|e| format!("error converting supplied value for include_values: {e}"));
self
}
pub fn limit<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::num::NonZeroU64>,
T::Error: ::std::fmt::Display,
{
self.limit = value
.try_into()
.map_err(|e| format!("error converting supplied value for limit: {e}"));
self
}
pub fn type_prefix<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::PayloadTypePrefix>>,
T::Error: ::std::fmt::Display,
{
self.type_prefix = value
.try_into()
.map_err(|e| format!("error converting supplied value for type_prefix: {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 {
cursor: value.cursor?,
ext: value.ext?,
include_stale: value.include_stale?,
include_values: value.include_values?,
limit: value.limit?,
type_prefix: value.type_prefix?,
})
}
}
impl ::std::convert::From<super::Payload> for Payload {
fn from(value: super::Payload) -> Self {
Self {
cursor: Ok(value.cursor),
ext: Ok(value.ext),
include_stale: Ok(value.include_stale),
include_values: Ok(value.include_values),
limit: Ok(value.limit),
type_prefix: Ok(value.type_prefix),
}
}
}
#[derive(Clone, Debug)]
pub struct Response {
attributes: ::std::result::Result<::std::vec::Vec<super::Attribute>, ::std::string::String>,
ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
next_cursor: ::std::result::Result<
::std::option::Option<super::ResponseNextCursor>,
::std::string::String,
>,
}
impl ::std::default::Default for Response {
fn default() -> Self {
Self {
attributes: Err("no value supplied for attributes".to_string()),
ext: Ok(Default::default()),
next_cursor: Ok(Default::default()),
}
}
}
impl Response {
pub fn attributes<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::vec::Vec<super::Attribute>>,
T::Error: ::std::fmt::Display,
{
self.attributes = value
.try_into()
.map_err(|e| format!("error converting supplied value for attributes: {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 next_cursor<T>(mut self, value: T) -> Self
where
T: ::std::convert::TryInto<::std::option::Option<super::ResponseNextCursor>>,
T::Error: ::std::fmt::Display,
{
self.next_cursor = value
.try_into()
.map_err(|e| format!("error converting supplied value for next_cursor: {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 {
attributes: value.attributes?,
ext: value.ext?,
next_cursor: value.next_cursor?,
})
}
}
impl ::std::convert::From<super::Response> for Response {
fn from(value: super::Response) -> Self {
Self {
attributes: Ok(value.attributes),
ext: Ok(value.ext),
next_cursor: Ok(value.next_cursor),
}
}
}
}
/// Generation of default values for serde.
pub mod defaults {
pub(super) fn default_bool<const V: bool>() -> bool {
V
}
pub(super) fn default_nzu64<T, const V: u64>() -> T
where
T: ::std::convert::TryFrom<::std::num::NonZeroU64>,
<T as ::std::convert::TryFrom<::std::num::NonZeroU64>>::Error: ::std::fmt::Debug,
{
T::try_from(::std::num::NonZeroU64::try_from(V).unwrap()).unwrap()
}
}
impl crate::Payload for Payload {
const TYPE_URI: &'static str = "https://trusttasks.org/spec/persona/attribute/list/1.0";
const IS_PROOF_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Attribute\": {\n \"additionalProperties\": false,\n \"description\": \"One atomic fact a holder keeps about themselves. Several attributes MAY share a `type` — three phone numbers, a legal name and a preferred name — which is why `attributeId` is the identity of a fact and `type` is not. The pool is flat and unordered; ordering is a profile's concern.\",\n \"properties\": {\n \"attributeId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"createdAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"label\": {\n \"description\": \"The holder's own words for this attribute, shown in a picker. Never disclosed to a verifier; it is a note to self.\",\n \"maxLength\": 128,\n \"type\": \"string\"\n },\n \"provenance\": {\n \"$ref\": \"#/$defs/Provenance\"\n },\n \"stale\": {\n \"description\": \"Present and true when a `credentialBacked` value could not be re-derived. `staleReason` says why. A maintainer MUST refuse to disclose a stale attribute.\",\n \"type\": \"boolean\"\n },\n \"staleReason\": {\n \"description\": \"Why re-derivation failed. Present only alongside `stale`.\",\n \"enum\": [\n \"revoked\",\n \"expired\",\n \"archived\",\n \"deleted\",\n \"notFound\"\n ],\n \"type\": \"string\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/ClaimType\"\n },\n \"updatedAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"value\": {\n \"description\": \"The fact itself, agreeing with `valueType`. Encrypted at rest by the maintainer.\\n\\nOPTIONAL, and its absence is meaningful in two distinct situations a consumer MUST NOT conflate: the caller asked for a metadata-only view (`list` without `includeValues`, which is the DEFAULT and the common case), or a credential-backed value could not be re-derived. `stale` tells them apart. Requiring this member would make the default listing unrepresentable — a maintainer would have to choose between disclosing every value in bulk and emitting a non-conformant response.\"\n },\n \"valueType\": {\n \"$ref\": \"#/$defs/ValueType\"\n },\n \"version\": {\n \"$ref\": \"#/$defs/Version\"\n }\n },\n \"required\": [\n \"attributeId\",\n \"type\",\n \"valueType\",\n \"provenance\",\n \"version\",\n \"updatedAt\"\n ],\n \"title\": \"Attribute\",\n \"type\": \"object\"\n },\n \"ClaimType\": {\n \"description\": \"The vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.\\n\\nThe token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.\\n\\nThe `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"pattern\": \"^(x:)?[a-z][a-zA-Z0-9]*(\\\\.[a-z][a-zA-Z0-9]*)*$\",\n \"title\": \"ClaimType\",\n \"type\": \"string\"\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 \"ProofRung\": {\n \"description\": \"How strongly a credential-backed claim is hidden when presented, ordered most private first. `predicate` proves a statement over a claim without disclosing the claim. `derived` discloses exactly the claims needed via an unlinkable derived proof, so two presentations cannot be joined. `selectiveDisclosure` discloses exactly the claims needed but carries the issuer's signature unchanged, so two presentations ARE linkable. `whole` discloses the entire credential.\\n\\nThe distinction between the first two and the last two is of kind, not degree: only `predicate` and `derived` avoid handing two verifiers a join key. A maintainer MUST default to the highest rung the credential's format supports, and MUST NOT silently fall to a lower one — a request that cannot be satisfied at the rung a producer asked for is refused, because a silent privacy downgrade discloses material the holder believed was hidden.\",\n \"enum\": [\n \"predicate\",\n \"derived\",\n \"selectiveDisclosure\",\n \"whole\"\n ],\n \"title\": \"ProofRung\",\n \"type\": \"string\"\n },\n \"Provenance\": {\n \"description\": \"Where a value comes from, and the member that makes this family worth building on a trust stack rather than in an address book. It survives to the verifier, so a recipient can tell — per field — what the holder typed from what an issuer attested.\\n\\n`selfAsserted` — the holder supplied it.\\n\\n`credentialBacked` — the value is derived from a credential in the vault at `claimPath`. The stored value is a CACHE FOR DISPLAY; the credential is the truth. A maintainer MUST re-derive it on read and MUST fail closed (never presenting a stale value) when the credential has been revoked, has expired, or has been archived or deleted.\\n\\n`generated` — the value is minted per verifier at disclosure time and recorded against that verifier, so every relying party receives a different one that routes back to the holder. This is the shape of the most widely adopted consumer privacy feature in this space; a maintainer need not operate a relay to conform, but the shape must exist, because retrofitting per-verifier values into a pool-of-values model is a migration rather than an addition.\",\n \"oneOf\": [\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"kind\": {\n \"const\": \"selfAsserted\"\n }\n },\n \"required\": [\n \"kind\"\n ]\n },\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"claimPath\": {\n \"description\": \"RFC 6901 JSON Pointer to the claim within the credential, e.g. `/credentialSubject/familyName`.\",\n \"pattern\": \"^(/[^/~]*(~[01][^/~]*)*)*$\",\n \"type\": \"string\"\n },\n \"credentialId\": {\n \"description\": \"Vault identifier of the backing credential.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"issuerDid\": {\n \"description\": \"Issuer of the backing credential. Advisory: a consumer MUST verify the credential rather than trusting this member.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"kind\": {\n \"const\": \"credentialBacked\"\n },\n \"proof\": {\n \"$ref\": \"#/$defs/ProofRung\",\n \"description\": \"The disclosure rung this claim was, or will be, presented at.\"\n }\n },\n \"required\": [\n \"kind\",\n \"credentialId\",\n \"claimPath\"\n ]\n },\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"generator\": {\n \"description\": \"Names the minting scheme, e.g. `relayEmail`. Maintainer-defined.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"kind\": {\n \"const\": \"generated\"\n },\n \"perVerifier\": {\n \"default\": true,\n \"description\": \"When true (the default and the only useful setting), a distinct value is minted for each verifier.\",\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"kind\",\n \"generator\"\n ]\n }\n ],\n \"required\": [\n \"kind\"\n ],\n \"title\": \"Provenance\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response to persona/attribute/list. Type https://trusttasks.org/spec/persona/attribute/list/1.0#response.\",\n \"properties\": {\n \"attributes\": {\n \"items\": {\n \"$ref\": \"#/$defs/Attribute\"\n },\n \"maxItems\": 500,\n \"type\": \"array\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"nextCursor\": {\n \"description\": \"Present when more attributes remain. Absent means the enumeration is complete — that absence is the only exhaustion signal.\",\n \"maxLength\": 4096,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"attributes\"\n ],\n \"title\": \"Persona Attribute List — response payload\",\n \"type\": \"object\"\n },\n \"Ulid\": {\n \"description\": \"A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.\",\n \"pattern\": \"^[0-9A-HJKMNP-TV-Z]{26}$\",\n \"title\": \"Ulid\",\n \"type\": \"string\"\n },\n \"ValueType\": {\n \"description\": \"The JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"date\",\n \"object\"\n ],\n \"title\": \"ValueType\",\n \"type\": \"string\"\n },\n \"Version\": {\n \"description\": \"A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.\",\n \"minimum\": 1,\n \"title\": \"Version\",\n \"type\": \"integer\"\n }\n },\n \"$id\": \"https://trusttasks.org/spec/persona/attribute/list/1.0\",\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\": false,\n \"description\": \"Enumerate the holder's attribute pool, optionally narrowed to a vocabulary prefix. Cursor-paginated. Values are omitted unless asked for, so a picker can render the pool without decrypting every fact in it.\",\n \"properties\": {\n \"cursor\": {\n \"description\": \"Opaque continuation token from a prior response's `nextCursor`. A producer MUST NOT construct or parse one.\",\n \"maxLength\": 4096,\n \"type\": \"string\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"includeStale\": {\n \"default\": true,\n \"description\": \"When true (the default), credential-backed attributes whose backing could not be re-derived are returned carrying `stale` and `staleReason`. Set false to omit them. The default is true because a holder needs to SEE that a credential-backed fact has gone stale — silently dropping it would present a pool that looks smaller than it is, and the holder would not know a claim had stopped being presentable.\",\n \"type\": \"boolean\"\n },\n \"includeValues\": {\n \"default\": false,\n \"description\": \"When false (the default), each returned attribute carries its metadata and no `value`. A pool listing is the common case and it does not need plaintext: a picker renders `type` and `label`. Defaulting to false means the expensive, sensitive path is the one a producer has to ask for.\",\n \"type\": \"boolean\"\n },\n \"limit\": {\n \"default\": 100,\n \"description\": \"Maximum attributes to return. The maintainer MAY return fewer for reasons of its own and a producer MUST NOT infer exhaustion from a short page — only an absent `nextCursor` means the end.\",\n \"maximum\": 500,\n \"minimum\": 1,\n \"type\": \"integer\"\n },\n \"typePrefix\": {\n \"description\": \"Narrows the result to attributes whose `type` begins with this string, compared over the UTF-8 encoding. Because the vocabulary is dotted most-general-segment-first, `phone` selects every phone number and `name` every name — which is the access pattern a builder actually has. The maintainer MUST NOT interpret the value further; a prefix that ends mid-segment is a byte comparison like any other.\",\n \"maxLength\": 128,\n \"type\": \"string\"\n }\n },\n \"title\": \"Persona Attribute List — payload\",\n \"type\": \"object\"\n}\n",
);
}
impl crate::Payload for Response {
const TYPE_URI: &'static str =
"https://trusttasks.org/spec/persona/attribute/list/1.0#response";
const IS_PROOF_REQUIRED: bool = true;
const IS_RECIPIENT_REQUIRED: bool = true;
const PAYLOAD_SCHEMA: Option<&'static str> = Some(
"{\n \"$defs\": {\n \"Attribute\": {\n \"additionalProperties\": false,\n \"description\": \"One atomic fact a holder keeps about themselves. Several attributes MAY share a `type` — three phone numbers, a legal name and a preferred name — which is why `attributeId` is the identity of a fact and `type` is not. The pool is flat and unordered; ordering is a profile's concern.\",\n \"properties\": {\n \"attributeId\": {\n \"$ref\": \"#/$defs/Ulid\"\n },\n \"createdAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"label\": {\n \"description\": \"The holder's own words for this attribute, shown in a picker. Never disclosed to a verifier; it is a note to self.\",\n \"maxLength\": 128,\n \"type\": \"string\"\n },\n \"provenance\": {\n \"$ref\": \"#/$defs/Provenance\"\n },\n \"stale\": {\n \"description\": \"Present and true when a `credentialBacked` value could not be re-derived. `staleReason` says why. A maintainer MUST refuse to disclose a stale attribute.\",\n \"type\": \"boolean\"\n },\n \"staleReason\": {\n \"description\": \"Why re-derivation failed. Present only alongside `stale`.\",\n \"enum\": [\n \"revoked\",\n \"expired\",\n \"archived\",\n \"deleted\",\n \"notFound\"\n ],\n \"type\": \"string\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/ClaimType\"\n },\n \"updatedAt\": {\n \"format\": \"date-time\",\n \"type\": \"string\"\n },\n \"value\": {\n \"description\": \"The fact itself, agreeing with `valueType`. Encrypted at rest by the maintainer.\\n\\nOPTIONAL, and its absence is meaningful in two distinct situations a consumer MUST NOT conflate: the caller asked for a metadata-only view (`list` without `includeValues`, which is the DEFAULT and the common case), or a credential-backed value could not be re-derived. `stale` tells them apart. Requiring this member would make the default listing unrepresentable — a maintainer would have to choose between disclosing every value in bulk and emitting a non-conformant response.\"\n },\n \"valueType\": {\n \"$ref\": \"#/$defs/ValueType\"\n },\n \"version\": {\n \"$ref\": \"#/$defs/Version\"\n }\n },\n \"required\": [\n \"attributeId\",\n \"type\",\n \"valueType\",\n \"provenance\",\n \"version\",\n \"updatedAt\"\n ],\n \"title\": \"Attribute\",\n \"type\": \"object\"\n },\n \"ClaimType\": {\n \"description\": \"The vocabulary token naming what a value IS — `name.legal`, `phone.mobile`, `address.postal`, `person.birthDate`. Dotted, most-general segment first, so that a consumer with no knowledge of the specific token can still group by its prefix.\\n\\nThe token is the maintainer's own; no external vocabulary is primary. External vocabularies (vCard/jCard, OIDC standard claims, schema.org) are mappings applied at PRESENTATION by a renderer, not at rest, so that a query written in any of them can be matched without the store having to live inside any one of them.\\n\\nThe `x:` prefix is an open extension namespace and is not decoration. The closest prior art — Windows CardSpace's self-issued card — supported exactly fifteen predefined claim types with no extensibility, and that is the specific way it failed the requirement a holder actually has. An `x:` attribute stores, composes, binds and discloses exactly like a known one; it renders generically and matches only an explicit query.\",\n \"maxLength\": 128,\n \"minLength\": 1,\n \"pattern\": \"^(x:)?[a-z][a-zA-Z0-9]*(\\\\.[a-z][a-zA-Z0-9]*)*$\",\n \"title\": \"ClaimType\",\n \"type\": \"string\"\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 \"ProofRung\": {\n \"description\": \"How strongly a credential-backed claim is hidden when presented, ordered most private first. `predicate` proves a statement over a claim without disclosing the claim. `derived` discloses exactly the claims needed via an unlinkable derived proof, so two presentations cannot be joined. `selectiveDisclosure` discloses exactly the claims needed but carries the issuer's signature unchanged, so two presentations ARE linkable. `whole` discloses the entire credential.\\n\\nThe distinction between the first two and the last two is of kind, not degree: only `predicate` and `derived` avoid handing two verifiers a join key. A maintainer MUST default to the highest rung the credential's format supports, and MUST NOT silently fall to a lower one — a request that cannot be satisfied at the rung a producer asked for is refused, because a silent privacy downgrade discloses material the holder believed was hidden.\",\n \"enum\": [\n \"predicate\",\n \"derived\",\n \"selectiveDisclosure\",\n \"whole\"\n ],\n \"title\": \"ProofRung\",\n \"type\": \"string\"\n },\n \"Provenance\": {\n \"description\": \"Where a value comes from, and the member that makes this family worth building on a trust stack rather than in an address book. It survives to the verifier, so a recipient can tell — per field — what the holder typed from what an issuer attested.\\n\\n`selfAsserted` — the holder supplied it.\\n\\n`credentialBacked` — the value is derived from a credential in the vault at `claimPath`. The stored value is a CACHE FOR DISPLAY; the credential is the truth. A maintainer MUST re-derive it on read and MUST fail closed (never presenting a stale value) when the credential has been revoked, has expired, or has been archived or deleted.\\n\\n`generated` — the value is minted per verifier at disclosure time and recorded against that verifier, so every relying party receives a different one that routes back to the holder. This is the shape of the most widely adopted consumer privacy feature in this space; a maintainer need not operate a relay to conform, but the shape must exist, because retrofitting per-verifier values into a pool-of-values model is a migration rather than an addition.\",\n \"oneOf\": [\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"kind\": {\n \"const\": \"selfAsserted\"\n }\n },\n \"required\": [\n \"kind\"\n ]\n },\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"claimPath\": {\n \"description\": \"RFC 6901 JSON Pointer to the claim within the credential, e.g. `/credentialSubject/familyName`.\",\n \"pattern\": \"^(/[^/~]*(~[01][^/~]*)*)*$\",\n \"type\": \"string\"\n },\n \"credentialId\": {\n \"description\": \"Vault identifier of the backing credential.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"issuerDid\": {\n \"description\": \"Issuer of the backing credential. Advisory: a consumer MUST verify the credential rather than trusting this member.\",\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"kind\": {\n \"const\": \"credentialBacked\"\n },\n \"proof\": {\n \"$ref\": \"#/$defs/ProofRung\",\n \"description\": \"The disclosure rung this claim was, or will be, presented at.\"\n }\n },\n \"required\": [\n \"kind\",\n \"credentialId\",\n \"claimPath\"\n ]\n },\n {\n \"additionalProperties\": false,\n \"properties\": {\n \"generator\": {\n \"description\": \"Names the minting scheme, e.g. `relayEmail`. Maintainer-defined.\",\n \"maxLength\": 64,\n \"minLength\": 1,\n \"type\": \"string\"\n },\n \"kind\": {\n \"const\": \"generated\"\n },\n \"perVerifier\": {\n \"default\": true,\n \"description\": \"When true (the default and the only useful setting), a distinct value is minted for each verifier.\",\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"kind\",\n \"generator\"\n ]\n }\n ],\n \"required\": [\n \"kind\"\n ],\n \"title\": \"Provenance\",\n \"type\": \"object\"\n },\n \"Response\": {\n \"$anchor\": \"response\",\n \"additionalProperties\": false,\n \"description\": \"Success response to persona/attribute/list. Type https://trusttasks.org/spec/persona/attribute/list/1.0#response.\",\n \"properties\": {\n \"attributes\": {\n \"items\": {\n \"$ref\": \"#/$defs/Attribute\"\n },\n \"maxItems\": 500,\n \"type\": \"array\"\n },\n \"ext\": {\n \"$ref\": \"#/$defs/Ext\"\n },\n \"nextCursor\": {\n \"description\": \"Present when more attributes remain. Absent means the enumeration is complete — that absence is the only exhaustion signal.\",\n \"maxLength\": 4096,\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"attributes\"\n ],\n \"title\": \"Persona Attribute List — response payload\",\n \"type\": \"object\"\n },\n \"Ulid\": {\n \"description\": \"A ULID in Crockford base32, uppercase. Used for `attributeId` and `profileId`. Chosen over a UUID because the leading 48 bits are a timestamp, so a key-ordered scan of the store is also creation-ordered and a `list` needs no secondary sort. Server-assigned on create; a producer MAY supply one to make a create idempotent, and a maintainer MUST reject a supplied value that already exists rather than silently overwriting.\",\n \"pattern\": \"^[0-9A-HJKMNP-TV-Z]{26}$\",\n \"title\": \"Ulid\",\n \"type\": \"string\"\n },\n \"ValueType\": {\n \"description\": \"The JSON shape of `value`, declared so that a consumer can render and compare without guessing. The maintainer validates that `value` agrees with this member and does nothing further: it does NOT validate a phone number against a phone-number grammar. That is a producer's affordance, and a store that grows opinions about the contents of its records eventually blocks its consumer's release.\",\n \"enum\": [\n \"string\",\n \"number\",\n \"boolean\",\n \"date\",\n \"object\"\n ],\n \"title\": \"ValueType\",\n \"type\": \"string\"\n },\n \"Version\": {\n \"description\": \"A value of the store's monotonic write counter. Server-assigned; a producer never chooses one.\",\n \"minimum\": 1,\n \"title\": \"Version\",\n \"type\": \"integer\"\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;
}