pub struct SignedNostrEvent { /* private fields */ }Expand description
One structurally and cryptographically validated NIP-01 event.
Implementations§
Source§impl SignedNostrEvent
impl SignedNostrEvent
Sourcepub fn from_json(json: &str) -> Result<Self, SoftchatError>
pub fn from_json(json: &str) -> Result<Self, SoftchatError>
Parse, bound, and cryptographically verify one event from wire JSON.
Unknown top-level fields are ignored for forward compatibility. The seven NIP-01 fields are required and raw tag arrays are retained exactly.
§Errors
Returns a stable structural, resource, event-ID, or signature failure.
Sourcepub fn new(
id: NostrEventId,
public_key: NostrPublicKey,
created_at: u64,
kind: NostrEventKind,
tags: Vec<NostrTag>,
content: String,
signature: NostrEventSignature,
) -> Result<Self, SoftchatError>
pub fn new( id: NostrEventId, public_key: NostrPublicKey, created_at: u64, kind: NostrEventKind, tags: Vec<NostrTag>, content: String, signature: NostrEventSignature, ) -> Result<Self, SoftchatError>
Construct and verify an event from validated protocol values.
§Errors
Returns a portable timestamp, resource, event-ID, or signature failure.
Sourcepub fn to_json(&self) -> Result<String, SoftchatError>
pub fn to_json(&self) -> Result<String, SoftchatError>
Serialize the seven NIP-01 fields as compact canonical JSON.
§Errors
Returns SoftchatError::InvalidEventJson if serialization fails.
Sourcepub const fn id(&self) -> NostrEventId
pub const fn id(&self) -> NostrEventId
Return the verified event ID.
Sourcepub fn public_key(&self) -> NostrPublicKey
pub fn public_key(&self) -> NostrPublicKey
Return the verified event author’s public key.
Sourcepub const fn created_at(&self) -> u64
pub const fn created_at(&self) -> u64
Return the Unix timestamp in seconds.
Sourcepub fn kind(&self) -> NostrEventKind
pub fn kind(&self) -> NostrEventKind
Return the event kind.
Iterate over exact raw tag arrays without allocating.
Sourcepub const fn signature(&self) -> NostrEventSignature
pub const fn signature(&self) -> NostrEventSignature
Return the verified Schnorr signature.
Trait Implementations§
Source§impl Clone for SignedNostrEvent
impl Clone for SignedNostrEvent
Source§fn clone(&self) -> SignedNostrEvent
fn clone(&self) -> SignedNostrEvent
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 SignedNostrEvent
impl Debug for SignedNostrEvent
Source§impl PartialEq for SignedNostrEvent
impl PartialEq for SignedNostrEvent
Source§fn eq(&self, other: &SignedNostrEvent) -> bool
fn eq(&self, other: &SignedNostrEvent) -> bool
self and other values to be equal, and is used by ==.impl Eq for SignedNostrEvent
impl StructuralPartialEq for SignedNostrEvent
Auto Trait Implementations§
impl !Freeze for SignedNostrEvent
impl RefUnwindSafe for SignedNostrEvent
impl Send for SignedNostrEvent
impl Sync for SignedNostrEvent
impl Unpin for SignedNostrEvent
impl UnsafeUnpin for SignedNostrEvent
impl UnwindSafe for SignedNostrEvent
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