add pubkey cache

This commit is contained in:
DenioD
2020-06-01 22:21:17 +02:00
parent 21c727efb0
commit 74de61d265
5 changed files with 59 additions and 7 deletions

View File

@@ -260,6 +260,8 @@ void ChatModel::addHeader(QString tx, QString headerbytes)
this->headerMap[tx] = headerbytes;
}
void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
{
this->requestZaddrMap[tx] = requestZaddr;
@@ -285,6 +287,9 @@ QString ChatModel::getCidByTx(QString tx)
return QString("0xdeadbeef");
}
QString ChatModel::getHeaderByTx(QString tx)
{
for(auto& pair : this->headerMap)
@@ -415,7 +420,7 @@ Tx MainWindow::createTxFromChatPage() {
QString pubkey = "test";
QString pubkey = this->getPubkeyByAddress(addr);
QString passphrase = this->getPassword();
QString hashEncryptionKey = passphrase;
int length = hashEncryptionKey.length();
@@ -474,8 +479,9 @@ Tx MainWindow::createTxFromChatPage() {
////Create the HM for this message
QString headerbytes = QByteArray(reinterpret_cast<const char*>(header), crypto_secretstream_xchacha20poly1305_HEADERBYTES).toHex();
QString publickeyAlice = QByteArray(reinterpret_cast<const char*>(pk), crypto_kx_PUBLICKEYBYTES).toHex();
QString hmemo= createHeaderMemo(type,cid,myAddr,"",headerbytes);
QString hmemo= createHeaderMemo(type,cid,myAddr,publickeyAlice,headerbytes);
/////Ciphertext Memo
QString memo = QByteArray(reinterpret_cast<const char*>(ciphertext), CIPHERTEXT_LEN).toHex();
@@ -751,6 +757,8 @@ Tx MainWindow::createTxForSafeContactRequest()
QString publicKey = QByteArray(reinterpret_cast<const char*>(pk), crypto_kx_PUBLICKEYBYTES).toHex();
qDebug()<<"Publickey created Request: "<<publicKey;
QString hmemo= createHeaderMemo(type,cid,myAddr,"", publicKey);