Offline Transaction Signing (OTS) 0.1.0
Loading...
Searching...
No Matches
polyseed-key-store.hpp
Go to the documentation of this file.
1#pragma once
2
9#include "key-store.hpp"
10#include "polyseed.h"
11#include "../src/storage.h" // TODO: do better, it's ugly
12#include "../src/features.h" // TODO: do better, it's ugly
13
14namespace ots {
19 class PolyseedKeyStore : public KeyStore {
20 public:
25 explicit PolyseedKeyStore() noexcept;
26
31 explicit PolyseedKeyStore(const std::array<uint8_t, 32>& key) noexcept;
32
39 bool isEncypted() const noexcept;
40 protected:
52 operator const uint8_t*();
53
67 uint8_t* unsafe_mutable_bytes();
68
78 void set(const polyseed_data* data);
79
84 void transfer(polyseed_data* data);
85
97 const polyseed_data* getPolyseedDataReadOnlySession();
98
113 polyseed_data* getPolyseedDataSession();
114
122
128
133 friend class Polyseed;
134
135 private:
136
141 void wipePolyseedData() noexcept;
142
147 void cleanupPolyseedDataSession() noexcept;
148
157 void startPolyseedDataSession(bool write);
158
166 void endPolyseedDataSession(bool write);
167
169 mutable bool m_pd_session = false;
170
172 mutable bool m_pd_session_rw = false;
173
178 std::unique_ptr<polyseed_data> m_data = std::make_unique<polyseed_data>();
179 };
180}
essentialy wraps crypto::secret_key
Definition key-store.hpp:18
Extends KeyStore with specific functionality for polyseed-based cryptographic operations.
Definition polyseed-key-store.hpp:19
void discardPolyseedDataSession()
wipe secure the pointers secret
Definition polyseed-key-store.cpp:51
bool isEncypted() const noexcept
check if polyseed_data secret in encrypted
Definition polyseed-key-store.cpp:7
void set(const polyseed_data *data)
Internal method to set key data from polyseed_data->secret.
Definition polyseed-key-store.cpp:21
polyseed_data * getPolyseedDataSession()
Provide a polyseed_data struct pointer to work On.
Definition polyseed-key-store.cpp:39
void transfer(polyseed_data *data)
Internal method to set key data from polyseed_data->secret, and wipes polyseed_data->secret.
Definition polyseed-key-store.cpp:28
const polyseed_data * getPolyseedDataReadOnlySession()
Provide a polyseed_data struct const pointer to work with.
Definition polyseed-key-store.cpp:33
void commitPolyseedDataSession()
update PolyseedKeyStore data from the pointers secret and wipe secure
Definition polyseed-key-store.cpp:45
uint8_t * unsafe_mutable_bytes()
Get mutable byte access.
Definition polyseed-key-store.cpp:16
PolyseedKeyStore(const std::array< uint8_t, 32 > &key) noexcept
Construct a PolyseedKeyStore from an existing key.
PolyseedKeyStore() noexcept
Default constructor for an empty seed key store.
Definition polyseed-key-store.cpp:85
Represents a Polyseed type.
Definition ots.hpp:706
decoupling of crypto/crypto.h of the monero source
The library exists complete only in this namespace.
Definition account.hpp:39