Offline Transaction Signing (OTS) 0.1.0
|
provides all offline wallet functionality More...
#include <ots.hpp>
Public Member Functions | |
uint64_t | height () const noexcept |
The block height on creation of the wallet. | |
Address | address (uint32_t account=0, uint32_t index=0) const noexcept |
Generate/lookup address in wallet. | |
std::vector< Address > | accounts (uint32_t max=10, uint32_t offset=0) const noexcept |
Gives a list of accounts (e.g. for a address browser) | |
std::vector< Address > | subAddresses (uint32_t account=0, uint32_t max=10, uint32_t offset=0) const noexcept |
Gives a list of subaddresses for a given account. | |
bool | hasAddress (const std::string &address, uint32_t maxAccountDepth=0, uint32_t maxIndexDepth=0) const noexcept |
check if the address string is a valid monero address and then if the address belongs to the wallet | |
bool | hasAddress (const Address &address, uint32_t maxAccountDepth=0, uint32_t maxIndexDepth=0) const noexcept |
check if the address belongs to the wallet | |
std::pair< uint32_t, uint32_t > | addressIndex (const std::string &address, uint32_t maxAccountDepth=0, uint32_t maxIndexDepth=0) const |
check if the address string is a valid monero address and give the account and subindex | |
std::pair< uint32_t, uint32_t > | addressIndex (const Address &address, uint32_t maxAccountDepth=0, uint32_t maxIndexDepth=0) const |
get the account and subindex of a address in the wallet | |
WipeableString | secretViewKey () const noexcept |
The Secret View Key. | |
WipeableString | publicViewKey () const noexcept |
The Public View Key. | |
WipeableString | secretSpendKey () const noexcept |
The Secret Spend Key. | |
WipeableString | publicSpendKey () const noexcept |
The Public Spend Key. | |
uint64_t | importOutputs (const std::string &outputs) |
import the output, previous exported from the view only wallet | |
WipeableString | exportKeyImages () const |
export key images after outputs are imported | |
TxDescription | describeTransaction (const std::string &unsignedTransaction) const |
Gives a whole picture of the unsigned transaction. | |
std::vector< TxWarning > | checkTransaction (const std::string &unsignedTransaction) const |
Gives a warnings if any for the unsigned transaction. | |
std::vector< TxWarning > | checkTransaction (const TxDescription &description) const noexcept |
Gives a warnings if any for the unsigned transaction. | |
std::string | signTransaction (const std::string &unsignedTransaction) const |
Sign a provided unsigned transaction. | |
std::string | signData (const std::string &data) const noexcept |
Sign a provided string. | |
std::string | signData (const std::string &data, const std::pair< uint32_t, uint32_t > &index) const |
sign a message with subindex address of the wallet | |
std::string | signData (const std::string &data, const Address &address) const |
sign a message with the provided address of the wallet | |
std::string | signData (const std::string &data, const std::string &address) const |
sign a message with the provided address of the wallet | |
bool | verifyData (const std::string &data, const std::pair< uint32_t, uint32_t > &index, const std::string &signature, bool legacyFallback=false) const |
Verify a signed message. | |
bool | verifyData (const std::string &data, const std::string &signature, bool legacyFallback=false) const |
Verify a signed message, for the wallet address. | |
Wallet (const std::array< unsigned char, 32 > &key, uint64_t height, const Network network) noexcept | |
Create a offline Wallet from a secret key. | |
Wallet (const KeyStore &key, uint64_t height, const Network network) noexcept | |
Create a offline Wallet from a secret key. | |
Wallet (const Account &account, const KeyStore &key, uint64_t height, const Network network) noexcept | |
Create a offline Wallet from a secret key. | |
Static Public Member Functions | |
static bool | verifyData (const std::string &data, const std::string &address, const std::string &signature, bool legacyFallback=false) |
Verify a signed message. | |
static bool | verifyData (const std::string &data, const Address &address, const std::string &signature, bool legacyFallback=false) |
Verify a signed message. | |
Protected Attributes | |
std::unique_ptr< KeyStore, KeyStoreDeleter > | m_key |
std::unique_ptr< Account, AccountDeleter > | m_account |
Network | m_network |
uint64_t | m_height = 0 |
provides all offline wallet functionality
|
noexcept |
Create a offline Wallet from a secret key.
key | provide the key via a secret key Storage |
height | restore height of the wallet |
network | the network of the wallet |
|
noexcept |
Create a offline Wallet from a secret key.
account | provides the internal workings of the wallet |
key | provide the key via a secret key Storage |
height | restore height of the wallet |
network | the network of the wallet |
|
noexcept |
Gives a list of accounts (e.g. for a address browser)
max | maximum entries returned, which should be always be return, except if index + max < max(uint32_t) |
offset | first account to return |
|
noexcept |
Generate/lookup address in wallet.
account | 0 is the default account and wallet itself |
index | starting from 0 is the index of the subaddress in the account |
std::pair< uint32_t, uint32_t > ots::Wallet::addressIndex | ( | const Address & | address, |
uint32_t | maxAccountDepth = 0 , |
||
uint32_t | maxIndexDepth = 0 |
||
) | const |
get the account and subindex of a address in the wallet
address | the string containing supposingly a monero address |
ots::exception::address::Invalid | if the address is not valid |
ots::exception::wallet::AddressNotFound | if the address is not in the wallet |
std::pair< uint32_t, uint32_t > ots::Wallet::addressIndex | ( | const std::string & | address, |
uint32_t | maxAccountDepth = 0 , |
||
uint32_t | maxIndexDepth = 0 |
||
) | const |
check if the address string is a valid monero address and give the account and subindex
address | the string containing supposingly a monero address |
ots::exception::address::Invalid | if the address is not valid |
ots::exception::wallet::AddressNotFound | if the address is not in the wallet |
std::vector< TxWarning > ots::Wallet::checkTransaction | ( | const std::string & | unsignedTransaction | ) | const |
Gives a warnings if any for the unsigned transaction.
unsignedTransaction | unsigned transaction string |
ots::exception::tx::Invalid | if the provided transaction is invalid |
|
noexcept |
Gives a warnings if any for the unsigned transaction.
description | Transaction Description object |
TxDescription ots::Wallet::describeTransaction | ( | const std::string & | unsignedTransaction | ) | const |
Gives a whole picture of the unsigned transaction.
unsignedTransaction | unsigned transaction string |
ots::exception::tx::Invalid | if the provided transaction is invalid |
WipeableString ots::Wallet::exportKeyImages | ( | ) | const |
export key images after outputs are imported
ots::exception::wallet::ExportKeyImages | if there are no key images, probably because no outputs are imported |
|
noexcept |
check if the address belongs to the wallet
address | the monero address |
|
noexcept |
check if the address string is a valid monero address and then if the address belongs to the wallet
address | the string containing supposingly a monero address |
|
inlinenoexcept |
The block height on creation of the wallet.
uint64_t ots::Wallet::importOutputs | ( | const std::string & | outputs | ) |
import the output, previous exported from the view only wallet
ots::exception::wallet::ImportOutputs | if provides outputs are not valid |
|
noexcept |
The Public Spend Key.
|
noexcept |
The Public View Key.
|
noexcept |
The Secret Spend Key.
|
noexcept |
The Secret View Key.
|
noexcept |
Sign a provided string.
data | String of the message to sign |
std::string ots::Wallet::signData | ( | const std::string & | data, |
const Address & | address | ||
) | const |
sign a message with the provided address of the wallet
data | the message to sign |
address | the address of the wallet |
ots::exception::address::Invalid | if the address is not valid |
ots::exception::BufferOverflowException | if tools:write_varint fails in Account::hashData() (should not happen) |
std::string ots::Wallet::signData | ( | const std::string & | data, |
const std::pair< uint32_t, uint32_t > & | index | ||
) | const |
sign a message with subindex address of the wallet
data | the message to sign |
index | the account and index to sign with |
ots::exception::BufferOverflowException | if tools:write_varint fails in Account::hashData() (should not happen) |
std::string ots::Wallet::signData | ( | const std::string & | data, |
const std::string & | address | ||
) | const |
sign a message with the provided address of the wallet
data | the message to sign |
address | the address of the wallet |
ots::exception::address::Invalid | if the address is not valid |
ots::exception::BufferOverflowException | if tools:write_varint fails in Account::hashData() (should not happen) |
std::string ots::Wallet::signTransaction | ( | const std::string & | unsignedTransaction | ) | const |
Sign a provided unsigned transaction.
unsignedTransaction | unsigned transaction string |
ots::exception::tx::Invalid | if the provided transaction is invalid |
|
noexcept |
Gives a list of subaddresses for a given account.
account | index of the account, 0 is the wallet itself |
max | maximum entries returned, which should be always be return, except if index + max < max(uint32_t) |
offset | first subindex to return |
|
static |
Verify a signed message.
data | String of the message to sign |
address | public Monero address |
signature | for the message |
legacyFallback | if true, will try to verify with legacy signature |
ots::exception::address::Invalid | if the address is not valid |
bool ots::Wallet::verifyData | ( | const std::string & | data, |
const std::pair< uint32_t, uint32_t > & | index, | ||
const std::string & | signature, | ||
bool | legacyFallback = false |
||
) | const |
Verify a signed message.
data | String of the message to sign |
address | index of the account and subaddress |
signature | for the message |
legacyFallback | if true, will try to verify with legacy signature |
ots::exception::address::Invalid | if the address is not valid |
|
static |
Verify a signed message.
data | String of the message to sign |
address | public Monero address as string |
signature | for the message |
ots::exception::address::Invalid | if the address is not valid |
bool ots::Wallet::verifyData | ( | const std::string & | data, |
const std::string & | signature, | ||
bool | legacyFallback = false |
||
) | const |
Verify a signed message, for the wallet address.
data | String of the message to sign |
signature | for the message |
legacyFallback | if true, will try to verify with legacy signature |
ots::exception::address::Invalid | if the address is not valid |
|
protected |
|
protected |
|
protected |
|
protected |