pub struct UnsignedEvent {
pub pubkey: String,
pub created_at: u64,
pub kind: u32,
pub tags: Vec<Vec<String>>,
pub content: String,
}Expand description
An event template before it has been signed: everything the id is computed over and nothing else.
Fields§
§pubkey: StringThe author’s x-only public key, 64 lowercase hex characters.
created_at: u64Unix seconds.
kind: u32The event kind; see crate::kinds.
Tags, each a non-empty list whose first element is the tag name.
content: StringThe event body.
Implementations§
Source§impl UnsignedEvent
impl UnsignedEvent
Sourcepub fn id_bytes(&self) -> [u8; 32]
pub fn id_bytes(&self) -> [u8; 32]
The NIP-01 id: SHA-256 of [0, pubkey, created_at, kind, tags, content]
serialised as compact JSON (siding/lib/relay.mjs eventId,
schema/codec/nostr.js verifyNostrEvent). serde_json and
JSON.stringify agree on this serialisation: no whitespace, the same
string escapes, integers as digits.
Sourcepub fn id(&self) -> String
pub fn id(&self) -> String
Self::id_bytes as lowercase hex.
Trait Implementations§
Source§impl Clone for UnsignedEvent
impl Clone for UnsignedEvent
Source§fn clone(&self) -> UnsignedEvent
fn clone(&self) -> UnsignedEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnsignedEvent
impl Debug for UnsignedEvent
Source§impl<'de> Deserialize<'de> for UnsignedEvent
impl<'de> Deserialize<'de> for UnsignedEvent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<UnsignedEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UnsignedEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for UnsignedEvent
Source§impl PartialEq for UnsignedEvent
impl PartialEq for UnsignedEvent
Source§impl Serialize for UnsignedEvent
impl Serialize for UnsignedEvent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for UnsignedEvent
Auto Trait Implementations§
impl Freeze for UnsignedEvent
impl RefUnwindSafe for UnsignedEvent
impl Send for UnsignedEvent
impl Sync for UnsignedEvent
impl Unpin for UnsignedEvent
impl UnsafeUnpin for UnsignedEvent
impl UnwindSafe for UnsignedEvent
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.