mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-11 21:01:04 +01:00
Merge branch 'nhekobug' into 'next'
fix: nheko e2ee verification bug See merge request famedly/conduit!503
This commit is contained in:
commit
706148f941
3 changed files with 14 additions and 14 deletions
|
@ -151,18 +151,6 @@ pub async fn upload_signatures_route(
|
||||||
let key = serde_json::to_value(key)
|
let key = serde_json::to_value(key)
|
||||||
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid key JSON"))?;
|
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid key JSON"))?;
|
||||||
|
|
||||||
let is_signed_key = match key.get("usage") {
|
|
||||||
Some(usage) => usage
|
|
||||||
.as_array()
|
|
||||||
.map(|usage| !usage.contains(&json!("master")))
|
|
||||||
.unwrap_or(false),
|
|
||||||
None => true,
|
|
||||||
};
|
|
||||||
|
|
||||||
if !is_signed_key {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for signature in key
|
for signature in key
|
||||||
.get("signatures")
|
.get("signatures")
|
||||||
.ok_or(Error::BadRequest(
|
.ok_or(Error::BadRequest(
|
||||||
|
|
|
@ -592,7 +592,6 @@ impl service::users::Data for KeyValueDatabase {
|
||||||
&serde_json::to_vec(&cross_signing_key).expect("CrossSigningKey::to_vec always works"),
|
&serde_json::to_vec(&cross_signing_key).expect("CrossSigningKey::to_vec always works"),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// TODO: Should we notify about this change?
|
|
||||||
self.mark_device_key_update(target_id)?;
|
self.mark_device_key_update(target_id)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
mod data;
|
mod data;
|
||||||
pub use data::Data;
|
pub use data::Data;
|
||||||
|
use ruma::serde::Base64;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
|
OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
|
||||||
};
|
};
|
||||||
|
@ -316,7 +317,19 @@ impl Service {
|
||||||
&self,
|
&self,
|
||||||
origin: &ServerName,
|
origin: &ServerName,
|
||||||
) -> Result<BTreeMap<OwnedServerSigningKeyId, VerifyKey>> {
|
) -> Result<BTreeMap<OwnedServerSigningKeyId, VerifyKey>> {
|
||||||
self.db.signing_keys_for(origin)
|
let mut keys = self.db.signing_keys_for(origin)?;
|
||||||
|
if origin == self.server_name() {
|
||||||
|
keys.insert(
|
||||||
|
format!("ed25519:{}", services().globals.keypair().version())
|
||||||
|
.try_into()
|
||||||
|
.expect("found invalid server signing keys in DB"),
|
||||||
|
VerifyKey {
|
||||||
|
key: Base64::new(self.keypair.public_key().to_vec()),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(keys)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn database_version(&self) -> Result<u64> {
|
pub fn database_version(&self) -> Result<u64> {
|
||||||
|
|
Loading…
Reference in a new issue