ruma_client_api/keys/upload_signing_keys.rs
1//! `POST /_matrix/client/*/keys/device_signing/upload`
2//!
3//! Publishes cross signing keys for the user.
4
5pub mod v3 {
6 //! `/v3/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3keysdevice_signingupload
9
10 use ruma_common::{
11 api::{request, response, Metadata},
12 encryption::CrossSigningKey,
13 metadata,
14 serde::Raw,
15 };
16
17 use crate::uiaa::{AuthData, UiaaResponse};
18
19 const METADATA: Metadata = metadata! {
20 method: POST,
21 rate_limited: false,
22 authentication: AccessToken,
23 history: {
24 unstable => "/_matrix/client/unstable/keys/device_signing/upload",
25 1.1 => "/_matrix/client/v3/keys/device_signing/upload",
26 }
27 };
28
29 /// Request type for the `upload_signing_keys` endpoint.
30 #[request(error = UiaaResponse)]
31 #[derive(Default)]
32 pub struct Request {
33 /// Additional authentication information for the user-interactive authentication API.
34 #[serde(skip_serializing_if = "Option::is_none")]
35 pub auth: Option<AuthData>,
36
37 /// The user's master key.
38 #[serde(skip_serializing_if = "Option::is_none")]
39 pub master_key: Option<Raw<CrossSigningKey>>,
40
41 /// The user's self-signing key.
42 ///
43 /// Must be signed with the accompanied master, or by the user's most recently uploaded
44 /// master key if no master key is included in the request.
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub self_signing_key: Option<Raw<CrossSigningKey>>,
47
48 /// The user's user-signing key.
49 ///
50 /// Must be signed with the accompanied master, or by the user's most recently uploaded
51 /// master key if no master key is included in the request.
52 #[serde(skip_serializing_if = "Option::is_none")]
53 pub user_signing_key: Option<Raw<CrossSigningKey>>,
54 }
55
56 /// Response type for the `upload_signing_keys` endpoint.
57 #[response(error = UiaaResponse)]
58 #[derive(Default)]
59 pub struct Response {}
60
61 impl Request {
62 /// Creates an empty `Request`.
63 pub fn new() -> Self {
64 Default::default()
65 }
66 }
67
68 impl Response {
69 /// Creates an empty `Response`.
70 pub fn new() -> Self {
71 Self {}
72 }
73 }
74}