From 4254486345167d4800f4a8f2a9b84975f0a4c886 Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> Date: Wed, 16 May 2018 08:13:26 +0200 Subject: Return stored node users decrypted as hash map instead of vector --- src/DatabaseStorage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/DatabaseStorage.cpp') 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 DatabaseStorage::getStoredUserNodeDataDecrypted(const string &username, const string &password) + MapHash 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 result; + MapHash 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) { -- cgit v1.2.3