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

iPad #301

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

iPad #301

wants to merge 8 commits into from

Conversation

siandreev
Copy link
Contributor

⚠️ Work in progress, don't merge

let keychainQuery: [CFString: Any] = [
kSecClass: kSecClassGenericPassword,
kSecAttrAccount: id,
kSecValueData: data.data(using: .utf8)!

Choose a reason for hiding this comment

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

я бы предложил однозначно избегать !, попадется строка, которая успешно в дату не перегонится в utf8, будет тупо крэш

наверное я бы написал что-то типа такого

guard let id = call.getString("id"), 
           let dataString = call.getString("data"), 
           let data = dataString.data(using: .utf8)  else {
            call.reject("Missing required parameters")
            return
        }

}

let keychainQuery: [CFString: Any] = [
kSecClass: kSecClassGenericPassword,

Choose a reason for hiding this comment

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

можно еще добавить ключ kSecAttrAccessible

это настраивает разные параметры доступа к данным в кейчен, в том числе, будут ли они попадать с в бэкап или только этом девайсе будут храниться

https://developer.apple.com/documentation/security/ksecattraccessible


let reason = call.getString("reason") ?? "Access requires authentication"

authContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason ) { success, error in

Choose a reason for hiding this comment

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

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

на мой взгляд, лучше просто сохранять пароль/пин код в кейчейне под доступом через биометрию

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