FLUTTER ECOSYSTEM

infinum/flutter-plugins-locker

생체 인증(Fingerprint, Touch ID, Face ID 등)을 사용하여 키체인에 비밀 정보를 보호하는 플러터 플러그인.

flutter-plugins-locker 프로젝트 이미지
Stars
31
Forks
9
최근 푸시(UTC)
2025. 7. 2.
프로젝트 상태
활성
Infinum GitHub avatar
GITHUB Organization

Infinum ↗

20 years of collective knowledge reflected in clean code and open source. We use emerging technologies to solve problems and shape the behaviors of tomorrow.

언어DartKotlinSwiftRubyObjective-C

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 5 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • pigeon개발 의존성^22.7.0
  • build_runner개발 의존성^2.4.14
  • flutter_lints개발 의존성^5.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Flutter Locker🔒

Locker

Flutter plugin that secures your secrets in keychain using biometric authentication (Fingerprint, Touch ID, Face ID...).

It uses:

Table of contents

Migrate to 2.1.0

The models now accept named parameters instead of unnamed, e.g.:

RetrieveSecretRequest(
  key: 'key',
  androidPrompt: AndroidPrompt(title: 'title', cancelLabel: 'cancel'),
  iOsPrompt: IOsPrompt(touchIdText: 'description'),
)

Usage

FlutterLocker.supportsBiometricAuthentication();

Checks if the devices has biometric capabilities no matter if they are configured and turned on.

FlutterLocker.canAuthenticate();

Checks if the devices has biometric capabilities that are configured and turned on.

await FlutterLocker.save(SaveSecretRequest(
  key: 'key',
  secret: 'secret',
  androidPrompt: AndroidPrompt(title: 'Authenticate', cancelLabel: 'Cancel'),
));

Saves the secret. On Android prompt is shown, while on iOS there is no need for the prompt when saving.

await FlutterLocker.retrieve(RetrieveSecretRequest(
  key: key,
  androidPrompt: AndroidPrompt(title: 'Authenticate', cancelLabel: 'Cancel'),
  iOsPrompt: IOsPrompt(touchIdText: 'Authenticate'),
));

Retrieves the secret. You need to provide a prompt for Android and iOS. Prompt for iOS is used only with TouchID. FaceID uses strings from Info.plist.

await FlutterLocker.delete('key');

Deletes the secret.

Exceptions

For common exceptions, a LockerException is thrown.

Use LockerException.reason to find out what went wrong:

  • secretNotFound - Happens when you try to retrieve a secret that was never saved for that key
  • authenticationCanceled - User canceled the authentication prompt
  • authenticationFailed - User failed authentication, e.g. by too many wrong attempts

For other exception, a PlatformException is thrown. You can use PlatformException.message to get more info.

Notes

  • iOS only: app will not show authentication dialog when saving (authentication will always succeed)
  • please follow Locker and Goldfinger setup to prevent any issues

Setup

iOS

To use Locker you need to add the NSFaceIDUsageDescription to you Info.plist.

If NSFaceIDUsageDescription is not provided, the app will crash with the following error:

This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSFaceIDUsageDescription key with a string value explaining to the user how the app uses this data.
Android

Ensure MainActivity extends FlutterFragmentActivity.

class MainActivity: FlutterFragmentActivity() {
    // ...
}

When showing authentication prompt, the app might crash on some Samsung devices if you don't use an appropriate theme: https://github.com/infinum/flutter-plugins-locker/commit/fcb1f6401d89f860d24ea9a75027d62a03e87926.

https://assets.infinum.com/brand/logo/static/default.svg

Contributing

We believe that the community can help us improve and build better a product. Please refer to our contributing guide to learn about the types of contributions we accept and the process for submitting them.

To ensure that our community remains respectful and professional, we defined a code of conduct that we expect all contributors to follow.

We appreciate your interest and look forward to your contributions.

License

Copyright 2024 Infinum

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Credits

Maintained and sponsored by Infinum.