commit 669d53c0bfd3b49da531504dde970e582c27d2c7 Author: Wolfgang Bumiller Date: Wed Jul 7 09:04:09 2021 +0200 add pbs-api-types subcrate, move key_derivation move key_derivation to pbs-datastore pbs-api-types should only contain "basic" types which * are usually required by clients * don't depend on pbs-related code directly Signed-off-by: Wolfgang Bumiller diff --git a/pbs-api-types/Cargo.toml b/pbs-api-types/Cargo.toml new file mode 100644 index 00000000..0a9f7ea7 --- /dev/null +++ b/pbs-api-types/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "pbs-api-types" +version = "0.1.0" +authors = ["Proxmox Support Team "] +edition = "2018" +description = "general API type helpers for PBS" + +[dependencies] +lazy_static = "1.4" +regex = "1.2" + +proxmox = { version = "0.11.5", default-features = false, features = [ "api-macro" ] } diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs new file mode 100644 index 00000000..0e3d5c39 --- /dev/null +++ b/pbs-api-types/src/lib.rs @@ -0,0 +1,14 @@ +use proxmox::api::schema::{ApiStringFormat, Schema, StringSchema}; +use proxmox::const_regex; + +const_regex! { + pub FINGERPRINT_SHA256_REGEX = r"^(?:[0-9a-fA-F][0-9a-fA-F])(?::[0-9a-fA-F][0-9a-fA-F]){31}$"; +} + +pub const FINGERPRINT_SHA256_FORMAT: ApiStringFormat = + ApiStringFormat::Pattern(&FINGERPRINT_SHA256_REGEX); + +pub const CERT_FINGERPRINT_SHA256_SCHEMA: Schema = + StringSchema::new("X509 certificate fingerprint (sha256).") + .format(&FINGERPRINT_SHA256_FORMAT) + .schema();