pub struct UnsignedEvent {
pub id: EventId,
pub pubkey: PublicKey,
pub created_at: Timestamp,
pub kind: Kind,
pub tags: Tags,
pub content: String,
}Expand description
An event whose id has been computed but no signature attached.
Display, serde and equality compare every field. Two unsigned events
produced from identical inputs are guaranteed to compare equal.
Fields§
§id: EventIdSHA-256 of the canonical serialization (NIP-01).
pubkey: PublicKeyAuthor’s BIP-340 x-only public key.
created_at: TimestampAuthor-supplied creation timestamp.
kind: KindEvent kind (NIP-01).
Event tags.
content: StringEvent content.
Implementations§
Source§impl UnsignedEvent
impl UnsignedEvent
Sourcepub fn new(
pubkey: PublicKey,
created_at: Timestamp,
kind: Kind,
tags: Tags,
content: impl Into<String>,
) -> Self
pub fn new( pubkey: PublicKey, created_at: Timestamp, kind: Kind, tags: Tags, content: impl Into<String>, ) -> Self
Build an UnsignedEvent by computing the EventId from pubkey
and the other fields.
Sourcepub fn compute_id(&self) -> EventId
pub fn compute_id(&self) -> EventId
Recompute the EventId from the current fields and return it.
Useful when fields were mutated through the public struct API.
Sourcepub fn sign_with_keys(self, keys: &Keys) -> Result<Event, UnsignedEventError>
pub fn sign_with_keys(self, keys: &Keys) -> Result<Event, UnsignedEventError>
Sign this event with keys.
The signer’s public key must match self.pubkey; this protects against
silently mis-signing on behalf of another author.
§Errors
Returns UnsignedEventError::SignerMismatch if the signer’s
public key does not match self.pubkey.
§Observability
When the tracing feature is enabled, a debug-level span
nula.event.sign is opened for the full signing path. keys
is skip-ped so secret material never reaches a subscriber;
only the non-secret kind / content-size / tag-count appear.
Trait Implementations§
Source§impl Clone for UnsignedEvent
impl Clone for UnsignedEvent
Source§fn clone(&self) -> UnsignedEvent
fn clone(&self) -> UnsignedEvent
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 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for UnsignedEvent
Source§impl Hash for UnsignedEvent
impl Hash for UnsignedEvent
Source§impl PartialEq for UnsignedEvent
impl PartialEq for UnsignedEvent
Source§impl Serialize for UnsignedEvent
impl Serialize for UnsignedEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
key and return true if they are equal.