libkazv
Kazv::Session Class Reference

#include <session.hpp>

Public Member Functions

 Session ()
 
 Session (const Session &that)
 
 Session (Session &&that)
 
Sessionoperator= (const Session &that)
 
Sessionoperator= (Session &&that)
 
 ~Session ()
 
bool matches (std::string message)
 
bool valid () const
 
MaybeString decrypt (int type, std::string message)
 
std::size_t encryptRandomSize () const
 
std::pair< int, std::string > encrypt (std::string plainText)
 
std::pair< int, std::string > encryptWithRandom (RandomData random, std::string plainText)
 Encrypt plainText. More...
 

Friends

class Crypto
 
class CryptoPrivate
 
class SessionPrivate
 
void to_json (nlohmann::json &j, const Session &s)
 
void from_json (const nlohmann::json &j, Session &s)
 

Constructor & Destructor Documentation

◆ Session() [1/3]

Kazv::Session::Session ( )
explicit

◆ Session() [2/3]

Kazv::Session::Session ( const Session that)

◆ Session() [3/3]

Kazv::Session::Session ( Session &&  that)

◆ ~Session()

Kazv::Session::~Session ( )
default

Member Function Documentation

◆ decrypt()

MaybeString Kazv::Session::decrypt ( int  type,
std::string  message 
)

◆ encrypt()

std::pair< int, std::string > Kazv::Session::encrypt ( std::string  plainText)

◆ encryptRandomSize()

std::size_t Kazv::Session::encryptRandomSize ( ) const
Returns
The size of random data needed for the next encryption.

◆ encryptWithRandom()

std::pair< int, std::string > Kazv::Session::encryptWithRandom ( RandomData  random,
std::string  plainText 
)

Encrypt plainText.

Parameters
randomThe random data needed for the encryption. Must be of at least size encryptRandomSize().
plainTextThe plain text to encrypt.
Returns
A pair containing the type and encrypted message string.

◆ matches()

bool Kazv::Session::matches ( std::string  message)

◆ operator=() [1/2]

Session & Kazv::Session::operator= ( const Session that)

◆ operator=() [2/2]

Session & Kazv::Session::operator= ( Session &&  that)

◆ valid()

bool Kazv::Session::valid ( ) const

Friends And Related Function Documentation

◆ Crypto

friend class Crypto
friend

◆ CryptoPrivate

friend class CryptoPrivate
friend

◆ from_json

void from_json ( const nlohmann::json j,
Session s 
)
friend

◆ SessionPrivate

friend class SessionPrivate
friend

◆ to_json

void to_json ( nlohmann::json j,
const Session s 
)
friend

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