2020-06-13 19:14:38 +02:00
|
|
|
package org.mercury_im.messenger.core.data.repository;
|
|
|
|
|
|
|
|
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
2020-06-15 17:41:13 +02:00
|
|
|
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
|
2020-06-18 21:52:06 +02:00
|
|
|
import org.jivesoftware.smackx.ox.store.definition.OpenPgpTrustStore;
|
2020-06-13 19:14:38 +02:00
|
|
|
import org.jxmpp.jid.EntityBareJid;
|
2020-07-10 14:15:58 +02:00
|
|
|
import org.mercury_im.messenger.core.util.Optional;
|
2020-07-13 18:49:29 +02:00
|
|
|
import org.mercury_im.messenger.core.viewmodel.openpgp.FingerprintViewItem;
|
2020-06-18 21:52:06 +02:00
|
|
|
import org.pgpainless.key.OpenPgpV4Fingerprint;
|
|
|
|
|
|
|
|
import java.util.Date;
|
2020-06-26 16:00:47 +02:00
|
|
|
import java.util.List;
|
2020-06-18 21:52:06 +02:00
|
|
|
import java.util.Map;
|
|
|
|
import java.util.UUID;
|
2020-06-13 19:14:38 +02:00
|
|
|
|
2020-06-15 17:41:13 +02:00
|
|
|
import io.reactivex.Completable;
|
2020-06-26 16:00:47 +02:00
|
|
|
import io.reactivex.Observable;
|
2020-06-13 19:14:38 +02:00
|
|
|
import io.reactivex.Single;
|
|
|
|
|
|
|
|
public interface OpenPgpRepository {
|
|
|
|
|
2020-06-18 21:52:06 +02:00
|
|
|
Completable storePublicKeysOf(UUID accountId, EntityBareJid owner, PGPPublicKeyRingCollection keys);
|
|
|
|
|
|
|
|
Single<PGPPublicKeyRingCollection> loadPublicKeysOf(UUID accountId, EntityBareJid owner);
|
|
|
|
|
|
|
|
Single<Integer> deletePublicKeysOf(UUID accountId, EntityBareJid owner);
|
|
|
|
|
|
|
|
Completable storeSecretKeysOf(UUID accountId, EntityBareJid owner, PGPSecretKeyRingCollection keys);
|
|
|
|
|
|
|
|
Single<PGPSecretKeyRingCollection> loadSecretKeysOf(UUID accountId, EntityBareJid owner);
|
|
|
|
|
|
|
|
Single<Integer> deleteSecretKeysOf(UUID accountId, EntityBareJid owner);
|
|
|
|
|
|
|
|
Completable storePublicKeyFetchDates(UUID accountId, EntityBareJid owner, Map<OpenPgpV4Fingerprint, Date> dates);
|
2020-06-15 17:41:13 +02:00
|
|
|
|
2020-06-18 21:52:06 +02:00
|
|
|
Single<Map<OpenPgpV4Fingerprint, Date>> loadPublicKeyFetchDates(UUID accountId, EntityBareJid owner);
|
2020-06-15 17:41:13 +02:00
|
|
|
|
2020-06-18 21:52:06 +02:00
|
|
|
Completable storeAnnouncedFingerprints(UUID accountId, EntityBareJid owner, Map<OpenPgpV4Fingerprint, Date> metadata);
|
2020-06-15 17:41:13 +02:00
|
|
|
|
2020-06-18 21:52:06 +02:00
|
|
|
Single<Map<OpenPgpV4Fingerprint, Date>> loadAnnouncedFingerprints(UUID accountId, EntityBareJid contact);
|
2020-06-13 19:14:38 +02:00
|
|
|
|
2020-07-10 14:15:58 +02:00
|
|
|
Single<Date> loadAnnouncementDate(UUID accountId, EntityBareJid owner, OpenPgpV4Fingerprint fingerprint);
|
|
|
|
|
|
|
|
Single<Date> loadAnnouncementDate(UUID accountId, OpenPgpV4Fingerprint fingerprint);
|
|
|
|
|
2020-06-18 21:52:06 +02:00
|
|
|
Single<OpenPgpTrustStore.Trust> loadTrust(UUID accountId, EntityBareJid owner, OpenPgpV4Fingerprint fingerprint);
|
2020-06-13 19:14:38 +02:00
|
|
|
|
2020-07-10 14:15:58 +02:00
|
|
|
Single<OpenPgpTrustStore.Trust> loadTrust(UUID accountId, OpenPgpV4Fingerprint fingerprint);
|
|
|
|
|
2020-06-18 21:52:06 +02:00
|
|
|
Completable storeTrust(UUID accountId, EntityBareJid owner, OpenPgpV4Fingerprint fingerprint, OpenPgpTrustStore.Trust trust);
|
2020-06-26 16:00:47 +02:00
|
|
|
|
2020-07-10 14:15:58 +02:00
|
|
|
Completable storeTrust(UUID accountId, OpenPgpV4Fingerprint fingerprint, OpenPgpTrustStore.Trust trust);
|
|
|
|
|
2020-06-26 16:00:47 +02:00
|
|
|
Observable<List<OpenPgpV4Fingerprint>> observeFingerprintsOf(UUID accountId, String peerAddress);
|
2020-07-10 14:15:58 +02:00
|
|
|
|
|
|
|
Observable<Optional<OpenPgpV4Fingerprint>> observeLocalFingerprintOf(UUID accountId);
|
|
|
|
|
2020-07-13 14:43:30 +02:00
|
|
|
Observable<List<FingerprintViewItem>> observeFingerprints(UUID accountId, EntityBareJid owner);
|
2020-06-13 19:14:38 +02:00
|
|
|
}
|