Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/secure auth #1

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

TheChonenOne777
Copy link

Created BaseSecurePreferences as EncryptedSharedPreferences, added key creation for api 21+, added fingerprint assigning and validation

@@ -0,0 +1,7 @@
package com.otus.securehomework.data.dto

data class LoginData(val email: String, val password: String) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в идеале пароль поменять из String на CharSequence

private fun canAuthenticate(authenticator: Int) = BiometricManager.from(context)
.canAuthenticate(authenticator) == BiometricManager.BIOMETRIC_SUCCESS

fun ByteArray.toBase64(flags: Int = Base64.DEFAULT): String = Base64.encodeToString(this, flags)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно эти экстеншены вынести в общие , так как будут переиспользоваться

@@ -5,14 +5,19 @@ import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import com.otus.securehomework.R
import com.otus.securehomework.databinding.FragmentLoginBinding

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишний импорт

val ciphertext = encryptor.doFinal(plaintext.toByteArray())
return EncryptedEntity(
ciphertext,
encryptor.iv

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мне кажется странным, возвращать вектор как результат . Класс , который отвечает за шифрование, должен уметь и сохранять вектор безопасно

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants