class ClientSecret

Defined at line 25 of file ../../third_party/cobalt/src/system_data/client_secret.h

A ClientSecret is a wrapper around an array of bytes containing

random bytes from a CSPRNG. Clients should invoke GenerateNewSecret()

once, and then permanently and securely save the token returned by

GetToken(). After that clients should reconstruct the token using

FromToken().

Tokens are passed into several different methods in the Encoder API.

Public Members

static const size_t kNumSecretBytes

Public Methods

void ClientSecret (ClientSecret && other)

Move constructor

Defined at line 28 of file ../../third_party/cobalt/src/system_data/client_secret.h

void ClientSecret (const ClientSecret & other)

Copy constructor

Defined at line 31 of file ../../third_party/cobalt/src/system_data/client_secret.h

ClientSecret GenerateNewSecret ()

Returns a ClientSecret with freshly generated bytes.

ClientSecret FromToken (const std::string & token)

Returns a ClientSecret with bytes decoded from |token|. If token is not

valid then the returned ClientSecret will have valid() == false.

std::string GetToken ()

Returns a token that may be used to reconstitute this ClientSecret

using the FromToken() function. Returns the empty string if this

ClientSecret is not valid.

This method is not thread safe.

ClientSecret GenerateNewSecret (crypto::Random * rand)

For internal testing use only. Does not take ownership of |rand|.

Uses |rand| to generate the new secret.

bool operator== (const ClientSecret & other)

Defined at line 33 of file ../../third_party/cobalt/src/system_data/client_secret.h

bool operator!= (const ClientSecret & other)

Defined at line 40 of file ../../third_party/cobalt/src/system_data/client_secret.h

bool valid ()

Is this ClientSecret valid? An invalid ClientSecret may occur when an

invalid token is passed to FromToken(), or after a move occurs.

Defined at line 51 of file ../../third_party/cobalt/src/system_data/client_secret.h

const byte * data ()

Defined at line 60 of file ../../third_party/cobalt/src/system_data/client_secret.h