]> WPIA git - cassiopeia.git/blob - src/database.h
add: simple, signer-side record handling
[cassiopeia.git] / src / database.h
1 #pragma once
2
3 #include <string>
4 #include <memory>
5 #include <vector>
6
7 struct Profile {
8     std::string cert;
9     std::string key;
10 };
11
12 struct Job {
13     std::string id;
14     std::string target;
15     std::string task;
16     std::string from;
17     std::string to;
18 };
19
20 struct SAN {
21     std::string content;
22     std::string type;
23 };
24
25 struct AVA {
26     std::string name;
27     std::string value;
28 };
29
30 struct TBSCertificate {
31     std::string md;
32     std::string profile;
33     /**
34      * CSR path
35      */
36     std::string csr;
37     std::string csr_type;
38     std::string csr_content;
39     std::vector<std::shared_ptr<SAN>> SANs;
40     std::vector<std::shared_ptr<AVA>> AVAs;
41 };
42
43
44 struct SignedCertificate {
45     std::string certificate;
46     std::string serial;
47     uint32_t before;
48     uint32_t after;
49     std::string pkHash;
50     std::string certHash;
51     std::string crt_name;
52     std::string log;
53 };
54
55 class JobProvider {
56 public:
57     virtual std::shared_ptr<Job> fetchJob() = 0;
58     virtual bool finishJob( std::shared_ptr<Job> job ) = 0;
59     virtual std::shared_ptr<TBSCertificate> fetchTBSCert( std::shared_ptr<Job> job ) = 0;
60     virtual void writeBack( std::shared_ptr<Job> job, std::shared_ptr<SignedCertificate> res ) = 0;
61 };