Struct matrix_sdk_crypto::store::BackupDecryptionKey
source · pub struct BackupDecryptionKey { /* private fields */ }
Expand description
The private part of a backup key.
The private part of the key is not used on a regular basis. Rather, it is used only when we need to recover the backup.
Typically, this private key is itself encrypted and stored in server-side secret storage (SSSS), whence it can be retrieved when it is needed for a recovery operation. Alternatively, the key can be “gossiped” between devices via “secret sharing”.
Implementations§
source§impl BackupDecryptionKey
impl BackupDecryptionKey
sourcepub fn from_bytes(key: &[u8; 32]) -> Self
pub fn from_bytes(key: &[u8; 32]) -> Self
Create a new decryption key from the given byte array.
Warning: You need to make sure that the byte array contains correct
random data, either by using a random number generator or by using an
exported version of a previously created BackupDecryptionKey
.
sourcepub fn from_base64(key: &str) -> Result<Self, DecodeError>
pub fn from_base64(key: &str) -> Result<Self, DecodeError>
Try to create a BackupDecryptionKey
from a base64 export.
sourcepub fn from_base58(value: &str) -> Result<Self, DecodeError>
pub fn from_base58(value: &str) -> Result<Self, DecodeError>
Try to create a BackupDecryptionKey
from a base58 export.
sourcepub fn to_base58(&self) -> String
pub fn to_base58(&self) -> String
Export the [
BackupDecryptionKey`] as a base58 encoded string.
sourcepub fn megolm_v1_public_key(&self) -> MegolmV1BackupKey
pub fn megolm_v1_public_key(&self) -> MegolmV1BackupKey
Extract the megolm.v1 public key from this BackupDecryptionKey
.
sourcepub fn to_backup_info(&self) -> RoomKeyBackupInfo
pub fn to_backup_info(&self) -> RoomKeyBackupInfo
Get the RoomKeyBackupInfo
for this BackupDecryptionKey
.
The RoomKeyBackupInfo
can be uploaded to the homeserver to activate
a new backup version.
sourcepub fn decrypt_v1(
&self,
ephemeral_key: &str,
mac: &str,
ciphertext: &str
) -> Result<String, DecryptionError>
pub fn decrypt_v1( &self, ephemeral_key: &str, mac: &str, ciphertext: &str ) -> Result<String, DecryptionError>
Try to decrypt the given ciphertext using this BackupDecryptionKey
.
This will use the m.megolm_backup.v1.curve25519-aes-sha2
algorithm
to decrypt the given ciphertext.
sourcepub fn decrypt_session_data(
&self,
session_data: EncryptedSessionData
) -> Result<BackedUpRoomKey, DecryptionError>
pub fn decrypt_session_data( &self, session_data: EncryptedSessionData ) -> Result<BackedUpRoomKey, DecryptionError>
Try to decrypt the given [EncryptedSessionData
] using this
BackupDecryptionKey
.
sourcepub fn backup_key_matches(&self, info: &RoomKeyBackupInfo) -> bool
pub fn backup_key_matches(&self, info: &RoomKeyBackupInfo) -> bool
Check if the given public key from the RoomKeyBackupInfo
matches to
this BackupDecryptionKey
.
Trait Implementations§
source§impl Clone for BackupDecryptionKey
impl Clone for BackupDecryptionKey
source§fn clone(&self) -> BackupDecryptionKey
fn clone(&self) -> BackupDecryptionKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BackupDecryptionKey
Available on non-tarpaulin_include
only.
impl Debug for BackupDecryptionKey
tarpaulin_include
only.