Enum nostr_types::NostrBech32
source · pub enum NostrBech32 {
NAddr(NAddr),
NEvent(NEvent),
Id(Id),
Profile(Profile),
Pubkey(PublicKey),
Relay(UncheckedUrl),
CryptSec(EncryptedPrivateKey),
}
Expand description
A bech32 sequence representing a nostr object (or set of objects)
Variants§
NAddr(NAddr)
naddr - a NostrBech32 parameterized replaceable event coordinate
NEvent(NEvent)
nevent - a NostrBech32 representing an event and a set of relay URLs
Id(Id)
note - a NostrBech32 representing an event
Profile(Profile)
nprofile - a NostrBech32 representing a public key and a set of relay URLs
Pubkey(PublicKey)
npub - a NostrBech32 representing a public key
Relay(UncheckedUrl)
nrelay - a NostrBech32 representing a set of relay URLs
CryptSec(EncryptedPrivateKey)
ncryptsec - a NostrBech32 representing an encrypted private key
Implementations§
source§impl NostrBech32
impl NostrBech32
sourcepub fn new_pubkey(pubkey: PublicKey) -> NostrBech32
pub fn new_pubkey(pubkey: PublicKey) -> NostrBech32
Create from a PublicKey
sourcepub fn new_profile(profile: Profile) -> NostrBech32
pub fn new_profile(profile: Profile) -> NostrBech32
Create from a Profile
sourcepub fn new_id(id: Id) -> NostrBech32
pub fn new_id(id: Id) -> NostrBech32
Create from an Id
sourcepub fn new_nevent(ne: NEvent) -> NostrBech32
pub fn new_nevent(ne: NEvent) -> NostrBech32
Create from an NEvent
sourcepub fn new_naddr(na: NAddr) -> NostrBech32
pub fn new_naddr(na: NAddr) -> NostrBech32
Create from an NAddr
sourcepub fn new_relay(url: UncheckedUrl) -> NostrBech32
pub fn new_relay(url: UncheckedUrl) -> NostrBech32
Create from an UncheckedUrl
sourcepub fn new_cryptsec(epk: EncryptedPrivateKey) -> NostrBech32
pub fn new_cryptsec(epk: EncryptedPrivateKey) -> NostrBech32
Create from an EncryptedPrivateKey
sourcepub fn try_from_string(s: &str) -> Option<NostrBech32>
pub fn try_from_string(s: &str) -> Option<NostrBech32>
Try to convert a string into a NostrBech32. Must not have leading or trailing junk for this to work.
sourcepub fn find_all_in_string(s: &str) -> Vec<NostrBech32>
pub fn find_all_in_string(s: &str) -> Vec<NostrBech32>
Find all NostrBech32
s in a string, returned in the order found
Trait Implementations§
source§impl Clone for NostrBech32
impl Clone for NostrBech32
source§fn clone(&self) -> NostrBech32
fn clone(&self) -> NostrBech32
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more