aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-05-16 09:47:31 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-05-16 09:47:34 +0200
commit7f19b686cc7b47346ba8bab89bb34188f366db10 (patch)
treed36db4f2cecdd572dfc49ae378be393d0c1744ca /tests
parent6d0eace64b37098e31c20758b066d4fe23c58a5c (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
{