pub struct NostrKeys {
pub public_key: PublicKey,
/* private fields */
}Expand description
Nostr keys
Fields§
§public_key: PublicKeyPublic key
Implementations§
Source§impl Keys
impl Keys
Sourcepub fn parse<S>(secret_key: S) -> Result<Keys, Error>
pub fn parse<S>(secret_key: S) -> Result<Keys, Error>
Parse secret key from hex or bech32 and compose keys
Sourcepub fn parse_with_ctx<C, S>(
secp: &Secp256k1<C>,
secret_key: S,
) -> Result<Keys, Error>
pub fn parse_with_ctx<C, S>( secp: &Secp256k1<C>, secret_key: S, ) -> Result<Keys, Error>
Parse secret key from hex or bech32 and compose keys
Sourcepub fn generate() -> Keys
pub fn generate() -> Keys
Generate random keys
This constructor use a random number generator that retrieves randomness from the operating system (see OsRng).
Use Keys::generate_with_rng to specify a custom random source.
Check Keys::generate_with_ctx to learn more about how this constructor works internally.
Sourcepub fn generate_with_rng<R>(rng: &mut R) -> Keys
pub fn generate_with_rng<R>(rng: &mut R) -> Keys
Generate random keys using a custom random source
Check Keys::generate_with_ctx to learn more about how this constructor works internally.
Sourcepub fn generate_with_ctx<C, R>(secp: &Secp256k1<C>, rng: &mut R) -> Keys
pub fn generate_with_ctx<C, R>(secp: &Secp256k1<C>, rng: &mut R) -> Keys
Sourcepub fn generate_without_keypair_with_ctx<C, R>(
secp: &Secp256k1<C>,
rng: &mut R,
) -> Keys
👎Deprecated since 0.35.0: Use generate_with_ctx instead
pub fn generate_without_keypair_with_ctx<C, R>( secp: &Secp256k1<C>, rng: &mut R, ) -> Keys
generate_with_ctx insteadReplaced by Keys::generate_with_ctx
Sourcepub fn generate_without_keypair<R>(rng: &mut R) -> Keys
👎Deprecated since 0.35.0: Use generate or generate_with_rng instead
pub fn generate_without_keypair<R>(rng: &mut R) -> Keys
generate or generate_with_rng insteadReplaced by Keys::generate_with_rng
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Get public key
Sourcepub fn public_key_ref(&self) -> &PublicKey
👎Deprecated since 0.35.0
pub fn public_key_ref(&self) -> &PublicKey
Get public key
Sourcepub fn secret_key(&self) -> &SecretKey
pub fn secret_key(&self) -> &SecretKey
Get secret key
Sourcepub fn sign_schnorr(&self, message: &Message) -> Signature
pub fn sign_schnorr(&self, message: &Message) -> Signature
Trait Implementations§
Source§impl FromMnemonic for Keys
impl FromMnemonic for Keys
Source§fn from_mnemonic_with_ctx<C, S>(
secp: &Secp256k1<C>,
mnemonic: S,
passphrase: Option<S>,
account: Option<u32>,
type: Option<u32>,
index: Option<u32>,
) -> Result<Keys, <Keys as FromMnemonic>::Err>
fn from_mnemonic_with_ctx<C, S>( secp: &Secp256k1<C>, mnemonic: S, passphrase: Option<S>, account: Option<u32>, type: Option<u32>, index: Option<u32>, ) -> Result<Keys, <Keys as FromMnemonic>::Err>
Derive from BIP-39 mnemonics with custom account (ENGLISH wordlist). Read more
Source§fn from_mnemonic<S>(
mnemonic: S,
passphrase: Option<S>,
) -> Result<Self, Self::Err>
fn from_mnemonic<S>( mnemonic: S, passphrase: Option<S>, ) -> Result<Self, Self::Err>
Derive from BIP-39 mnemonics (ENGLISH wordlist). Read more
Source§impl Ord for Keys
impl Ord for Keys
Source§impl PartialOrd for Keys
impl PartialOrd for Keys
impl Eq for Keys
Auto Trait Implementations§
impl !Freeze for Keys
impl RefUnwindSafe for Keys
impl Send for Keys
impl Sync for Keys
impl Unpin for Keys
impl UnsafeUnpin for Keys
impl UnwindSafe for Keys
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more