summaryrefslogtreecommitdiff
path: root/openpgp-ktx
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-05-15 12:56:49 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-05-15 15:40:20 +0530
commit7e2eb2425e7b9b6ccb37b7b89f19de3fa7a20c44 (patch)
tree6b8a9557ac51b5fab5d2ad7611084cf0de6c57cf /openpgp-ktx
parent2fcb285e276594842798be6990b92ba09e733f49 (diff)
all: reformat with Spotless again
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'openpgp-ktx')
-rw-r--r--openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt6
-rw-r--r--openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpApi.kt27
-rw-r--r--openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpServiceConnection.kt7
-rw-r--r--openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt11
-rw-r--r--openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpDecryptionResult.kt6
-rw-r--r--openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt7
-rw-r--r--openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt54
7 files changed, 97 insertions, 21 deletions
diff --git a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt
index f81b72a4..45ee5755 100644
--- a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt
+++ b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/AutocryptPeerUpdate.kt
@@ -15,7 +15,11 @@ public class AutocryptPeerUpdate() : Parcelable {
private var effectiveDate: Date? = null
private lateinit var preferEncrypt: PreferEncrypt
- internal constructor(keyData: ByteArray?, effectiveDate: Date?, preferEncrypt: PreferEncrypt) : this() {
+ internal constructor(
+ keyData: ByteArray?,
+ effectiveDate: Date?,
+ preferEncrypt: PreferEncrypt
+ ) : this() {
this.keyData = keyData
this.effectiveDate = effectiveDate
this.preferEncrypt = preferEncrypt
diff --git a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpApi.kt b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpApi.kt
index c855f619..91523a54 100644
--- a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpApi.kt
+++ b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpApi.kt
@@ -21,7 +21,11 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
private val pipeIdGen: AtomicInteger = AtomicInteger()
- public suspend fun executeApi(data: Intent, inputStream: InputStream?, outputStream: OutputStream?): Intent {
+ public suspend fun executeApi(
+ data: Intent,
+ inputStream: InputStream?,
+ outputStream: OutputStream?
+ ): Intent {
var input: ParcelFileDescriptor? = null
return try {
if (inputStream != null) {
@@ -124,7 +128,8 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
*
* This action uses no extras.
*/
- public const val ACTION_CHECK_PERMISSION: String = "org.openintents.openpgp.action.CHECK_PERMISSION"
+ public const val ACTION_CHECK_PERMISSION: String =
+ "org.openintents.openpgp.action.CHECK_PERMISSION"
/**
* Sign text resulting in a cleartext signature Some magic pre-processing of the text is done to
@@ -178,9 +183,11 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
* passphrase) String EXTRA_ORIGINAL_FILENAME (original filename to be encrypted as metadata)
* boolean EXTRA_ENABLE_COMPRESSION (enable ZLIB compression, default ist true)
*/
- public const val ACTION_SIGN_AND_ENCRYPT: String = "org.openintents.openpgp.action.SIGN_AND_ENCRYPT"
+ public const val ACTION_SIGN_AND_ENCRYPT: String =
+ "org.openintents.openpgp.action.SIGN_AND_ENCRYPT"
- public const val ACTION_QUERY_AUTOCRYPT_STATUS: String = "org.openintents.openpgp.action.QUERY_AUTOCRYPT_STATUS"
+ public const val ACTION_QUERY_AUTOCRYPT_STATUS: String =
+ "org.openintents.openpgp.action.QUERY_AUTOCRYPT_STATUS"
/**
* Decrypts and verifies given input stream. This methods handles encrypted-only,
@@ -208,7 +215,8 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
* returned extras: OpenPgpDecryptMetadata RESULT_METADATA String RESULT_CHARSET (charset which
* was specified in the headers of ascii armored input, if any)
*/
- public const val ACTION_DECRYPT_METADATA: String = "org.openintents.openpgp.action.DECRYPT_METADATA"
+ public const val ACTION_DECRYPT_METADATA: String =
+ "org.openintents.openpgp.action.DECRYPT_METADATA"
/**
* Select key id for signing
@@ -217,7 +225,8 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
*
* returned extras: long EXTRA_SIGN_KEY_ID
*/
- public const val ACTION_GET_SIGN_KEY_ID: String = "org.openintents.openpgp.action.GET_SIGN_KEY_ID"
+ public const val ACTION_GET_SIGN_KEY_ID: String =
+ "org.openintents.openpgp.action.GET_SIGN_KEY_ID"
/**
* Get key ids based on given user ids (=emails)
@@ -254,7 +263,8 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
*/
public const val ACTION_BACKUP: String = "org.openintents.openpgp.action.BACKUP"
- public const val ACTION_UPDATE_AUTOCRYPT_PEER: String = "org.openintents.openpgp.action.UPDATE_AUTOCRYPT_PEER"
+ public const val ACTION_UPDATE_AUTOCRYPT_PEER: String =
+ "org.openintents.openpgp.action.UPDATE_AUTOCRYPT_PEER"
/* Intent extras */
public const val EXTRA_API_VERSION: String = "api_version"
@@ -323,7 +333,8 @@ public class OpenPgpApi(private val context: Context, private val service: IOpen
public const val EXTRA_DATA_LENGTH: String = "data_length"
public const val EXTRA_DECRYPTION_RESULT: String = "decryption_result"
public const val EXTRA_SENDER_ADDRESS: String = "sender_address"
- public const val EXTRA_SUPPORT_OVERRIDE_CRYPTO_WARNING: String = "support_override_crpto_warning"
+ public const val EXTRA_SUPPORT_OVERRIDE_CRYPTO_WARNING: String =
+ "support_override_crpto_warning"
public const val EXTRA_AUTOCRYPT_PEER_ID: String = "autocrypt_peer_id"
public const val EXTRA_AUTOCRYPT_PEER_UPDATE: String = "autocrypt_peer_update"
public const val EXTRA_AUTOCRYPT_PEER_GOSSIP_UPDATES: String = "autocrypt_peer_gossip_updates"
diff --git a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpServiceConnection.kt b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpServiceConnection.kt
index 528c0127..67796c26 100644
--- a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpServiceConnection.kt
+++ b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpServiceConnection.kt
@@ -65,7 +65,12 @@ public class OpenPgpServiceConnection(context: Context, providerPackageName: Str
val serviceIntent = Intent(OpenPgpApi.SERVICE_INTENT_2)
// NOTE: setPackage is very important to restrict the intent to this provider only!
serviceIntent.setPackage(mProviderPackageName)
- val connect = mApplicationContext.bindService(serviceIntent, mServiceConnection, Context.BIND_AUTO_CREATE)
+ val connect =
+ mApplicationContext.bindService(
+ serviceIntent,
+ mServiceConnection,
+ Context.BIND_AUTO_CREATE
+ )
if (!connect) {
throw Exception("bindService() returned false!")
}
diff --git a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt
index ca7e3d3d..c70d9c3c 100644
--- a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt
+++ b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt
@@ -13,7 +13,10 @@ import java.util.regex.Pattern
public object OpenPgpUtils {
private val PGP_MESSAGE: Pattern =
- Pattern.compile(".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*", Pattern.DOTALL)
+ Pattern.compile(
+ ".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*",
+ Pattern.DOTALL
+ )
private val PGP_SIGNED_MESSAGE: Pattern =
Pattern.compile(
".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*",
@@ -103,5 +106,9 @@ public object OpenPgpUtils {
return if (userIdBuilder.isEmpty()) null else userIdBuilder.toString()
}
- public class UserId(public val name: String?, public val email: String?, public val comment: String?) : Serializable
+ public class UserId(
+ public val name: String?,
+ public val email: String?,
+ public val comment: String?
+ ) : Serializable
}
diff --git a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpDecryptionResult.kt b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpDecryptionResult.kt
index 18f8cd0c..72bc1b39 100644
--- a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpDecryptionResult.kt
+++ b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpDecryptionResult.kt
@@ -22,7 +22,11 @@ public class OpenPgpDecryptionResult() : Parcelable {
decryptedSessionKey = null
}
- private constructor(result: Int, sessionKey: ByteArray?, decryptedSessionKey: ByteArray?) : this() {
+ private constructor(
+ result: Int,
+ sessionKey: ByteArray?,
+ decryptedSessionKey: ByteArray?
+ ) : this() {
this.result = result
if (sessionKey == null != (decryptedSessionKey == null)) {
throw AssertionError("sessionkey must be null iff decryptedSessionKey is null")
diff --git a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
index a73c77c1..a22c8af0 100644
--- a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
+++ b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpMetadata.kt
@@ -32,7 +32,12 @@ public class OpenPgpMetadata() : Parcelable {
this.charset = charset
}
- private constructor(filename: String?, mimeType: String?, modificationTime: Long, originalSize: Long) : this() {
+ private constructor(
+ filename: String?,
+ mimeType: String?,
+ modificationTime: Long,
+ originalSize: Long
+ ) : this() {
this.filename = filename
this.mimeType = mimeType
this.modificationTime = modificationTime
diff --git a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt
index 45f10abd..68a542a8 100644
--- a/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt
+++ b/openpgp-ktx/src/main/java/org/openintents/openpgp/OpenPgpSignatureResult.kt
@@ -58,7 +58,8 @@ public class OpenPgpSignatureResult : Parcelable {
}
// backward compatibility for this exact version
if (version > 2) {
- senderStatusResult = readEnumWithNullAndFallback(source, SenderStatusResult.values(), SenderStatusResult.UNKNOWN)
+ senderStatusResult =
+ readEnumWithNullAndFallback(source, SenderStatusResult.values(), SenderStatusResult.UNKNOWN)
confirmedUserIds = source.createStringArrayList()
} else {
senderStatusResult = SenderStatusResult.UNKNOWN
@@ -151,7 +152,9 @@ public class OpenPgpSignatureResult : Parcelable {
)
}
- public fun withAutocryptPeerResult(autocryptPeerentityResult: AutocryptPeerResult?): OpenPgpSignatureResult {
+ public fun withAutocryptPeerResult(
+ autocryptPeerentityResult: AutocryptPeerResult?
+ ): OpenPgpSignatureResult {
return OpenPgpSignatureResult(
result,
primaryUserId,
@@ -253,18 +256,55 @@ public class OpenPgpSignatureResult : Parcelable {
}
public fun createWithNoSignature(): OpenPgpSignatureResult {
- return OpenPgpSignatureResult(RESULT_NO_SIGNATURE, null, 0L, null, null, null, null, null, null)
+ return OpenPgpSignatureResult(
+ RESULT_NO_SIGNATURE,
+ null,
+ 0L,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ )
}
- public fun createWithKeyMissing(keyId: Long, signatureTimestamp: Date?): OpenPgpSignatureResult {
- return OpenPgpSignatureResult(RESULT_KEY_MISSING, null, keyId, null, null, null, null, signatureTimestamp, null)
+ public fun createWithKeyMissing(
+ keyId: Long,
+ signatureTimestamp: Date?
+ ): OpenPgpSignatureResult {
+ return OpenPgpSignatureResult(
+ RESULT_KEY_MISSING,
+ null,
+ keyId,
+ null,
+ null,
+ null,
+ null,
+ signatureTimestamp,
+ null
+ )
}
public fun createWithInvalidSignature(): OpenPgpSignatureResult {
- return OpenPgpSignatureResult(RESULT_INVALID_SIGNATURE, null, 0L, null, null, null, null, null, null)
+ return OpenPgpSignatureResult(
+ RESULT_INVALID_SIGNATURE,
+ null,
+ 0L,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ )
}
- private fun <T : Enum<T>?> readEnumWithNullAndFallback(source: Parcel, enumValues: Array<T>, fallback: T?): T? {
+ private fun <T : Enum<T>?> readEnumWithNullAndFallback(
+ source: Parcel,
+ enumValues: Array<T>,
+ fallback: T?
+ ): T? {
val valueOrdinal = source.readInt()
if (valueOrdinal == -1) {
return null