From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 823731FF141 for ; Fri, 16 Jan 2026 16:34:39 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DF92F1C6D9; Fri, 16 Jan 2026 16:34:26 +0100 (CET) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Fri, 16 Jan 2026 16:33:12 +0100 Message-ID: <20260116153317.1146323-8-c.heiss@proxmox.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260116153317.1146323-1-c.heiss@proxmox.com> References: <20260116153317.1146323-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1768577584577 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.052 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH proxmox 07/11] wireguard: implement api for PublicKey X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" .. such that it can be used in API definitions. Authored-by: Stefan Hanreich Signed-off-by: Christoph Heiss --- proxmox-wireguard/Cargo.toml | 6 ++++++ proxmox-wireguard/debian/control | 19 +++++++++++++++++++ proxmox-wireguard/src/lib.rs | 17 +++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/proxmox-wireguard/Cargo.toml b/proxmox-wireguard/Cargo.toml index 5976aa90..c01a4902 100644 --- a/proxmox-wireguard/Cargo.toml +++ b/proxmox-wireguard/Cargo.toml @@ -13,9 +13,15 @@ rust-version.workspace = true ed25519-dalek = "2.1" serde = { workspace = true, features = [ "derive" ] } thiserror.workspace = true +proxmox-schema = { workspace = true, optional = true, features = ["api-types"] } proxmox-serde = { workspace = true, features = [ "ini-ser" ] } proxmox-network-types.workspace = true proxmox-sys.workspace = true +regex = { workspace = true, optional = true } [dev-dependencies] pretty_assertions.workspace = true + +[features] +default = [] +api-types = ["dep:proxmox-schema", "dep:regex"] diff --git a/proxmox-wireguard/debian/control b/proxmox-wireguard/debian/control index 4adc1ac2..f613b839 100644 --- a/proxmox-wireguard/debian/control +++ b/proxmox-wireguard/debian/control @@ -36,6 +36,8 @@ Depends: librust-serde-1+default-dev, librust-serde-1+derive-dev, librust-thiserror-2+default-dev +Suggests: + librust-proxmox-wireguard+api-types-dev (= ${binary:Version}) Provides: librust-proxmox-wireguard+default-dev (= ${binary:Version}), librust-proxmox-wireguard-0-dev (= ${binary:Version}), @@ -46,3 +48,20 @@ Provides: librust-proxmox-wireguard-0.1.0+default-dev (= ${binary:Version}) Description: WireGuard configuration support - Rust source code Source code for Debianized Rust crate "proxmox-wireguard" + +Package: librust-proxmox-wireguard+api-types-dev +Architecture: any +Multi-Arch: same +Depends: + ${misc:Depends}, + librust-proxmox-wireguard-dev (= ${binary:Version}), + librust-proxmox-schema-5+api-types-dev (>= 5.0.1-~~), + librust-proxmox-schema-5+default-dev (>= 5.0.1-~~), + librust-regex-1+default-dev (>= 1.5-~~) +Provides: + librust-proxmox-wireguard-0+api-types-dev (= ${binary:Version}), + librust-proxmox-wireguard-0.1+api-types-dev (= ${binary:Version}), + librust-proxmox-wireguard-0.1.0+api-types-dev (= ${binary:Version}) +Description: WireGuard configuration support - feature "api-types" + This metapackage enables feature "api-types" for the Rust proxmox-wireguard + crate, by pulling in any additional dependencies needed by that feature. diff --git a/proxmox-wireguard/src/lib.rs b/proxmox-wireguard/src/lib.rs index 840767d8..d4697560 100644 --- a/proxmox-wireguard/src/lib.rs +++ b/proxmox-wireguard/src/lib.rs @@ -17,6 +17,10 @@ use serde::{Deserialize, Serialize}; use std::fmt; use proxmox_network_types::{endpoint::ServiceEndpoint, ip_address::Cidr}; +#[cfg(feature = "api-types")] +use proxmox_schema::{ + api_types::ED25519_BASE64_KEY_REGEX, ApiStringFormat, ApiType, StringSchema, UpdaterType, +}; /// Possible error when handling WireGuard configurations. #[derive(thiserror::Error, Debug, PartialEq, Clone)] @@ -42,6 +46,19 @@ pub struct PublicKey( #[serde(with = "proxmox_serde::byte_array_as_base64")] [u8; ed25519_dalek::PUBLIC_KEY_LENGTH], ); +#[cfg(feature = "api-types")] +impl ApiType for PublicKey { + const API_SCHEMA: proxmox_schema::Schema = + StringSchema::new("ED25519 public key base64-encoded") + .format(&ApiStringFormat::Pattern(&ED25519_BASE64_KEY_REGEX)) + .schema(); +} + +#[cfg(feature = "api-types")] +impl UpdaterType for PublicKey { + type Updater = Option; +} + /// Private key of a WireGuard peer. #[derive(Serialize)] #[serde(transparent)] -- 2.52.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel