Store encrypted company password hashes in server saves

Restore when loading back into the server if server has required secret
This commit is contained in:
Jonathan G Rennison
2022-01-03 03:09:32 +00:00
parent 1f50106466
commit e993afcd99
9 changed files with 188 additions and 10 deletions

View File

@@ -8,6 +8,10 @@
[pre-amble]
static bool ReplaceAsteriskWithEmptyPassword(std::string &newval);
static bool IsValidHex128BitKeyString(std::string &newval);
static bool IsValidHex256BitKeyString(std::string &newval);
static void ParseCompanyPasswordStorageToken(const std::string &value);
static void ParseCompanyPasswordStorageSecret(const std::string &value);
static const SettingTable _network_secrets_settings = {
[post-amble]
@@ -99,3 +103,23 @@ type = SLE_STR
length = NETWORK_INVITE_CODE_SECRET_LENGTH
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY
def = nullptr
[SDTC_SSTR]
var = network.company_password_storage_token
type = SLE_STR
length = 33
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY | SF_RUN_CALLBACKS_ON_PARSE
def = nullptr
pre_cb = IsValidHex128BitKeyString
post_cb = ParseCompanyPasswordStorageToken
startup = true
[SDTC_SSTR]
var = network.company_password_storage_secret
type = SLE_STR
length = 65
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY | SF_RUN_CALLBACKS_ON_PARSE
def = nullptr
pre_cb = IsValidHex256BitKeyString
post_cb = ParseCompanyPasswordStorageSecret
startup = true