Offline Transaction Signing (OTS) 0.1.0
Loading...
Searching...
No Matches
ots Namespace Reference

The library exists complete only in this namespace. More...

Namespaces

namespace  data
 
namespace  exception
 All ots library related exceptions are in this namespace.
 

Classes

class  Account
 holds monero internal account and internal functions More...
 
struct  AccountDeleter
 
class  Address
 Represents a Monero address. More...
 
class  Entropy
 Entropy check functions. More...
 
class  KeyStore
 essentialy wraps crypto::secret_key More...
 
struct  KeyStoreDeleter
 
class  LegacySeed
 Represents a monero 13-words seed type for backward compatibility. More...
 
class  MoneroSeed
 Represents a Monero 25-words seed. More...
 
class  OTS
 General functionality. More...
 
class  Polyseed
 Represents a Polyseed type. More...
 
class  PolyseedKeyStore
 Extends KeyStore with specific functionality for polyseed-based cryptographic operations. More...
 
struct  PolyseedKeyStoreDeleter
 
class  Seed
 Abstract base class for cryptographic seed management. More...
 
class  SeedIndices
 Secure container for seed word indices. More...
 
class  SeedJar
 Storage for the Seed objects, mainly for the purpose of the C ABI. More...
 
class  SeedLanguage
 Manages seed phrase languages and their properties. More...
 
class  TxDescription
 detailed information about a transaction, used to check transaction before signing More...
 
class  TxWarning
 Warnings directed to the actual user related to a transaction to be signed, to make it easier to the application developer to help the user make informed decissions. More...
 
class  Wallet
 provides all offline wallet functionality More...
 
class  WipeableString
 String class that wipes its memory on destruction. More...
 
class  ZeroizeReferenceCopy
 A class to handle a reference copy of a value and zeroize it on destruction. More...
 

Typedefs

using key_handle_t = size_t
 
using seed_handle_t = size_t
 

Enumerations

enum class  Network { MAIN , TEST , STAGE }
 Represents the monero network. More...
 
enum class  AddressType { Standard , SubAddress , Integrated }
 Represents the monero address type. More...
 
enum class  SeedType { Monero , Polyseed }
 Represents the seed type, and is used for the different dictionaries (languages) available. More...
 

Functions

cryptonote::network_type cryptonoteNetwork (Network network) noexcept
 Converts the network type from the library network type to cryptonote network type.
 
std::vector< std::string > splitString (const std::string &input, const std::string &separator="", size_t fixedWidth=4)
 Converts a string by a separator or fixed 4 char width.
 
SeedIndices seedIndices (const unsigned char *bytes, size_t byte_length, size_t word_list_length=1626, size_t bytes_per_chunk=4, size_t words_per_chunk=3)
 Returns the indices of a seed phrase.
 
template<size_t byte_count>
std::array< unsigned char, byte_count > seedBytes (const SeedIndices &indices, const size_t word_list_length=1626, const size_t bytes_per_chunk=4, const size_t words_per_chunk=3)
 
const ots::data::NetworkDatagetNetworkData (Network network)
 
void onPolyseedStatusNotOkThrowException (const polyseed_status &status)
 Translates status to ots::exception's.
 
void injectPolyseedDependency ()
 makes sure dependencies are injected before first use, injection happens only once - first time.
 
void polyseed_random_wrapper (void *result, size_t n)
 provides random bytes to polyseed library
 
void polyseed_pbkdf2_wrapper (const uint8_t *pw, size_t pwlen, const uint8_t *salt, size_t saltlen, uint64_t iterations, uint8_t *key, size_t keylen)
 provides pbkdf2-sha256 to polyseed library
 
void polyseed_memwipe_wrapper (void *const ptr, const size_t len)
 provides memory wipe to polyseed library
 
size_t utf8_nfc (const char *str, polyseed_str norm)
 provides utf8 normalization to polyseed library at the moment utf8proc is used, because it seems that boost::locale will drag more dependencies with in.
 
size_t utf8_nfkd (const char *str, polyseed_str norm)
 provides utf8 normalization to polyseed library, uses also utf8proc
 
std::ostream & operator<< (std::ostream &os, const WipeableString &str)
 

Variables

const std::map< Network, ots::data::NetworkDataNETWORK_DATA_MAP
 

Detailed Description

The library exists complete only in this namespace.

This header file provides following features for the ots library for C++:

  • [x] Legacy Seed (13 words) handling - except generating, omited on purpose
  • [x] Monero Seed (25 words) handling
  • [x] Polyseed (16 words) handling
  • [x] Address management
  • [x] Address verification
  • [ ] Import of outputs
  • [ ] Export of key images
  • [ ] inspect unsigned transaction
  • [x] sign a unsigned transaction
Note
Internal polyseed headers, are used to control variable timestamps on creation it is ugly as fuck, and without to modify or rewrite or write a own library the reasonable thing t do now.
Seen now also that polyseed it LGPL, maybe a reimplementation under a free license would be also a good idea how polyseed will not be dynamically linked there could be some troube
Todo:
Think about reimplementation of polyseed library

Typedef Documentation

◆ key_handle_t

using ots::key_handle_t = typedef size_t

◆ seed_handle_t

using ots::seed_handle_t = typedef size_t

Enumeration Type Documentation

◆ AddressType

enum class ots::AddressType
strong

Represents the monero address type.

Currently a monero address can be one of the following:

Enumerator
Standard 
SubAddress 
Integrated 

