pub struct Key {
pub pub_key: PublicKey,
pub sec_key: SecretKey,
}
Expand description
The keypair, include pk, sk, address
Fields§
§pub_key: PublicKey
§sec_key: SecretKey
Implementations§
source§impl Key
impl Key
pub fn from_sec_key(sec_key: SecretKey) -> Key
pub fn default() -> Key
pub fn generate<R>(rng: &mut R) -> Key
pub fn peer_id(&self) -> PeerId
pub fn public(&self) -> PublicKey
pub fn sign(&self, msg: &[u8]) -> Signature
pub fn to_db_bytes(&self) -> Vec<u8>
pub fn from_db_bytes(bytes: &[u8]) -> Result<Key, Error>
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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