Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
cert_updater.h
Go to the documentation of this file.
1#pragma once
2
3#include <expected>
4#include <filesystem>
5#include <string>
6
7namespace mm {
8
13inline std::string defaultCertUrl() {
14 return "https://github.com/synapticon/motion-master/releases/download/tls-cert/cert.pem";
15}
16
18inline std::string defaultKeyUrl() {
19 return "https://github.com/synapticon/motion-master/releases/download/tls-cert/key.pem";
20}
21
40std::expected<void, std::string> fetchAndSwapCert(const std::string& certPath,
41 const std::string& keyPath,
42 const std::string& certUrl,
43 const std::string& keyUrl);
44
47 std::string certPath;
48 std::string keyPath;
51 std::string source;
52};
53
68ResolvedCert resolveCertPaths(const std::string& configCertPath, const std::string& configKeyPath,
69 const std::filesystem::path& defaultCertPath,
70 const std::filesystem::path& defaultKeyPath);
71
93std::expected<void, std::string> healCertIfNeeded(const std::string& certPath,
94 const std::string& keyPath, bool autoUpdate,
95 const std::string& certUrl,
96 const std::string& keyUrl);
97
98} // namespace mm
Definition auto_tuning_setup.cc:10
std::string defaultKeyUrl()
Default rolling-release URL for the current TLS private key. See defaultCertUrl.
Definition cert_updater.h:18
ResolvedCert resolveCertPaths(const std::string &configCertPath, const std::string &configKeyPath, const std::filesystem::path &defaultCertPath, const std::filesystem::path &defaultKeyPath)
Resolve the TLS cert/key file paths, choosing by discovery when not configured.
Definition cert_updater.cc:173
std::string defaultCertUrl()
Default rolling-release URL for the current TLS certificate.
Definition cert_updater.h:13
std::expected< void, std::string > fetchAndSwapCert(const std::string &certPath, const std::string &keyPath, const std::string &certUrl, const std::string &keyUrl)
Downloads a fresh certificate and key and atomically installs them.
Definition cert_updater.cc:140
std::expected< void, std::string > healCertIfNeeded(const std::string &certPath, const std::string &keyPath, bool autoUpdate, const std::string &certUrl, const std::string &keyUrl)
Assess the served TLS certificate and refresh it if missing, expired, or expiring soon (the startup "...
Definition cert_updater.cc:207
The TLS cert/key paths the server should use, plus where they came from.
Definition cert_updater.h:46
std::string keyPath
Definition cert_updater.h:48
std::string source
Definition cert_updater.h:51
std::string certPath
Resolved certificate path (always populated).
Definition cert_updater.h:47