Offline Transaction Signing (OTS) 0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ots::SeedIndices Class Reference

Secure container for seed word indices. More...

#include <ots.hpp>

Public Member Functions

 SeedIndices () noexcept=default
 Default constructor.
 
 SeedIndices (const std::vector< uint16_t > &v)
 Construct from std::vector.
 
 SeedIndices (size_t size)
 Construct with size.
 
 SeedIndices (size_t size, uint16_t value)
 Construct with size and value.
 
 SeedIndices (const SeedIndices &other)
 Copy constructor.
 
 SeedIndices (SeedIndices &&other) noexcept
 Move constructor.
 
SeedIndicesoperator= (const SeedIndices &other)
 Copy assignment operator.
 
SeedIndicesoperator= (SeedIndices &&other) noexcept
 Move assignment operator.
 
 operator const uint8_t * () const noexcept
 conversion to const uint8_t*,
 
 operator const char * () const noexcept
 conversion to const char*,
 
 operator const std::vector< uint16_t > & () const noexcept
 conversion to const std::vector<uint16_t>&
 
 operator const std::string () const noexcept
 Conversion to std::string.
 
bool operator== (const SeedIndices &other) const noexcept
 compare operator
 
bool operator== (const std::vector< uint16_t > &other) const noexcept
 compare to vector
 
bool operator!= (const SeedIndices &other) const noexcept
 compare operator
 
bool operator!= (const std::vector< uint16_t > &other) const noexcept
 compare to vector
 
const std::string numeric (const std::string &separator="") const noexcept
 Get numeric representation 4 digits per 2 bytes concatenated without separator.
 
const std::string hex (const std::string &separator="") const noexcept
 Get hex representation 4 digits per 2 bytes concatenated without separator.
 
 ~SeedIndices ()
 Destructor that wipes memory.
 
size_t size () const noexcept
 Get vector size.
 
bool empty () const noexcept
 Check if vector is empty.
 
void clear () noexcept
 Clear indices.
 
void reserve (size_t n)
 Reserve elements.
 
void shrink_to_fit ()
 shrink to fit
 
uint16_t & operator[] (size_t pos)
 Element access.
 
const uint16_t & operator[] (size_t pos) const
 
uint16_t & at (size_t pos)
 
const uint16_t & at (size_t pos) const
 
void push_back (uint16_t value)
 Add index.
 
uint16_t emplace_back (uint16_t value)
 Add index.
 
auto begin () noexcept
 Iterator support.
 
auto end () noexcept
 Iterator support.
 
auto begin () const noexcept
 Iterator support.
 
auto end () const noexcept
 Iterator support.
 
auto cbegin () const noexcept
 Iterator support.
 
auto cend () const noexcept
 Iterator support.
 

Static Public Member Functions

static SeedIndices fromNumeric (const std::string &numeric, const std::string &separator="")
 Create SeedIndices from numeric representation.
 
static SeedIndices fromHex (const std::string &hex, const std::string &separator="")
 Create SeedIndices from hex representation.
 

Detailed Description

Secure container for seed word indices.

Note
Memory is automatically wiped on destruction

Constructor & Destructor Documentation

◆ SeedIndices() [1/6]

ots::SeedIndices::SeedIndices ( )
defaultnoexcept

Default constructor.

◆ SeedIndices() [2/6]

ots::SeedIndices::SeedIndices ( const std::vector< uint16_t > &  v)
inlineexplicit

Construct from std::vector.

◆ SeedIndices() [3/6]

ots::SeedIndices::SeedIndices ( size_t  size)
inlineexplicit

Construct with size.

◆ SeedIndices() [4/6]

ots::SeedIndices::SeedIndices ( size_t  size,
uint16_t  value 
)
inline

Construct with size and value.

◆ SeedIndices() [5/6]

ots::SeedIndices::SeedIndices ( const SeedIndices other)
inline

Copy constructor.

◆ SeedIndices() [6/6]

ots::SeedIndices::SeedIndices ( SeedIndices &&  other)
inlinenoexcept

Move constructor.

◆ ~SeedIndices()

ots::SeedIndices::~SeedIndices ( )

Destructor that wipes memory.

Member Function Documentation

◆ at() [1/2]

uint16_t & ots::SeedIndices::at ( size_t  pos)

◆ at() [2/2]

