libzypp: zypp/ng/userrequest.h Source File

libzypp 17.38.6

userrequest.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_NG_USERREQUEST_H_INCLUDED
10#define ZYPP_NG_USERREQUEST_H_INCLUDED
11
12#include <zypp-common/PublicKey.h>
13#include <zypp/KeyContext.h>
14#include <zypp-core/ng/ui/UserRequest>
15
16namespace zyppng {
17
27 namespace AcceptNoDigestRequest {
28 constexpr std::string_view CTYPE ("digest/accept-no-digest");
29 constexpr std::string_view FILE ("file");
30 UserData makeData ( const zypp::Pathname &p);
31 }
32
43 namespace AcceptUnknownDigestRequest {
44 constexpr std::string_view CTYPE ("digest/accept-unknown-digest");
45 constexpr std::string_view FILE ("file");
46 constexpr std::string_view NAME ("name");
47 UserData makeData ( const zypp::Pathname &p, const std::string &name );
48 }
49
60 namespace AcceptWrongDigestRequest {
61 constexpr std::string_view CTYPE ("digest/accept-unknown-digest");
62 constexpr std::string_view FILE ("file");
63 constexpr std::string_view NAME_REQUESTED ("requested");
64 constexpr std::string_view NAME_FOUND ("found");
65 UserData makeData ( const zypp::Pathname &p, const std::string &requested, const std::string &found );
66 }
67
68
69 ZYPP_FWD_DECL_TYPE_WITH_REFS(TrustKeyRequest);
70 class TrustKeyRequest : public UserRequest
71 {
72 ZYPP_ADD_CREATE_FUNC(TrustKeyRequest)
73 public:
78 enum KeyTrust
79 {
83 KEY_DONT_TRUST = 0,
88 KEY_TRUST_TEMPORARILY,
97 KEY_TRUST_AND_IMPORT
98 };
99
100 ZYPP_DECL_PRIVATE_CONSTR_ARGS(TrustKeyRequest, std::string label, KeyTrust trust = KEY_DONT_TRUST, UserData userData = {} );
101
102 void setChoice ( const KeyTrust sel );
103 KeyTrust choice() const;
104
105 const std::string label() const;
106
107 UserRequestType type() const override;
108
109 private:
110 std::string _label;
111 KeyTrust _answer = KEY_DONT_TRUST;
112 };
113
122 namespace AcceptKeyRequest {
123 constexpr std::string_view CTYPE ("keyring/accept-key");
124 constexpr std::string_view KEY ("key");
125 constexpr std::string_view KEY_CONTEXT("key-context");
126 UserData makeData ( const zypp::PublicKey &key, const zypp::KeyContext &keycontext = zypp::KeyContext() );
127 }
128
129
138 namespace VerifyInfoEvent {
139 constexpr std::string_view CTYPE ("keyring/info-verify");
140 constexpr std::string_view FILE ("file");
141 constexpr std::string_view KEY_DATA("key-data");
142 constexpr std::string_view KEY_CONTEXT("key-context");
143 UserData makeData ( const std::string & file_r, const zypp::PublicKeyData & keyData_r, const zypp::KeyContext &keycontext = zypp::KeyContext() );
144 }
145
153 namespace AcceptUnsignedFileRequest {
154 constexpr std::string_view CTYPE ("keyring/accept-unsigned-file");
155 constexpr std::string_view FILE ("file");
156 constexpr std::string_view KEY_CONTEXT("key-context");
157 UserData makeData ( const std::string &file, const zypp::KeyContext &keycontext = zypp::KeyContext() );
158 }
159
172 namespace AcceptUnknownKeyRequest {
173 constexpr std::string_view CTYPE ("keyring/accept-unknown-key");
174 constexpr std::string_view KEYID ("keyid");
175 constexpr std::string_view FILE ("file");
176 constexpr std::string_view KEY_CONTEXT("key-context");
177 UserData makeData ( const std::string &file, const std::string &id, const zypp::KeyContext &keycontext = zypp::KeyContext() );
178 }
179
189 namespace AcceptFailedVerificationRequest {
190 constexpr std::string_view CTYPE ("keyring/accept-failed-verification");
191 constexpr std::string_view FILE ("file");
192 constexpr std::string_view KEY ("key");
193 constexpr std::string_view KEY_CONTEXT ("key-context");
194 UserData makeData ( const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext = zypp::KeyContext() );
195 }
196
206 namespace AcceptPackageKeyRequest {
207 constexpr std::string_view CTYPE ("keyring/accept-package-key");
208 constexpr std::string_view KEY ("key");
209 constexpr std::string_view KEY_CONTEXT ("key-context");
210 UserData makeData ( const zypp::PublicKey &key_r, const zypp::KeyContext &keycontext_r = zypp::KeyContext() );
211 }
212
221 namespace NonImportedKeysInfoEvent {
222 constexpr std::string_view CTYPE ("keyring/keys-not-imported");
223 constexpr std::string_view KEYS ("keys");
224 UserData makeData ( const std::set<zypp::Edition> &keys_r );
225 }
226
238 namespace KeyAutoImportInfoEvent {
239 constexpr std::string_view CTYPE ("keyring/auto-import-key-info");
240 constexpr std::string_view KEY_DATA_LIST ("key-data-list");
241 constexpr std::string_view KEY_DATA ("key-data");
242 constexpr std::string_view KEY_CONTEXT ("key-context");
243 UserData makeData ( const std::list<zypp::PublicKeyData> & keyDataList_r,
244 const zypp::PublicKeyData & keySigning_r,
245 const zypp::KeyContext &keyContext_r );
246 }
247
248
249}
250
251#endif // ZYPP_NG_USERREQUEST_H_INCLUDED
KeyContext.h
PublicKey.h
zypp::PublicKeyData
Class representing one GPG Public Keys data.
Definition PublicKey.h:201
zypp::PublicKey
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition PublicKey.h:375
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zyppng::TrustKeyRequest
Definition userrequest.h:71
zyppng::TrustKeyRequest::ZYPP_DECL_PRIVATE_CONSTR_ARGS
ZYPP_DECL_PRIVATE_CONSTR_ARGS(TrustKeyRequest, std::string label, KeyTrust trust=KEY_DONT_TRUST, UserData userData={})
zyppng::TrustKeyRequest::setChoice
void setChoice(const KeyTrust sel)
Definition userrequest.cc:40
zyppng::TrustKeyRequest::KeyTrust
KeyTrust
Definition userrequest.h:79
zyppng::TrustKeyRequest::KEY_DONT_TRUST
@ KEY_DONT_TRUST
User has chosen not to trust the key.
Definition userrequest.h:83
zyppng::TrustKeyRequest::KEY_TRUST_AND_IMPORT
@ KEY_TRUST_AND_IMPORT
Import the key.
Definition userrequest.h:97
zyppng::TrustKeyRequest::KEY_TRUST_TEMPORARILY
@ KEY_TRUST_TEMPORARILY
This basically means, we knew the key, but it was not trusted.
Definition userrequest.h:88
zyppng::TrustKeyRequest::label
const std::string label() const
Definition userrequest.cc:46
zyppng::TrustKeyRequest::_answer
KeyTrust _answer
Definition userrequest.h:111
zyppng::TrustKeyRequest::_label
std::string _label
Definition userrequest.h:110
zyppng::TrustKeyRequest::choice
KeyTrust choice() const
Definition userrequest.cc:43
zyppng::TrustKeyRequest::type
UserRequestType type() const override
Definition userrequest.cc:49
zyppng::UserRequest::userData
const UserData & userData() const
Definition userrequest.cc:22
zyppng::UserRequest::UserRequest
UserRequest(UserData userData={})
Definition userrequest.cc:15
zyppng::AcceptFailedVerificationRequest
Ask the user to accept a file that is signed but where the signature verification failed.
Definition userrequest.h:189
zyppng::AcceptFailedVerificationRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptFailedVerificationRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptFailedVerificationRequest::makeData
UserData makeData(const std::string &file, const zypp::PublicKey &key, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:86
zyppng::AcceptFailedVerificationRequest::KEY
constexpr std::string_view KEY("key")
zyppng::AcceptFailedVerificationRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-failed-verification")
zyppng::AcceptKeyRequest
Definition userrequest.h:122
zyppng::AcceptKeyRequest::KEY
constexpr std::string_view KEY("key")
zyppng::AcceptKeyRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-key")
zyppng::AcceptKeyRequest::makeData
UserData makeData(const zypp::PublicKey &key, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:52
zyppng::AcceptKeyRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptNoDigestRequest
Definition userrequest.h:27
zyppng::AcceptNoDigestRequest::makeData
UserData makeData(const zypp::Pathname &p)
Definition userrequest.cc:13
zyppng::AcceptNoDigestRequest::CTYPE
constexpr std::string_view CTYPE("digest/accept-no-digest")
zyppng::AcceptNoDigestRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptPackageKeyRequest
Ask user to trust and/or import the package key to trusted keyring.
Definition userrequest.h:206
zyppng::AcceptPackageKeyRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-package-key")
zyppng::AcceptPackageKeyRequest::makeData
UserData makeData(const zypp::PublicKey &key_r, const zypp::KeyContext &keycontext_r=zypp::KeyContext())
Definition userrequest.cc:95
zyppng::AcceptPackageKeyRequest::KEY
constexpr std::string_view KEY("key")
zyppng::AcceptPackageKeyRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptUnknownDigestRequest
Definition userrequest.h:43
zyppng::AcceptUnknownDigestRequest::makeData
UserData makeData(const zypp::Pathname &p, const std::string &name)
Definition userrequest.cc:19
zyppng::AcceptUnknownDigestRequest::CTYPE
constexpr std::string_view CTYPE("digest/accept-unknown-digest")
zyppng::AcceptUnknownDigestRequest::NAME
constexpr std::string_view NAME("name")
zyppng::AcceptUnknownDigestRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptUnknownKeyRequest
Ask the user to accept a unknown key.
Definition userrequest.h:172
zyppng::AcceptUnknownKeyRequest::makeData
UserData makeData(const std::string &file, const std::string &id, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:77
zyppng::AcceptUnknownKeyRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptUnknownKeyRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptUnknownKeyRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-unknown-key")
zyppng::AcceptUnknownKeyRequest::KEYID
constexpr std::string_view KEYID("keyid")
zyppng::AcceptUnsignedFileRequest
Definition userrequest.h:153
zyppng::AcceptUnsignedFileRequest::CTYPE
constexpr std::string_view CTYPE("keyring/accept-unsigned-file")
zyppng::AcceptUnsignedFileRequest::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::AcceptUnsignedFileRequest::FILE
constexpr std::string_view FILE("file")
zyppng::AcceptUnsignedFileRequest::makeData
UserData makeData(const std::string &file, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:69
zyppng::AcceptWrongDigestRequest
Definition userrequest.h:60
zyppng::AcceptWrongDigestRequest::makeData
UserData makeData(const zypp::Pathname &p, const std::string &requested, const std::string &found)
Definition userrequest.cc:26
zyppng::AcceptWrongDigestRequest::CTYPE
constexpr std::string_view CTYPE("digest/accept-unknown-digest")
zyppng::AcceptWrongDigestRequest::NAME_FOUND
constexpr std::string_view NAME_FOUND("found")
zyppng::AcceptWrongDigestRequest::NAME_REQUESTED
constexpr std::string_view NAME_REQUESTED("requested")
zyppng::AcceptWrongDigestRequest::FILE
constexpr std::string_view FILE("file")
zyppng::KeyAutoImportInfoEvent
Notify that a repository auto imported new package signing keys.
Definition userrequest.h:238
zyppng::KeyAutoImportInfoEvent::CTYPE
constexpr std::string_view CTYPE("keyring/auto-import-key-info")
zyppng::KeyAutoImportInfoEvent::KEY_DATA_LIST
constexpr std::string_view KEY_DATA_LIST("key-data-list")
zyppng::KeyAutoImportInfoEvent::makeData
UserData makeData(const std::list< zypp::PublicKeyData > &keyDataList_r, const zypp::PublicKeyData &keySigning_r, const zypp::KeyContext &keyContext_r)
Definition userrequest.cc:110
zyppng::KeyAutoImportInfoEvent::KEY_DATA
constexpr std::string_view KEY_DATA("key-data")
zyppng::KeyAutoImportInfoEvent::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::NonImportedKeysInfoEvent
Notify the user about keys that were not imported from the rpm key database into zypp keyring.
Definition userrequest.h:221
zyppng::NonImportedKeysInfoEvent::KEYS
constexpr std::string_view KEYS("keys")
zyppng::NonImportedKeysInfoEvent::CTYPE
constexpr std::string_view CTYPE("keyring/keys-not-imported")
zyppng::NonImportedKeysInfoEvent::makeData
UserData makeData(const std::set< zypp::Edition > &keys_r)
Definition userrequest.cc:103
zyppng::VerifyInfoEvent
Definition userrequest.h:138
zyppng::VerifyInfoEvent::FILE
constexpr std::string_view FILE("file")
zyppng::VerifyInfoEvent::makeData
UserData makeData(const std::string &file_r, const zypp::PublicKeyData &keyData_r, const zypp::KeyContext &keycontext=zypp::KeyContext())
Definition userrequest.cc:60
zyppng::VerifyInfoEvent::KEY_DATA
constexpr std::string_view KEY_DATA("key-data")
zyppng::VerifyInfoEvent::KEY_CONTEXT
constexpr std::string_view KEY_CONTEXT("key-context")
zyppng::VerifyInfoEvent::CTYPE
constexpr std::string_view CTYPE("keyring/info-verify")
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppng::UserRequestType
UserRequestType
Definition userrequest.h:34
zyppng::UserData
zypp::callback::UserData UserData
Definition userrequest.h:18
zypp::KeyContext
Definition KeyContext.h:9
ZYPP_ADD_CREATE_FUNC
#define ZYPP_ADD_CREATE_FUNC(Class)
Definition zyppglobal.h:198
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:119