Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
local-keys.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include "
nix/util/json-impls.hh
"
5
6
#include <map>
7
8
namespace
nix {
9
15
struct
Signature
16
{
17
std::string keyName;
18
22
std::string
sig
;
23
27
static
Signature
parse
(std::string_view);
28
34
template
<
typename
Container>
35
static
std::set<Signature>
parseMany
(
const
Container & sigStrs);
36
37
std::string to_string()
const
;
38
39
static
Strings toStrings(
const
std::set<Signature> & sigs);
40
41
auto
operator<=>(
const
Signature
&)
const
=
default
;
42
};
43
44
struct
Key
45
{
46
std::string name;
47
std::string key;
48
49
std::string to_string()
const
;
50
51
protected
:
52
60
Key
(std::string_view s,
bool
sensitiveValue);
61
62
Key
(std::string_view name, std::string && key)
63
: name(name)
64
, key(std::move(key))
65
{
66
}
67
};
68
69
struct
PublicKey
;
70
71
struct
SecretKey :
Key
72
{
73
SecretKey(std::string_view s);
74
78
Signature
signDetached
(std::string_view s)
const
;
79
80
PublicKey
toPublicKey()
const
;
81
82
static
SecretKey generate(std::string_view name);
83
84
private
:
85
SecretKey(std::string_view name, std::string && key)
86
:
Key
(name, std::move(key))
87
{
88
}
89
};
90
91
struct
PublicKey :
Key
92
{
93
PublicKey(std::string_view data);
94
99
bool
verifyDetached
(std::string_view data,
const
Signature
& sig)
const
;
100
107
bool
verifyDetachedAnon
(std::string_view data,
const
Signature
& sig)
const
;
108
109
private
:
110
PublicKey(std::string_view name, std::string && key)
111
:
Key
(name, std::move(key))
112
{
113
}
114
friend
struct
SecretKey;
115
};
116
120
typedef
std::map<std::string, PublicKey>
PublicKeys
;
121
126
bool
verifyDetached
(std::string_view data,
const
Signature
& sig,
const
PublicKeys
& publicKeys);
127
128
}
// namespace nix
129
130
JSON_IMPL(
nix::Signature
)
json-impls.hh
nix::PublicKeys
std::map< std::string, PublicKey > PublicKeys
Definition
local-keys.hh:120
nix::verifyDetached
bool verifyDetached(std::string_view data, const Signature &sig, const PublicKeys &publicKeys)
Definition
local-keys.cc:167
nix::Key::Key
Key(std::string_view s, bool sensitiveValue)
Definition
local-keys.cc:84
nix::PublicKey
Definition
local-keys.hh:92
nix::PublicKey::verifyDetachedAnon
bool verifyDetachedAnon(std::string_view data, const Signature &sig) const
Definition
local-keys.cc:154
nix::PublicKey::verifyDetached
bool verifyDetached(std::string_view data, const Signature &sig) const
Definition
local-keys.cc:146
nix::SecretKey::signDetached
Signature signDetached(std::string_view s) const
Definition
local-keys.cc:111
nix::Signature
Definition
local-keys.hh:16
nix::Signature::sig
std::string sig
Definition
local-keys.hh:22
nix::Signature::parse
static Signature parse(std::string_view)
Definition
local-keys.cc:50
nix::Signature::parseMany
static std::set< Signature > parseMany(const Container &sigStrs)
Definition
local-keys.cc:65
libutil
include
nix
util
signature
local-keys.hh
Generated by
1.18.0