core: move away from db towards hash-based auth

This commit is contained in:
Vaxry
2025-04-13 21:19:05 +01:00
parent 5f20698aa6
commit c3975b27f1
13 changed files with 444 additions and 429 deletions

26
src/core/Crypto.hpp Normal file
View File

@@ -0,0 +1,26 @@
#pragma once
#include <string>
#include <string_view>
#include <memory>
#include <vector>
#include <openssl/evp.h>
class CCrypto {
public:
CCrypto();
~CCrypto();
std::string sha256(const std::string& in);
std::string sign(const std::string& in);
bool verifySignature(const std::string& in, const std::string& sig);
private:
EVP_PKEY* m_evpPkey = nullptr;
bool genKey();
void readKey();
std::vector<uint8_t> toByteArr(const std::string_view& s);
};
inline std::unique_ptr<CCrypto> g_pCrypto;