37 lines
1.2 KiB
C++
Executable file
37 lines
1.2 KiB
C++
Executable file
// Copyright (c) 2011-2016 The Cryptonote developers
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include "Account.h"
|
|
#include "CryptoNoteSerialization.h"
|
|
|
|
namespace CryptoNote {
|
|
//-----------------------------------------------------------------
|
|
AccountBase::AccountBase() {
|
|
setNull();
|
|
}
|
|
//-----------------------------------------------------------------
|
|
void AccountBase::setNull() {
|
|
m_keys = AccountKeys();
|
|
}
|
|
//-----------------------------------------------------------------
|
|
void AccountBase::generate() {
|
|
Crypto::generate_keys(m_keys.address.spendPublicKey, m_keys.spendSecretKey);
|
|
Crypto::generate_keys(m_keys.address.viewPublicKey, m_keys.viewSecretKey);
|
|
m_creation_timestamp = time(NULL);
|
|
}
|
|
//-----------------------------------------------------------------
|
|
const AccountKeys &AccountBase::getAccountKeys() const {
|
|
return m_keys;
|
|
}
|
|
|
|
void AccountBase::setAccountKeys(const AccountKeys &keys) {
|
|
m_keys = keys;
|
|
}
|
|
//-----------------------------------------------------------------
|
|
|
|
void AccountBase::serialize(ISerializer &s) {
|
|
s(m_keys, "m_keys");
|
|
s(m_creation_timestamp, "m_creation_timestamp");
|
|
}
|
|
}
|