aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-16 09:47:31 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-18 23:25:46 +0200
commit97c9ff702f002925dcd33869d0e22eda18390e2e (patch)
tree88096d36e2b20d63ff3e5add42a7053c5b85c8a5 /tests
parent2326b2da65624e921ee79b56324c59de4a885fde (diff)
Store node encryption key with user data, fix encryption bug when using additional data
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 3f9bbf9..e4438e7 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -205,10 +205,10 @@ int main()
if(database.doesStoredUserExist(username))
fail("Expected stored to not exist until it has been added");
- database.storeUserPasswordEncrypted(*databaseNode.getRequestHash(), username, password, *adminUserKey);
+ database.storeNodeInfoForUserEncrypted(databaseNode, username, password, *adminUserKey);
try
{
- database.storeUserPasswordEncrypted(*databaseNode.getRequestHash(), username, password, localUserKeyPair);
+ database.storeNodeInfoForUserEncrypted(databaseNode, username, password, localUserKeyPair);
fail("Expected store user password to fail since we have already stored an user in the node");
}
catch(SqlExecException &e)
@@ -219,15 +219,17 @@ int main()
if(!database.doesStoredUserExist(username))
fail("Expected stored to exist after it has been added");
- auto nodeUserData = database.getStoredUserNodeDataDecrypted(username, password);
+ auto nodeUserData = database.getStoredNodeUserInfoDecrypted(username, password);
assertEquals((size_t)1, nodeUserData.size());
auto userDataIt = nodeUserData.find(*databaseNode.getRequestHash());
if(userDataIt == nodeUserData.end())
fail("Expected stored node hash to match node hash");
- if(userDataIt->second.getPublicKey() != adminUserKey->getPublicKey())
+ if(userDataIt->second.userKeyPair->getPublicKey() != adminUserKey->getPublicKey())
fail("Expected stored public key to match admin user public key");
- if(userDataIt->second.getPrivateKey() != adminUserKey->getPrivateKey())
+ if(userDataIt->second.userKeyPair->getPrivateKey() != adminUserKey->getPrivateKey())
fail("Expected stored private key to match admin user private key");
+ if(userDataIt->second.nodeEncryptionKey->getView() != databaseCreateResponse->getNodeEncryptionKey()->getView())
+ fail("Expected stored node encryption key to match node encryption key");
try
{