pub enum KeyType {
Private,
Public,
}Expand description
Key type identifier for extended keys.
BIP32 defines two types of extended keys:
- Private extended keys (xprv/tprv) - contain private key material
- Public extended keys (xpub/tpub) - contain only public key material
§Examples
use khodpay_bip32::KeyType;
let private = KeyType::Private;
let public = KeyType::Public;
assert!(private.is_private());
assert!(public.is_public());Variants§
Private
Private extended key (xprv/tprv).
Contains private key material and can be used to:
- Derive child private keys
- Derive child public keys
- Sign transactions
Public
Public extended key (xpub/tpub).
Contains only public key material and can be used to:
- Derive child public keys (normal derivation only)
- Verify signatures
- Generate addresses for watching
Cannot:
- Derive hardened child keys
- Sign transactions
Implementations§
Source§impl KeyType
impl KeyType
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true if this is a private key type.
§Examples
use khodpay_bip32::KeyType;
assert!(KeyType::Private.is_private());
assert!(!KeyType::Public.is_private());Trait Implementations§
impl Copy for KeyType
impl Eq for KeyType
impl StructuralPartialEq for KeyType
Auto Trait Implementations§
impl Freeze for KeyType
impl RefUnwindSafe for KeyType
impl Send for KeyType
impl Sync for KeyType
impl Unpin for KeyType
impl UnwindSafe for KeyType
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