DatabaseInteractor -> KeyRepository
This commit is contained in:
@@ -48,7 +48,7 @@ import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyOperation;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel;
|
||||
import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||
import org.sufficientlysecure.keychain.pgp.SignEncryptParcel;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseReadWriteInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
|
||||
import org.sufficientlysecure.keychain.service.ServiceProgressHandler.MessageStatus;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -111,8 +111,8 @@ public class KeychainService extends Service implements Progressable {
|
||||
|
||||
// just for brevity
|
||||
KeychainService outerThis = KeychainService.this;
|
||||
DatabaseReadWriteInteractor databaseInteractor =
|
||||
DatabaseReadWriteInteractor.createDatabaseReadWriteInteractor(outerThis);
|
||||
KeyWritableRepository databaseInteractor =
|
||||
KeyWritableRepository.createDatabaseReadWriteInteractor(outerThis);
|
||||
if (inputParcel instanceof SignEncryptParcel) {
|
||||
op = new SignEncryptOperation(outerThis, databaseInteractor, outerThis, mActionCanceled);
|
||||
} else if (inputParcel instanceof PgpDecryptVerifyInputParcel) {
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.sufficientlysecure.keychain.network.orbot.OrbotHelper;
|
||||
import org.sufficientlysecure.keychain.operations.ImportOperation;
|
||||
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseReadWriteInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.OrbotRequiredDialogActivity;
|
||||
@@ -322,7 +322,7 @@ public class KeyserverSyncAdapterService extends Service {
|
||||
CryptoInputParcel cryptoInputParcel) {
|
||||
Log.d(Constants.TAG, "Starting normal update");
|
||||
ImportOperation importOp = new ImportOperation(context,
|
||||
DatabaseReadWriteInteractor.createDatabaseReadWriteInteractor(context), null);
|
||||
KeyWritableRepository.createDatabaseReadWriteInteractor(context), null);
|
||||
return importOp.execute(
|
||||
new ImportKeyringParcel(keyList,
|
||||
Preferences.getPreferences(context).getPreferredKeyserver()),
|
||||
@@ -382,7 +382,7 @@ public class KeyserverSyncAdapterService extends Service {
|
||||
new OperationResult.OperationLog());
|
||||
}
|
||||
ImportKeyResult result =
|
||||
new ImportOperation(context, DatabaseReadWriteInteractor.createDatabaseReadWriteInteractor(context), null, mCancelled)
|
||||
new ImportOperation(context, KeyWritableRepository.createDatabaseReadWriteInteractor(context), null, mCancelled)
|
||||
.execute(
|
||||
new ImportKeyringParcel(
|
||||
keyWrapper,
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
@@ -224,7 +224,7 @@ public class PassphraseCacheService extends Service {
|
||||
/**
|
||||
* Internal implementation to get cached passphrase.
|
||||
*/
|
||||
private Passphrase getCachedPassphraseImpl(long masterKeyId, long subKeyId) throws DatabaseInteractor.NotFoundException {
|
||||
private Passphrase getCachedPassphraseImpl(long masterKeyId, long subKeyId) throws KeyRepository.NotFoundException {
|
||||
// on "none" key, just do nothing
|
||||
if (masterKeyId == Constants.key.none) {
|
||||
return null;
|
||||
@@ -245,16 +245,16 @@ public class PassphraseCacheService extends Service {
|
||||
+ masterKeyId + ", subKeyId " + subKeyId);
|
||||
|
||||
// get the type of key (from the database)
|
||||
CachedPublicKeyRing keyRing = DatabaseInteractor.createDatabaseInteractor(this).getCachedPublicKeyRing(masterKeyId);
|
||||
CachedPublicKeyRing keyRing = KeyRepository.createDatabaseInteractor(this).getCachedPublicKeyRing(masterKeyId);
|
||||
SecretKeyType keyType = keyRing.getSecretKeyType(subKeyId);
|
||||
|
||||
switch (keyType) {
|
||||
case PASSPHRASE_EMPTY:
|
||||
return new Passphrase("");
|
||||
case UNAVAILABLE:
|
||||
throw new DatabaseInteractor.NotFoundException("secret key for this subkey is not available");
|
||||
throw new KeyRepository.NotFoundException("secret key for this subkey is not available");
|
||||
case GNU_DUMMY:
|
||||
throw new DatabaseInteractor.NotFoundException("secret key for stripped subkey is not available");
|
||||
throw new KeyRepository.NotFoundException("secret key for stripped subkey is not available");
|
||||
}
|
||||
|
||||
// get cached passphrase
|
||||
@@ -398,7 +398,7 @@ public class PassphraseCacheService extends Service {
|
||||
bundle.putParcelable(EXTRA_PASSPHRASE, passphrase);
|
||||
msg.setData(bundle);
|
||||
}
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
} catch (KeyRepository.NotFoundException e) {
|
||||
Log.e(Constants.TAG, "PassphraseCacheService: Passphrase for unknown key was requested!");
|
||||
msg.what = MSG_PASSPHRASE_CACHE_GET_KEY_NOT_FOUND;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user