aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-05-16 08:13:26 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-05-16 08:13:28 +0200
commit4254486345167d4800f4a8f2a9b84975f0a4c886 (patch)
treeafb6fcd6d2110b8f86acc9559d728706e767ac05 /src
parentba8631c5f75df45fb07726e0aab3bb0834d6a5b6 (diff)
Return stored node users decrypted as hash map instead of vector
Diffstat (limited to 'src')
-rw-r--r--src/Database.cpp2
-rw-r--r--src/DatabaseStorage.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Database.cpp b/src/Database.cpp
index 5b3f705..8529811 100644
--- a/src/Database.cpp
+++ b/src/Database.cpp
@@ -661,7 +661,7 @@ namespace odhtdb
return databaseStorage.storeUserPasswordEncrypted(nodeHash, username, password, keyPair);
}
- vector<NodeUserKeyPair> Database::getStoredUserNodeDataDecrypted(const string &username, const string &password)
+ MapHash<Signature::KeyPair> Database::getStoredUserNodeDataDecrypted(const string &username, const string &password)
{
return databaseStorage.getStoredUserNodeDataDecrypted(username, password);
}
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)
{