-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublicKeys.h
42 lines (32 loc) · 1.16 KB
/
PublicKeys.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Created by parallels on 7/20/17.
//
#ifndef ACCOUNTS_PUBLICKEYS_H
#define ACCOUNTS_PUBLICKEYS_H
#include "SecretKeys.h"
#include <string>
/*
* TODO: What if someone wants to generate multiple addresses? This must be handled by wallet
* TODO: generateKeys can't overwrite previous keys, as the sk->pk relationship could be lost.
* - Scenario : Generate secret keys, then call public keys with bad values.
* - Wallet must take care of this
*
* TODO: Wallets must have "CreatePrivateAccount" that stores pub/priv key pairs with naming acc_skEnc acc_pkEnc acc_pkAddr acc_skAddr
*/
template<typename T>
static std::string HexStr(const T itbegin, const T itend);
class PublicKeys {
private:
std::string accName;
uint256 addrPk;
uint256 encPk;
uint256 generatePkEnc(const uint256 &);
uint256 generatePkAddr(const uint252 &);
std::string toHexString() const;
void storeKeys(); //called only by generateKeys
public:
PublicKeys(std::string acc): accName(acc), addrPk(uint256()), encPk(uint256()){};
void generateKeys(SecretKeys&);
void paymentAddress() const; //Outputs the payment address
};
#endif //ACCOUNTS_PUBLICKEYS_H