-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Experimental biometric support on MacOS #663
- Loading branch information
Showing
55 changed files
with
1,171 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
common/src/commonMain/kotlin/com/artemchep/keyguard/common/model/BiometricStatus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
common/src/commonMain/kotlin/com/artemchep/keyguard/common/model/WithBiometric.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package com.artemchep.keyguard.common.model | ||
|
||
import com.artemchep.keyguard.common.io.IO | ||
import com.artemchep.keyguard.platform.LeCipher | ||
import com.artemchep.keyguard.platform.LeBiometricCipher | ||
|
||
class WithBiometric( | ||
val getCipher: () -> LeCipher, | ||
val getCipher: suspend () -> LeBiometricCipher, | ||
val getCreateIo: () -> IO<Unit>, | ||
) |
7 changes: 7 additions & 0 deletions
7
...c/commonMain/kotlin/com/artemchep/keyguard/common/service/biometrics/BiometricsService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.artemchep.keyguard.common.service.biometrics | ||
|
||
interface BiometricsService { | ||
fun isSupported(): Boolean | ||
|
||
suspend fun confirm(): Boolean | ||
} |
7 changes: 7 additions & 0 deletions
7
common/src/commonMain/kotlin/com/artemchep/keyguard/common/service/keychain/KeychainIds.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.artemchep.keyguard.common.service.keychain | ||
|
||
enum class KeychainIds( | ||
val value: String, | ||
) { | ||
BIOMETRIC_UNLOCK("com.artemchep.keyguard.biometric-unlock"), | ||
} |
21 changes: 21 additions & 0 deletions
21
...rc/commonMain/kotlin/com/artemchep/keyguard/common/service/keychain/KeychainRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.artemchep.keyguard.common.service.keychain | ||
|
||
import com.artemchep.keyguard.common.io.IO | ||
|
||
/** | ||
* Provides a generic interface for keychain | ||
* implementation. | ||
*/ | ||
interface KeychainRepository { | ||
fun put( | ||
id: String, | ||
password: String, | ||
requireUserPresence: Boolean = false, | ||
): IO<Unit> | ||
|
||
fun get(id: String): IO<String> | ||
|
||
fun delete(id: String): IO<Boolean> | ||
|
||
fun contains(id: String): IO<Boolean> | ||
} |
27 changes: 27 additions & 0 deletions
27
...Main/kotlin/com/artemchep/keyguard/common/service/keychain/impl/KeychainRepositoryNoOp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.artemchep.keyguard.common.service.keychain.impl | ||
|
||
import com.artemchep.keyguard.common.io.ioRaise | ||
import com.artemchep.keyguard.common.service.keychain.KeychainRepository | ||
import org.kodein.di.DirectDI | ||
|
||
class KeychainRepositoryNoOp( | ||
) : KeychainRepository { | ||
constructor(directDI: DirectDI) : this() | ||
|
||
override fun put( | ||
id: String, | ||
password: String, | ||
requireUserPresence: Boolean, | ||
) = ioRaiseDefault() | ||
|
||
override fun get(id: String) = ioRaiseDefault() | ||
|
||
override fun delete(id: String) = ioRaiseDefault() | ||
|
||
override fun contains(id: String) = ioRaiseDefault() | ||
|
||
private fun ioRaiseDefault() = kotlin.run { | ||
val e = IllegalStateException("This platform does not have the keychain support!") | ||
ioRaise<Nothing>(e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.