iota.lib.cpp
IOTA C++ Library
Public Member Functions | Static Public Member Functions | List of all members
IOTA::Models::Seed Class Reference

#include <seed.hpp>

Public Member Functions

 Seed (const Types::Trytes &seed="", int security=2)
 
 Seed (const char *seed, int security=2)
 
 ~Seed ()=default
 
const Types::Trytes & toTrytes () const
 
void setSeed (const Types::Trytes &seed)
 
void setSecurity (int security)
 
int getSecurity () const
 
Models::Address newAddress (int32_t index, int32_t security=0) const
 
bool operator== (const Seed &rhs) const
 
bool operator!= (const Seed &rhs) const
 
bool operator== (const Types::Trytes &rhs) const
 
bool operator!= (const Types::Trytes &rhs) const
 

Static Public Member Functions

static Seed generateRandomSeed ()
 
static Models::Address newAddress (const Models::Seed &seed, int32_t index, int32_t security=0)
 

Detailed Description

Used to store seeds. Provides validity checks at construction / value set. Any seeds stored represented with this class are ensured to be valid.

Constructor & Destructor Documentation

◆ Seed() [1/2]

IOTA::Models::Seed::Seed ( const Types::Trytes &  seed = "",
int  security = 2 
)

Ctor.

Parameters
seedthe seed value. It must be a valid seed.
securitySecurity level of the seed. Must be between 1 (low, fast) and 3 (high slow).

◆ Seed() [2/2]

IOTA::Models::Seed::Seed ( const char *  seed,
int  security = 2 
)

Ctor, char* based to make implicitly convertion to Seed more flexible.

Parameters
seedthe seed value. It must be a valid seed.
securitySecurity level of the seed. Must be between 1 (low, fast) and 3 (high slow).

◆ ~Seed()

IOTA::Models::Seed::~Seed ( )
default

Default dtor.

Member Function Documentation

◆ generateRandomSeed()

static Seed IOTA::Models::Seed::generateRandomSeed ( )
static

Generate seed randomly

Returns
generated seed

◆ getSecurity()

int IOTA::Models::Seed::getSecurity ( ) const
Returns
the security level of the seed

◆ newAddress() [1/2]

Models::Address IOTA::Models::Seed::newAddress ( int32_t  index,
int32_t  security = 0 
) const

Generates a new address.

Parameters
indexThe index to start the generation from.
securityIf set to 0, use the seed security. Otherwise, use the specified security.
Returns
A new address.

◆ newAddress() [2/2]

static Models::Address IOTA::Models::Seed::newAddress ( const Models::Seed seed,
int32_t  index,
int32_t  security = 0 
)
static

Generates a new address.

Parameters
seedThe tryte-encoded seed.
indexThe index to start search from.
securityIf set to 0, use the seed security. Otherwise, use the specified security.
Returns
A new address.

◆ operator!=() [1/2]

bool IOTA::Models::Seed::operator!= ( const Seed rhs) const

Comparison operator.

Parameters
rhsother object to compare with.
Returns
Whether the two transactions are equal or not.

◆ operator!=() [2/2]

bool IOTA::Models::Seed::operator!= ( const Types::Trytes &  rhs) const

Comparison operator, trytes-based for convenient use

Parameters
rhsother object to compare with.
Returns
Whether the two transactions are equal or not.

◆ operator==() [1/2]

bool IOTA::Models::Seed::operator== ( const Seed rhs) const

Comparison operator.

Parameters
rhsother object to compare with.
Returns
Whether the two transactions are equal or not.

◆ operator==() [2/2]

bool IOTA::Models::Seed::operator== ( const Types::Trytes &  rhs) const

Comparison operator, trytes-based for convenient use

Parameters
rhsother object to compare with.
Returns
Whether the two transactions are equal or not.

◆ setSecurity()

void IOTA::Models::Seed::setSecurity ( int  security)

Set the seed security. Must be between 1 (low, fast) and 3 (high slow).

Parameters
securitythe new security level of the seed.

◆ setSeed()

void IOTA::Models::Seed::setSeed ( const Types::Trytes &  seed)

Set the seed value

Parameters
seedthe seed value. It must be a valid seed.

◆ toTrytes()

const Types::Trytes& IOTA::Models::Seed::toTrytes ( ) const
Returns
seed as a trytes string, without the checksum

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