From 9d14d9ca39b46042c4196382613dd9c4bf711fcb Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 27 Jan 2025 22:57:15 +0100 Subject: Add user keys to database Next step is to generate authorized_keys files for git server based on keys. --- server/src/api_model.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'server/src/api_model.rs') diff --git a/server/src/api_model.rs b/server/src/api_model.rs index 2dc20f1..f062935 100644 --- a/server/src/api_model.rs +++ b/server/src/api_model.rs @@ -201,3 +201,38 @@ pub struct StatusResponse { )] pub error: Option<&'static str>, } + +#[derive(Debug, Deserialize, PartialEq, Serialize, ToSchema)] +pub struct UserKey { + #[schema(example = 1u64)] + pub id: u64, + #[schema(example = "ssh-rsa")] + pub kind: String, + #[schema(example = "AAAAfoobar==")] + pub data: String, + #[schema(example = "user@host 1970-01-01")] + pub comment: String, +} + +#[derive(Deserialize, Serialize, ToSchema)] +pub struct UserKeyData<'r> { + #[schema(example = "ssh-rsa")] + pub kind: &'r str, + #[schema(example = "AAAAfoobar==")] + pub data: &'r str, + #[schema(example = "user@host 1970-01-01")] + pub comment: Option<&'r str>, +} + +#[derive(Deserialize, Serialize, ToSchema)] +pub struct UserKeys { + #[schema(example = 0u32)] + pub offset: u32, + #[schema(example = 10u32)] + pub limit: u32, + #[schema(example = 2u32)] + pub total_count: u32, + #[schema(example = false)] + pub more: bool, + pub keys: Vec, +} -- cgit v1.2.3-70-g09d2