mirror of
https://github.com/ChronosX88/Influence-P2P.git
synced 2024-11-25 00:22:17 +00:00
Added message entry protecting
This commit is contained in:
parent
07285c4845
commit
6670715418
@ -15,6 +15,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import io.github.chronosx88.influence.contracts.chatactivity.IChatLogicContract;
|
import io.github.chronosx88.influence.contracts.chatactivity.IChatLogicContract;
|
||||||
import io.github.chronosx88.influence.helpers.AppHelper;
|
import io.github.chronosx88.influence.helpers.AppHelper;
|
||||||
|
import io.github.chronosx88.influence.helpers.KeyPairManager;
|
||||||
import io.github.chronosx88.influence.helpers.LocalDBWrapper;
|
import io.github.chronosx88.influence.helpers.LocalDBWrapper;
|
||||||
import io.github.chronosx88.influence.helpers.ObservableUtils;
|
import io.github.chronosx88.influence.helpers.ObservableUtils;
|
||||||
import io.github.chronosx88.influence.helpers.P2PUtils;
|
import io.github.chronosx88.influence.helpers.P2PUtils;
|
||||||
@ -32,6 +33,7 @@ public class ChatLogic implements IChatLogicContract {
|
|||||||
private String newMessage = "";
|
private String newMessage = "";
|
||||||
private ChatEntity chatEntity;
|
private ChatEntity chatEntity;
|
||||||
private Thread checkNewMessagesThread = null;
|
private Thread checkNewMessagesThread = null;
|
||||||
|
private KeyPairManager keyPairManager;
|
||||||
|
|
||||||
public ChatLogic(ChatEntity chatEntity) {
|
public ChatLogic(ChatEntity chatEntity) {
|
||||||
this.chatEntity = chatEntity;
|
this.chatEntity = chatEntity;
|
||||||
@ -44,6 +46,7 @@ public class ChatLogic implements IChatLogicContract {
|
|||||||
};
|
};
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
timer.schedule(timerTask, 1, 1000);
|
timer.schedule(timerTask, 1, 1000);
|
||||||
|
this.keyPairManager = new KeyPairManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,6 +58,7 @@ public class ChatLogic implements IChatLogicContract {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
data.protectEntry(keyPairManager.getKeyPair("mainKeyPair"));
|
||||||
P2PUtils.put(chatID + "_messages" + chatEntity.chunkCursor, message.messageID, data);
|
P2PUtils.put(chatID + "_messages" + chatEntity.chunkCursor, message.messageID, data);
|
||||||
try {
|
try {
|
||||||
P2PUtils.put(chatID + "_newMessage", null, new Data(message.messageID));
|
P2PUtils.put(chatID + "_newMessage", null, new Data(message.messageID));
|
||||||
|
Loading…
Reference in New Issue
Block a user