diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-16 08:13:26 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | e81a274f8b330005401c52bc281f5efeee05e116 (patch) | |
tree | 18a197312f7980eaccebd31366b064edabcbfd8b /src/DatabaseStorage.cpp | |
parent | 92d6393a34dac4b3d623a5169e2b50a9518b4976 (diff) |
Return stored node users decrypted as hash map instead of vector
Diffstat (limited to 'src/DatabaseStorage.cpp')
-rw-r--r-- | src/DatabaseStorage.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/DatabaseStorage.cpp b/src/DatabaseStorage.cpp index ed190e8..7b316f7 100644 --- a/src/DatabaseStorage.cpp +++ b/src/DatabaseStorage.cpp @@ -923,13 +923,13 @@ namespace odhtdb transaction.commit(); } - vector<NodeUserKeyPair> DatabaseStorage::getStoredUserNodeDataDecrypted(const string &username, const string &password) + MapHash<Signature::KeyPair> DatabaseStorage::getStoredUserNodeDataDecrypted(const string &username, const string &password) { OwnedMemory hashedPassword = hashPassword(DataView((void*)password.data(), password.size()), DataView((void*)passwordSalt, PASSWORD_SALT_LEN)); DataView hashedPasswordView(hashedPassword.data, hashedPassword.size); i64 encryptedUserRowId = getStoredUserId(username, hashedPasswordView); - vector<NodeUserKeyPair> result; + MapHash<Signature::KeyPair> result; SqlQuery query(sqliteDb, "SELECT node, userPublicKey, nonce, userPrivateKeyEncrypted FROM NodeEncryptedUserData WHERE usernameId = ?", { encryptedUserRowId }); while(query.next()) { @@ -947,7 +947,7 @@ namespace odhtdb Decryption decryptedStoredPrivateKey(storedPrivateKeyEncrypted, storedNonce, hashedPasswordView); Signature::PrivateKey userPrivateKey((const char*)decryptedStoredPrivateKey.getDecryptedText().data, decryptedStoredPrivateKey.getDecryptedText().size); Signature::KeyPair keyPair(userPublicKey, userPrivateKey); - result.push_back({ nodeHash, keyPair }); + result[nodeHash] = keyPair; } catch(DecryptionException &e) { |