pub struct NostrRumor { /* private fields */ }Expand description
One unsigned NIP-59 rumor with a verified canonical event ID.
A rumor has the normal NIP-01 body and ID but deliberately has no signature. Authenticity is established only after its enclosing kind-13 seal is verified and its author is bound to the seal signer.
Implementations§
Source§impl NostrRumor
impl NostrRumor
Sourcepub fn new(
public_key: NostrPublicKey,
draft: NostrEventDraft,
) -> Result<Self, SoftchatError>
pub fn new( public_key: NostrPublicKey, draft: NostrEventDraft, ) -> Result<Self, SoftchatError>
Create a rumor for one explicit author and event draft.
§Errors
Returns an event-size failure if the resulting unsigned JSON exceeds the portable event bound.
Sourcepub fn from_json(json: &str) -> Result<Self, SoftchatError>
pub fn from_json(json: &str) -> Result<Self, SoftchatError>
Parse an unsigned event and verify its declared ID.
The exact six rumor fields are required. A signature or unknown top-level field is rejected instead of being silently discarded.
§Errors
Returns a stable structural, timestamp, size, or event-ID failure.
Sourcepub fn to_json(&self) -> Result<String, SoftchatError>
pub fn to_json(&self) -> Result<String, SoftchatError>
Serialize the exact unsigned event as compact JSON.
§Errors
Returns SoftchatError::InvalidEventJson if serialization fails.
Sourcepub const fn id(&self) -> NostrEventId
pub const fn id(&self) -> NostrEventId
Return the recomputed rumor ID.
Sourcepub fn public_key(&self) -> NostrPublicKey
pub fn public_key(&self) -> NostrPublicKey
Return the declared rumor author.
Sourcepub const fn created_at(&self) -> u64
pub const fn created_at(&self) -> u64
Return the canonical application timestamp.
Sourcepub fn kind(&self) -> NostrEventKind
pub fn kind(&self) -> NostrEventKind
Return the rumor kind.
Iterate over exact raw rumor tags.
Trait Implementations§
Source§impl Clone for NostrRumor
impl Clone for NostrRumor
Source§fn clone(&self) -> NostrRumor
fn clone(&self) -> NostrRumor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NostrRumor
impl Debug for NostrRumor
Source§impl PartialEq for NostrRumor
impl PartialEq for NostrRumor
Source§fn eq(&self, other: &NostrRumor) -> bool
fn eq(&self, other: &NostrRumor) -> bool
self and other values to be equal, and is used by ==.impl Eq for NostrRumor
impl StructuralPartialEq for NostrRumor
Auto Trait Implementations§
impl !Freeze for NostrRumor
impl RefUnwindSafe for NostrRumor
impl Send for NostrRumor
impl Sync for NostrRumor
impl Unpin for NostrRumor
impl UnsafeUnpin for NostrRumor
impl UnwindSafe for NostrRumor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more