diff options
author | lookshe <github@lookshe.org> | 2016-03-06 19:42:55 +0100 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2016-03-06 19:42:55 +0100 |
commit | 3c400703e082a1b180b35d891b8fb3460c7d5b87 (patch) | |
tree | 28738dd90fc41b4ab71897f38d324828778ad2e3 /src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java | |
parent | 72114d732427266024cdd6e27cd8d1aa60afae2f (diff) | |
parent | f28d77dc42f6bac5a026e0b1c78562dee8de45ac (diff) |
Merge branch 'trz/rebase' into trz/rename
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java new file mode 100644 index 00000000..987cf940 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/crypto/axolotl/AxolotlService.java @@ -0,0 +1,110 @@ +package de.thedevstack.conversationsplus.crypto.axolotl; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import org.whispersystems.libaxolotl.AxolotlAddress; +import org.whispersystems.libaxolotl.IdentityKey; +import org.whispersystems.libaxolotl.state.PreKeyRecord; +import org.whispersystems.libaxolotl.state.SignedPreKeyRecord; + +import java.security.cert.X509Certificate; +import java.util.Set; + +import de.thedevstack.conversationsplus.entities.Account; +import de.thedevstack.conversationsplus.entities.Contact; +import de.thedevstack.conversationsplus.entities.Conversation; +import de.thedevstack.conversationsplus.entities.Message; +import de.thedevstack.conversationsplus.xmpp.OnAdvancedStreamFeaturesLoaded; +import de.thedevstack.conversationsplus.xmpp.jid.Jid; + +/** + * Created by tzur on 02.03.2016. + */ +public interface AxolotlService extends OnAdvancedStreamFeaturesLoaded { + + String LOGPREFIX = "AxolotlService"; + + String PEP_PREFIX = "eu.siacs.conversations.axolotl"; + String PEP_DEVICE_LIST = PEP_PREFIX + ".devicelist"; + String PEP_BUNDLES = PEP_PREFIX + ".bundles"; + String PEP_VERIFICATION = PEP_PREFIX + ".verification"; + + enum FetchStatus { + PENDING, + SUCCESS, + SUCCESS_VERIFIED, + TIMEOUT, + ERROR + } + + boolean fetchMapHasErrors(Contact contact); + + String getOwnFingerprint(); + + Set<IdentityKey> getKeysWithTrust(XmppAxolotlSession.Trust trust); + + Set<IdentityKey> getKeysWithTrust(XmppAxolotlSession.Trust trust, Contact contact); + + long getNumTrustedKeys(Contact contact); + + Set<String> getFingerprintsForOwnSessions(); + + Set<String> getFingerprintsForContact(Contact contact); + + boolean isPepBroken(); + + void regenerateKeys(boolean wipeOther); + + int getOwnDeviceId(); + + Set<Integer> getOwnDeviceIds(); + + void registerDevices(Jid jid, @NonNull Set<Integer> deviceIds); + + void wipeOtherPepDevices(); + + void purgeKey(String fingerprint); + + void publishOwnDeviceIdIfNeeded(); + + void publishOwnDeviceId(Set<Integer> deviceIds); + + void publishDeviceVerificationAndBundle(SignedPreKeyRecord signedPreKeyRecord, + Set<PreKeyRecord> preKeyRecords, + boolean announceAfter, + boolean wipe); + + void publishBundlesIfNeeded(boolean announce, boolean wipe); + + boolean isContactAxolotlCapable(Contact contact); + + XmppAxolotlSession.Trust getFingerprintTrust(String fingerprint); + + X509Certificate getFingerprintCertificate(String fingerprint); + + void setFingerprintTrust(String fingerprint, XmppAxolotlSession.Trust trust); + + Set<AxolotlAddress> findDevicesWithoutSession(Conversation conversation); + + Set<AxolotlAddress> findDevicesWithoutSession(Jid contactJid); + + boolean createSessionsIfNeeded(Conversation conversation); + + boolean trustedSessionVerified(Conversation conversation); + + boolean hasPendingKeyFetches(Account account, Contact contact); + + @Nullable + XmppAxolotlMessage encrypt(Message message); + + void preparePayloadMessage(Message message, boolean delay); + + void prepareKeyTransportMessage(Contact contact, OnMessageCreatedCallback onMessageCreatedCallback); + + XmppAxolotlMessage fetchAxolotlMessageFromCache(Message message); + + XmppAxolotlMessage.XmppAxolotlPlaintextMessage processReceivingPayloadMessage(XmppAxolotlMessage message); + + XmppAxolotlMessage.XmppAxolotlKeyTransportMessage processReceivingKeyTransportMessage(XmppAxolotlMessage message); +} |