Add support for spending keys to the basic key store
This commit is contained in:
@@ -8,7 +8,7 @@ uint256 ViewingKey::pk_enc() {
|
||||
return ZCNoteEncryption::generate_pubkey(*this);
|
||||
}
|
||||
|
||||
ViewingKey SpendingKey::viewing_key() {
|
||||
ViewingKey SpendingKey::viewing_key() const {
|
||||
return ViewingKey(ZCNoteEncryption::generate_privkey(*this));
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ SpendingKey SpendingKey::random() {
|
||||
return SpendingKey(random_uint252());
|
||||
}
|
||||
|
||||
PaymentAddress SpendingKey::address() {
|
||||
PaymentAddress SpendingKey::address() const {
|
||||
return PaymentAddress(PRF_addr_a_pk(*this), viewing_key().pk_enc());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ public:
|
||||
READWRITE(a_pk);
|
||||
READWRITE(pk_enc);
|
||||
}
|
||||
|
||||
friend inline bool operator<(const PaymentAddress& a, const PaymentAddress& b) { return a.a_pk < b.a_pk; }
|
||||
};
|
||||
|
||||
class ViewingKey : public uint256 {
|
||||
@@ -38,8 +40,8 @@ public:
|
||||
|
||||
static SpendingKey random();
|
||||
|
||||
ViewingKey viewing_key();
|
||||
PaymentAddress address();
|
||||
ViewingKey viewing_key() const;
|
||||
PaymentAddress address() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user