Add get_keys endpoint and changelog entry
This commit is contained in:
parent
de337ecb8c
commit
636cc503ed
@ -6,7 +6,10 @@ Improvements:
|
||||
|
||||
```
|
||||
device::get_devices::v1,
|
||||
keys::claim_keys::v1,
|
||||
keys::{
|
||||
claim_keys::v1,
|
||||
query_keys::v1,
|
||||
},
|
||||
```
|
||||
|
||||
# 0.0.3
|
||||
|
@ -1,3 +1,4 @@
|
||||
//! Endpoints for handling keys for end-to-end encryption
|
||||
|
||||
pub mod claim_keys;
|
||||
pub mod get_keys;
|
||||
|
3
ruma-federation-api/src/keys/get_keys/mod.rs
Normal file
3
ruma-federation-api/src/keys/get_keys/mod.rs
Normal file
@ -0,0 +1,3 @@
|
||||
//! Module for getting information about the current devices and identity keys for the given users
|
||||
|
||||
pub mod v1;
|
43
ruma-federation-api/src/keys/get_keys/v1.rs
Normal file
43
ruma-federation-api/src/keys/get_keys/v1.rs
Normal file
@ -0,0 +1,43 @@
|
||||
//! [POST /_matrix/federation/v1/user/keys/query](https://matrix.org/docs/spec/server_server/r0.1.4#post-matrix-federation-v1-user-keys-claim)
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ruma_api::ruma_api;
|
||||
use ruma_common::encryption::DeviceKeys;
|
||||
use ruma_identifiers::{DeviceId, UserId};
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
description: "Returns the current devices and identity keys for the given users.",
|
||||
method: POST,
|
||||
name: "get_keys",
|
||||
path: "/_matrix/federation/v1/user/keys/query",
|
||||
rate_limited: false,
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
request: {
|
||||
/// The keys to be downloaded. Gives all keys for a given user if the list of device ids is
|
||||
/// empty.
|
||||
device_keys: BTreeMap<UserId, Vec<Box<DeviceId>>>,
|
||||
}
|
||||
|
||||
response: {
|
||||
/// Keys from the queried devices.
|
||||
device_keys: BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeys>>,
|
||||
}
|
||||
}
|
||||
|
||||
impl Request {
|
||||
/// Creates a new `Request` asking for the given device keys.
|
||||
pub fn new(device_keys: BTreeMap<UserId, Vec<Box<DeviceId>>>) -> Self {
|
||||
Self { device_keys }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given device keys.
|
||||
pub fn new(device_keys: BTreeMap<UserId, BTreeMap<Box<DeviceId>, DeviceKeys>>) -> Self {
|
||||
Self { device_keys }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user