◆ Network

enum class ots::Network
strong

Represents the monero network.

  • MAIN: production and default network
  • TEST: development and testing network
  • STAGE: pre-production testing
Enumerator
MAIN 
TEST 
STAGE 

◆ SeedType

enum class ots::SeedType
strong

Represents the seed type, and is used for the different dictionaries (languages) available.

Enumerator
Monero 
Polyseed 

Function Documentation

◆ cryptonoteNetwork()

cryptonote::network_type ots::cryptonoteNetwork ( Network  network)
noexcept

Converts the network type from the library network type to cryptonote network type.

Parameters
networkthe library network type
Returns
the cryptonote network type

◆ getNetworkData()

const ots::data::NetworkData * ots::getNetworkData ( Network  network)

◆ injectPolyseedDependency()

void ots::injectPolyseedDependency ( )

makes sure dependencies are injected before first use, injection happens only once - first time.

Todo:
TODO: holy clusterfuck, I really dislike using the polyseed lib as is

◆ onPolyseedStatusNotOkThrowException()

void ots::onPolyseedStatusNotOkThrowException ( const polyseed_status &  status)

Translates status to ots::exception's.

◆ operator<<()

std::ostream & ots::operator<< ( std::ostream &  os,
const WipeableString str 
)

◆ polyseed_memwipe_wrapper()

void ots::polyseed_memwipe_wrapper ( void *const  ptr,
const size_t  len 
)

provides memory wipe to polyseed library

Note
we use the memwipe from monero, because I assumed it to be safe, we could use sodium_memzero, and I think memwipe is using it anyway, but I like to keep dependencies low as possible, and consistency as high as possible.
Parameters
ptrpointer to memory
lenlength of memory

◆ polyseed_pbkdf2_wrapper()

void ots::polyseed_pbkdf2_wrapper ( const uint8_t *  pw,
size_t  pwlen,
const uint8_t *  salt,
size_t  saltlen,
uint64_t  iterations,
uint8_t *  key,
size_t  keylen 
)

provides pbkdf2-sha256 to polyseed library

Parameters
pwpassword
pwlenpassword length
saltsalt
saltlensalt length
iterationsnumber of iterations
[out]keyOutput. Pre-allocated buffer where the derived key will be stored.
keylenoutput key length

◆ polyseed_random_wrapper()

void ots::polyseed_random_wrapper ( void *  result,
size_t  n 
)

provides random bytes to polyseed library

◆ seedBytes()

template<size_t byte_count>
std::array< unsigned char, byte_count > ots::seedBytes ( const SeedIndices indices,
const size_t  word_list_length = 1626,
const size_t  bytes_per_chunk = 4,
const size_t  words_per_chunk = 3 
)
Todo:
TODO: documentation missing
Todo:
TODO: documentation missing

◆ seedIndices()

SeedIndices ots::seedIndices ( const unsigned char *  bytes,
size_t  byte_length,
size_t  word_list_length = 1626,
size_t  bytes_per_chunk = 4,
size_t  words_per_chunk = 3 
)

Returns the indices of a seed phrase.

Parameters
bytesthe bytes to convert
byte_lengththe length of the bytes
word_list_lengththe length of the word list, monero wordlist length is 1626
bytes_per_chunkthe number of bytes per chunk, monero uses 4 bytes per chunk is electrum default
words_per_chunkthe number of words per chunk, monero uses 3 words per chunk is electrum default
Returns
the seed indices
Exceptions
ots::exception::seed::LengthMismatchIf more bits provided than needed

◆ splitString()

std::vector< std::string > ots::splitString ( const std::string &  input,
const std::string &  separator = "",
size_t  fixedWidth = 4 
)

Converts a string by a separator or fixed 4 char width.

Parameters
inputthe string to split
separatorthe separator to split the string, if empty the fixed width is used
fixedWidththe fixed width to split the string, by default 4 chars
Returns
the vector of strings

◆ utf8_nfc()

size_t ots::utf8_nfc ( const char *  str,
polyseed_str  norm 
)

provides utf8 normalization to polyseed library at the moment utf8proc is used, because it seems that boost::locale will drag more dependencies with in.

See also
ots/external/utf8proc
Parameters
strinput string
[out]normoutput normalized string, esentially it is char[360]
See also
https://github.com/tevador/polyseed/blob/dfb05d8edb682b0e8f743b1b70c9131712ff4157/include/polyseed.h#L23

◆ utf8_nfkd()

size_t ots::utf8_nfkd ( const char *  str,
polyseed_str  norm 
)

provides utf8 normalization to polyseed library, uses also utf8proc

See also
ots/external/utf8proc
Parameters
strinput string
[out]normoutput normalized string, esentially it is char[360]
See also
https://github.com/tevador/polyseed/blob/dfb05d8edb682b0e8f743b1b70c9131712ff4157/include/polyseed.h#L23

Variable Documentation

◆ NETWORK_DATA_MAP

const std::map< ots::Network, ots::data::NetworkData > ots::NETWORK_DATA_MAP
Initial value:
= {
{Network::MAIN, ots::data::MAINNET_DATA},
{Network::TEST, ots::data::TESTNET_DATA},
{Network::STAGE, ots::data::STAGENET_DATA}
}
static const NetworkData MAINNET_DATA
Definition data.hpp:40
static const NetworkData STAGENET_DATA
Definition data.hpp:54
static const NetworkData TESTNET_DATA
Definition data.hpp:47