const uint16_t & ots::SeedIndices::at ( size_t  pos) const

◆ begin() [1/2]

auto ots::SeedIndices::begin ( ) const
inlinenoexcept

Iterator support.

◆ begin() [2/2]

auto ots::SeedIndices::begin ( )
inlinenoexcept

Iterator support.

◆ cbegin()

auto ots::SeedIndices::cbegin ( ) const
inlinenoexcept

Iterator support.

◆ cend()

auto ots::SeedIndices::cend ( ) const
inlinenoexcept

Iterator support.

◆ clear()

void ots::SeedIndices::clear ( )
noexcept

Clear indices.

◆ emplace_back()

uint16_t ots::SeedIndices::emplace_back ( uint16_t  value)

Add index.

◆ empty()

bool ots::SeedIndices::empty ( ) const
noexcept

Check if vector is empty.

◆ end() [1/2]

auto ots::SeedIndices::end ( ) const
inlinenoexcept

Iterator support.

◆ end() [2/2]

auto ots::SeedIndices::end ( )
inlinenoexcept

Iterator support.

◆ fromHex()

SeedIndices ots::SeedIndices::fromHex ( const std::string &  hex,
const std::string &  separator = "" 
)
static

Create SeedIndices from hex representation.

Parameters
hexhex representation of the seed
separatoroptional separator between the digits

◆ fromNumeric()

SeedIndices ots::SeedIndices::fromNumeric ( const std::string &  numeric,
const std::string &  separator = "" 
)
static

Create SeedIndices from numeric representation.

Parameters
numericnumeric representation of the seed
separatoroptional separator between the digits

◆ hex()

const std::string ots::SeedIndices::hex ( const std::string &  separator = "") const
noexcept

Get hex representation 4 digits per 2 bytes concatenated without separator.

Parameters
separatoroptional separator between the digits
Returns
hex representation of the seed

◆ numeric()

const std::string ots::SeedIndices::numeric ( const std::string &  separator = "") const
noexcept

Get numeric representation 4 digits per 2 bytes concatenated without separator.

Parameters
separatoroptional separator between the digits
Returns
numeric representation of the seed

◆ operator const char *()

ots::SeedIndices::operator const char * ( ) const
noexcept

conversion to const char*,

See also
size()

◆ operator const std::string()

ots::SeedIndices::operator const std::string ( ) const
noexcept

Conversion to std::string.

See also
numeric()

◆ operator const std::vector< uint16_t > &()

ots::SeedIndices::operator const std::vector< uint16_t > & ( ) const
noexcept

conversion to const std::vector<uint16_t>&

◆ operator const uint8_t *()

ots::SeedIndices::operator const uint8_t * ( ) const
noexcept

conversion to const uint8_t*,

See also
size()

◆ operator!=() [1/2]

bool ots::SeedIndices::operator!= ( const SeedIndices other) const
noexcept

compare operator

◆ operator!=() [2/2]

bool ots::SeedIndices::operator!= ( const std::vector< uint16_t > &  other) const
noexcept

compare to vector

◆ operator=() [1/2]

SeedIndices & ots::SeedIndices::operator= ( const SeedIndices other)

Copy assignment operator.

◆ operator=() [2/2]

SeedIndices & ots::SeedIndices::operator= ( SeedIndices &&  other)
noexcept

Move assignment operator.

◆ operator==() [1/2]

bool ots::SeedIndices::operator== ( const SeedIndices other) const
noexcept

compare operator

◆ operator==() [2/2]

bool ots::SeedIndices::operator== ( const std::vector< uint16_t > &  other) const
noexcept

compare to vector

◆ operator[]() [1/2]

uint16_t & ots::SeedIndices::operator[] ( size_t  pos)

Element access.

◆ operator[]() [2/2]

const uint16_t & ots::SeedIndices::operator[] ( size_t  pos) const

◆ push_back()

void ots::SeedIndices::push_back ( uint16_t  value)

Add index.

◆ reserve()

void ots::SeedIndices::reserve ( size_t  n)
inline

Reserve elements.

◆ shrink_to_fit()

void ots::SeedIndices::shrink_to_fit ( )
inline

shrink to fit

◆ size()

size_t ots::SeedIndices::size ( ) const
noexcept

Get vector size.


The documentation for this class was generated from the following files: