SlHelpers
SSH.h
1 // SPDX-License-Identifier: GPL-2.0-only
2 
3 #pragma once
4 
5 #include <filesystem>
6 #include <string>
7 #include <utility>
8 #include <vector>
9 
10 namespace SlSSH {
11 
15 class Keys {
16 public:
17  Keys() = delete;
18 
20  using Key = std::filesystem::path;
22  using KeyPair = std::pair<Key, Key>;
24  using KeyPairs = std::vector<KeyPair>;
25 
31  static KeyPairs get(const std::string &host) noexcept;
32 private:
33  friend void testKeys();
34  static void replace(std::string &path, size_t &pos, std::string_view by) noexcept;
35  static Key handleTokens(std::string_view host, std::string path) noexcept;
36 };
37 
38 }
Get SSH private and public keys.
Definition: SSH.h:15
std::filesystem::path Key
One SSH key (a path to it)
Definition: SSH.h:20
std::pair< Key, Key > KeyPair
A pair of public + private keys (in that order)
Definition: SSH.h:22
std::vector< KeyPair > KeyPairs
A list of key pairs.
Definition: SSH.h:24
Definition: SSH.h:10