diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2022-06-09 13:51:29 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-09 13:51:29 +0530 |
| commit | 426fc924fba28ec898681ad7f7010456554f061e (patch) | |
| tree | 195eac25c605a89f4e239578d685928a64675ee0 /app/src/main/java/dev/msfjarvis/aps/util/git | |
| parent | f968b21bf665975e17ad9b03bcff652000e96ec4 (diff) | |
| download | HardenedPass-426fc924fba28ec898681ad7f7010456554f061e.tar.gz HardenedPass-426fc924fba28ec898681ad7f7010456554f061e.zip | |
Upgrade ktfmt (#1942)
* build-logic: upgrade ktfmt
* all: reformat
Diffstat (limited to 'app/src/main/java/dev/msfjarvis/aps/util/git')
| -rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/util/git/sshj/OpenKeychainKeyProvider.kt | 7 | ||||
| -rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt | 12 |
2 files changed, 12 insertions, 7 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/OpenKeychainKeyProvider.kt b/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/OpenKeychainKeyProvider.kt index 349e70e5..8436d1ce 100644 --- a/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/OpenKeychainKeyProvider.kt +++ b/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/OpenKeychainKeyProvider.kt @@ -145,7 +145,8 @@ class OpenKeychainKeyProvider private constructor(val activity: ContinuationCont } private suspend fun parseResult(request: Request, result: Intent): ApiResponse { - return when (result.getIntExtra( + return when ( + result.getIntExtra( SshAuthenticationApi.EXTRA_RESULT_CODE, SshAuthenticationApi.RESULT_CODE_ERROR ) @@ -196,8 +197,8 @@ class OpenKeychainKeyProvider private constructor(val activity: ContinuationCont privateKey = object : OpenKeychainPrivateKey { override suspend fun sign(challenge: ByteArray, hashAlgorithm: Int) = - when (val signingResponse = - executeApiRequest(SigningRequest(challenge, keyId, hashAlgorithm)) + when ( + val signingResponse = executeApiRequest(SigningRequest(challenge, keyId, hashAlgorithm)) ) { is ApiResponse.Success -> (signingResponse.response as SigningResponse).signature is ApiResponse.GeneralError -> throw signingResponse.exception diff --git a/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt b/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt index 67e063a4..ea96af53 100644 --- a/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt +++ b/app/src/main/java/dev/msfjarvis/aps/util/git/sshj/SshKey.kt @@ -209,7 +209,8 @@ object SshKey { // The file must have more than 2 lines, and the first and last line must have private key // markers. - if (lines.size < 2 || + if ( + lines.size < 2 || !Regex("BEGIN .* PRIVATE KEY").containsMatchIn(lines.first()) || !Regex("END .* PRIVATE KEY").containsMatchIn(lines.last()) ) @@ -349,9 +350,12 @@ object SshKey { override fun getPrivate(): PrivateKey = runCatching { - // The current MasterKey API does not allow getting a reference to an existing one - // without specifying the KeySpec for a new one. However, the value for passed here - // for `requireAuthentication` is not used as the key already exists at this point. + // The current MasterKey API does not allow getting a reference to an existing + // one + // without specifying the KeySpec for a new one. However, the value for passed + // here + // for `requireAuthentication` is not used as the key already exists at this + // point. val encryptedPrivateKeyFile = runBlocking { getOrCreateWrappedPrivateKeyFile(false) } val rawPrivateKey = encryptedPrivateKeyFile.openFileInput().use { it.readBytes() } EdDSAPrivateKey( |
