Implement viewing key storage in the keystore
This commit is contained in:
@@ -12,20 +12,28 @@ uint256 PaymentAddress::GetHash() const {
|
||||
return Hash(ss.begin(), ss.end());
|
||||
}
|
||||
|
||||
uint256 ReceivingKey::pk_enc() {
|
||||
uint256 ReceivingKey::pk_enc() const {
|
||||
return ZCNoteEncryption::generate_pubkey(*this);
|
||||
}
|
||||
|
||||
PaymentAddress ViewingKey::address() const {
|
||||
return PaymentAddress(a_pk, sk_enc.pk_enc());
|
||||
}
|
||||
|
||||
ReceivingKey SpendingKey::receiving_key() const {
|
||||
return ReceivingKey(ZCNoteEncryption::generate_privkey(*this));
|
||||
}
|
||||
|
||||
ViewingKey SpendingKey::viewing_key() const {
|
||||
return ViewingKey(PRF_addr_a_pk(*this), receiving_key());
|
||||
}
|
||||
|
||||
SpendingKey SpendingKey::random() {
|
||||
return SpendingKey(random_uint252());
|
||||
}
|
||||
|
||||
PaymentAddress SpendingKey::address() const {
|
||||
return PaymentAddress(PRF_addr_a_pk(*this), receiving_key().pk_enc());
|
||||
return viewing_key().address();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user