DiceKeys Seeded Cryptography Library
|
A secret derived from a seed string and set of options in JSON Format for Recipes. More...
#include <password.hpp>
Public Member Functions | |
Password (const Password &other) | |
Construct this object as a copy of another object. More... | |
Password (const std::string &password, const std::string &recipe={}) | |
const std::string | toJson (int indent=-1, const char indent_char=' ') const |
Serialize this object to a JSON-formatted string. More... | |
const SodiumBuffer | toSerializedBinaryForm () const |
Serialize to byte array as a list of: (secretBytes, recipe) More... | |
Static Public Member Functions | |
static Password | deriveFromSeedAndWordList (const std::string &seedString, const std::string &recipe, const std::string &wordListAsSingleString) |
Derive a secret from a seed secret and a set of recipe in JSON Format for Recipes. More... | |
static Password | deriveFromSeed (const std::string &seedString, const std::string &recipe) |
static Password | fromSerializedBinaryForm (const SodiumBuffer &serializedBinaryForm) |
Deserialize from a byte array stored as a list of: (secretBytes, recipe) More... | |
static Password | fromJson (const std::string &seedAsJson) |
Construct (reconstitute) a Password from its JSON representation. More... | |
Public Attributes | |
const std::string | password |
The binary representation of the password. | |
const std::string | recipe |
A string in JSON Format for Recipes string which specifies how the constructor will derive the secretBytes from the original secret seed. | |
A secret derived from a seed string and set of options in JSON Format for Recipes.
Because the secret is derived using a one-way function, its value does not reveal the secret seed used to derive it. Rather, clients can use this secret knowing that, if lost, it can be re-derived from the same seed and recipe that were first used to derive it.
Password::Password | ( | const Password & | other | ) |
Construct this object as a copy of another object.
other | The Password to copy into this new object |
Password::Password | ( | const std::string & | password, |
const std::string & | recipe = {} |
||
) |
Construct a secret from its two fields: the secretBytes and the recipe.
secretBytes | The derived secret. |
password | The derived password |
recipe | The recipe in JSON Format for Recipes. |
|
static |
Derive a secret from a seed secret and a set of recipe in JSON Format for Recipes.
seedString | The secret seed string from which this secret should be derived. Once the secret is derived, you won't need the secretSeedBytes again unless you need to re-derive this secret. |
recipe | The recipe in JSON Format for Recipes. |
wordListAsSingleString | The word list to use to generate the password, with words separated by any number of non-alphabetic characters. This allows word lists to be tab-delimited, comma-delimited, line-delimited, or any combination thereof. |
|
static |
|
static |
Deserialize from a byte array stored as a list of: (secretBytes, recipe)
Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.
const std::string Password::toJson | ( | int | indent = -1 , |
const char | indent_char = ' ' |
||
) | const |
Serialize this object to a JSON-formatted string.
It can be reconstituted by calling the constructor with this string.
indent | The number of characters to indent the JSON (optional) |
indent_char | The character with which to indent the JSON (optional) |
const SodiumBuffer Password::toSerializedBinaryForm | ( | ) | const |
Serialize to byte array as a list of: (secretBytes, recipe)
Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.