diff --git a/CHANGELOG.md b/CHANGELOG.md index e37b78c43..8807efcf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ ### Added +* nostr: add `TagKind::Client` variant ([Yuki Kishimoto]) * relay-builder: add `LocalRelay` and `RelayBuilder` ([Yuki Kishimoto]) * relay-builder: allow to serve local relay as hidden service ([Yuki Kishimoto]) * relay-builder: allow to set number of max connections allowed ([Yuki Kishimoto]) diff --git a/bindings/nostr-ffi/src/event/tag.rs b/bindings/nostr-ffi/src/event/tag.rs index 51794a701..9c59f75cf 100644 --- a/bindings/nostr-ffi/src/event/tag.rs +++ b/bindings/nostr-ffi/src/event/tag.rs @@ -117,6 +117,10 @@ pub enum TagKind { Encrypted, Request, Word, + /// Client + /// + /// + Client, Unknown { unknown: String, }, @@ -170,6 +174,7 @@ impl<'a> From> for TagKind { tag::TagKind::Encrypted => Self::Encrypted, tag::TagKind::Request => Self::Request, tag::TagKind::Word => Self::Word, + tag::TagKind::Client => Self::Client, tag::TagKind::Custom(unknown) => Self::Unknown { unknown: unknown.to_string(), }, @@ -223,6 +228,7 @@ impl<'a> From for tag::TagKind<'a> { TagKind::Encrypted => Self::Encrypted, TagKind::Request => Self::Request, TagKind::Word => Self::Word, + TagKind::Client => Self::Client, TagKind::Unknown { unknown } => Self::Custom(Cow::Owned(unknown)), } } diff --git a/crates/nostr/src/event/tag/kind.rs b/crates/nostr/src/event/tag/kind.rs index 3d5d087cb..01a0b42a4 100644 --- a/crates/nostr/src/event/tag/kind.rs +++ b/crates/nostr/src/event/tag/kind.rs @@ -103,6 +103,10 @@ pub enum TagKind<'a> { Request, /// Word Word, + /// Client + /// + /// + Client, /// Custom tag kind Custom(Cow<'a, str>), } @@ -166,6 +170,7 @@ impl<'a> fmt::Display for TagKind<'a> { Self::Encrypted => write!(f, "encrypted"), Self::Request => write!(f, "request"), Self::Word => write!(f, "word"), + Self::Client => write!(f, "client"), Self::Custom(tag) => write!(f, "{tag}"), } } @@ -216,6 +221,7 @@ impl<'a> From<&'a str> for TagKind<'a> { "encrypted" => Self::Encrypted, "request" => Self::Request, "word" => Self::Word, + "client" => Self::Client, k => match SingleLetterTag::from_str(k) { Ok(s) => Self::SingleLetter(s), Err(..) => Self::Custom(Cow::Borrowed(k)),