mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-19 14:19:06 -04:00
refactor(crypto): Rename our is_signed_by methods
This commit is contained in:
@@ -173,7 +173,7 @@ impl BackupMachine {
|
||||
signatures: &Signatures,
|
||||
auth_data: &str,
|
||||
) -> SignatureState {
|
||||
match self.account.is_signed_by_raw(signatures, auth_data) {
|
||||
match self.account.has_signed_raw(signatures, auth_data) {
|
||||
Ok(_) => SignatureState::ValidAndTrusted,
|
||||
Err(e) => match e {
|
||||
crate::SignatureError::NoSignatureFound => SignatureState::Missing,
|
||||
@@ -193,7 +193,7 @@ impl BackupMachine {
|
||||
let identity = self.store.get_identity(user_id).await?;
|
||||
|
||||
let ret = if let Some(identity) = identity.and_then(|i| i.own()) {
|
||||
match identity.master_key().is_signed_by_raw(signatures, auth_data) {
|
||||
match identity.master_key().has_signed_raw(signatures, auth_data) {
|
||||
Ok(_) => {
|
||||
if identity.is_verified() {
|
||||
SignatureState::ValidAndTrusted
|
||||
@@ -221,7 +221,7 @@ impl BackupMachine {
|
||||
signatures: &Signatures,
|
||||
auth_data: &str,
|
||||
) -> SignatureState {
|
||||
if device.is_signed_by_device_raw(signatures, auth_data).is_ok() {
|
||||
if device.has_signed_raw(signatures, auth_data).is_ok() {
|
||||
if device.verified() {
|
||||
SignatureState::ValidAndTrusted
|
||||
} else {
|
||||
|
||||
@@ -572,7 +572,7 @@ impl ReadOnlyDevice {
|
||||
/// correctly canonicalized and make sure that the object you are checking
|
||||
/// the signature for is allowed to be signed by a device.
|
||||
#[cfg(feature = "backups_v1")]
|
||||
pub(crate) fn is_signed_by_device_raw(
|
||||
pub(crate) fn has_signed_raw(
|
||||
&self,
|
||||
signatures: &Signatures,
|
||||
canonical_json: &str,
|
||||
@@ -584,10 +584,7 @@ impl ReadOnlyDevice {
|
||||
key.verify_canonicalized_json(user_id, key_id, signatures, canonical_json)
|
||||
}
|
||||
|
||||
fn is_signed_by_device(
|
||||
&self,
|
||||
signed_object: &impl SignedJsonObject,
|
||||
) -> Result<(), SignatureError> {
|
||||
fn has_signed(&self, signed_object: &impl SignedJsonObject) -> Result<(), SignatureError> {
|
||||
let key = self.ed25519_key().ok_or(SignatureError::MissingSigningKey)?;
|
||||
let user_id = self.user_id();
|
||||
let key_id = &DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, self.device_id());
|
||||
@@ -599,14 +596,14 @@ impl ReadOnlyDevice {
|
||||
&self,
|
||||
device_keys: &DeviceKeys,
|
||||
) -> Result<(), SignatureError> {
|
||||
self.is_signed_by_device(device_keys)
|
||||
self.has_signed(device_keys)
|
||||
}
|
||||
|
||||
pub(crate) fn verify_one_time_key(
|
||||
&self,
|
||||
one_time_key: &SignedKey,
|
||||
) -> Result<(), SignatureError> {
|
||||
self.is_signed_by_device(one_time_key)
|
||||
self.has_signed(one_time_key)
|
||||
}
|
||||
|
||||
/// Mark the device as deleted.
|
||||
|
||||
@@ -433,7 +433,7 @@ impl MasterPubkey {
|
||||
/// correctly canonicalized and make sure that the object you are checking
|
||||
/// the signature for is allowed to be signed by a master key.
|
||||
#[cfg(feature = "backups_v1")]
|
||||
pub(crate) fn is_signed_by_raw(
|
||||
pub(crate) fn has_signed_raw(
|
||||
&self,
|
||||
signatures: &Signatures,
|
||||
canonical_json: &str,
|
||||
|
||||
@@ -685,7 +685,7 @@ impl ReadOnlyAccount {
|
||||
/// correctly canonicalized and make sure that the object you are checking
|
||||
/// the signature for is allowed to be signed by our own device.
|
||||
#[cfg(feature = "backups_v1")]
|
||||
pub fn is_signed_by_raw(
|
||||
pub fn has_signed_raw(
|
||||
&self,
|
||||
signatures: &crate::types::Signatures,
|
||||
canonical_json: &str,
|
||||
|
||||
Reference in New Issue
Block a user