aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f8820f3..776db5c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -485,11 +485,11 @@ int main(int argc, char **argv)
encryptionKey->getView());
if(decryptedMsg.getDecryptedText().size != odhtdb::ENCRYPTION_KEY_BYTE_SIZE + odhtdb::PUBLIC_KEY_NUM_BYTES)
{
- fprintf(stderr, "Invite response was of unexpected size, maybe it wasn't mean for us?\n");
+ fprintf(stderr, "Invite response was of unexpected size, maybe it wasn't meant for us?\n");
return true;
}
- odhtdb::DataView channelEncryptionKey(decryptedMsg.getDecryptedText().data, odhtdb::ENCRYPTION_KEY_BYTE_SIZE);
+ odhtdb::DataView channelEncryptionKeyRaw(decryptedMsg.getDecryptedText().data, odhtdb::ENCRYPTION_KEY_BYTE_SIZE);
odhtdb::DataView invitedUserPublicKey((u8*)decryptedMsg.getDecryptedText().data + odhtdb::ENCRYPTION_KEY_BYTE_SIZE, odhtdb::PUBLIC_KEY_NUM_BYTES);
if(memcmp(keyPair->getPublicKey().getData(), invitedUserPublicKey.data, odhtdb::PUBLIC_KEY_NUM_BYTES) != 0)
{
@@ -497,7 +497,9 @@ int main(int argc, char **argv)
return true;
}
- odhtdb::DatabaseNode databaseNode(encryptionKey, nodeHash);
+ shared_ptr<odhtdb::OwnedByteArray> channelEncryptionKey = make_shared<odhtdb::OwnedByteArray>(new u8[channelEncryptionKeyRaw.size], channelEncryptionKeyRaw.size);
+ memcpy(channelEncryptionKey->data, channelEncryptionKeyRaw.data, channelEncryptionKeyRaw.size);
+ odhtdb::DatabaseNode databaseNode(channelEncryptionKey, nodeHash);
database->storeNodeInfoForUserEncrypted(databaseNode, currentUsername, currentPassword, *keyPair);
printf("Got a response from a person in the channel, we might get added...\n");
waitingToJoinChannels.push_back(databaseNode);