pub enum Encryption {
Nip44V2,
Nip04,
}Available on crate feature
nip44 only.Expand description
Encryption scheme negotiated for a given conversation.
Variants§
Nip44V2
NIP-44 v2 — required by spec.
Nip04
NIP-04 — deprecated; only used when the wallet’s info
event omits the encryption tag entirely or explicitly
advertises nip04.
Implementations§
Source§impl Encryption
impl Encryption
Sourcepub fn negotiate(
wallet_supported: &[Self],
client_supported: &[Self],
) -> Result<Self, NwcError>
pub fn negotiate( wallet_supported: &[Self], client_supported: &[Self], ) -> Result<Self, NwcError>
NIP-47 §“Encryption” negotiation:
- If
wallet_supportedis empty (i.e. the wallet’s info event omitted theencryptiontag), fall back to NIP-04. - Otherwise, prefer NIP-44 v2 when both sides accept it,
else use NIP-04 if both accept it, else return
NwcError::EncryptionNotNegotiable.
§Errors
See above.
Trait Implementations§
Source§impl Clone for Encryption
impl Clone for Encryption
Source§fn clone(&self) -> Encryption
fn clone(&self) -> Encryption
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 moreimpl Copy for Encryption
Source§impl Debug for Encryption
impl Debug for Encryption
Source§impl Display for Encryption
impl Display for Encryption
impl Eq for Encryption
Source§impl Hash for Encryption
impl Hash for Encryption
Source§impl PartialEq for Encryption
impl PartialEq for Encryption
impl StructuralPartialEq for Encryption
Auto Trait Implementations§
impl Freeze for Encryption
impl RefUnwindSafe for Encryption
impl Send for Encryption
impl Sync for Encryption
impl Unpin for Encryption
impl UnsafeUnpin for Encryption
impl UnwindSafe for Encryption
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
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,
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.