pub struct EncryptionKey {
pub did: Did,
pub key_type: String,
pub public_key: PublicKey,
pub public_key_multibase: String,
/* private fields */
}Expand description
X25519 encryption key for envelope key agreement.
Used to compute shared secrets via Diffie-Hellman for encrypting
and decrypting Envelope payloads.
§Examples
use ma_core::{Did, EncryptionKey};
let did = Did::new_url("k51qzi5uqu5dj9807pbuod1pplf0vxh8m4lfy3ewl9qbm2s8dsf9ugdf9gedhr", None::<String>).unwrap();
let key = EncryptionKey::generate(did).unwrap();
// Export and reimport
let bytes = key.private_key_bytes();
let did2 = Did::new_url("k51qzi5uqu5dj9807pbuod1pplf0vxh8m4lfy3ewl9qbm2s8dsf9ugdf9gedhr", None::<String>).unwrap();
let restored = EncryptionKey::from_private_key_bytes(did2, bytes).unwrap();
assert_eq!(key.public_key_multibase, restored.public_key_multibase);Fields§
§did: Did§key_type: String§public_key: PublicKey§public_key_multibase: StringImplementations§
Trait Implementations§
Source§impl Clone for EncryptionKey
impl Clone for EncryptionKey
Source§impl TryFrom<&EncryptionKey> for VerificationMethod
impl TryFrom<&EncryptionKey> for VerificationMethod
Auto Trait Implementations§
impl Forget for EncryptionKey
impl Freeze for EncryptionKey
impl Move for EncryptionKey
impl RefUnwindSafe for EncryptionKey
impl Send for EncryptionKeywhere
RawVecInner: Send,
impl Sync for EncryptionKeywhere
RawVecInner: Sync,
impl Unpin for EncryptionKey
impl UnsafeUnpin for EncryptionKey
impl UnwindSafe for EncryptionKeywhere
RawVecInner: UnwindSafe,
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