Flutter Secure Keyboard는 모바일 기기에서 키로거 공격 및 화면 캡처로부터 사용자 입력을 보호하기 위해 설계된 Flutter 패키지입니다. 비밀번호나 PIN과 같은 민감한 입력 정보를 가로채거나 녹화하는 것을 방지하기 위해 안전한 키보드 인터페이스를 제공합니다. 보안을 우선 고려하여 Android와 iOS의 플랫폼 전용 기능을 활용해 입력 중 데이터가 기밀성을 유지하도록 합니다. 은행 앱이나 인증 시스템과 같이 높은 수준의 입력 보안이 필요한 애플리케이션에 적합합니다.
사용 사례
보안 비밀번호 입력
PIN 입력 보호
인증 흐름
화면 녹화 방지
키로깅 완화
민감 데이터 입력
주요 기능
화면 캡처를 방지합니다
키로거 공격에 저항합니다
플랫폼 네이티브 보안
격리된 입력 처리
크로스 플랫폼 지원 (Android 및 iOS)
pub add를 통한 간편한 통합
적합한 대상
금융 애플리케이션
인증 시스템
개인정보 보호 중심 앱
기업 모바일 솔루션
민감한 자격 증명을 처리하는 앱
고려 사항
사용성에 대한 신중한 UI 설계가 필요합니다
접근성 기능에 영향을 미칠 수 있습니다
제한된 사용자 정의 옵션
플랫폼 수준의 보안에 의존
완전한 암호화의 대체가 아님
오래된 장치에서 성능 오버헤드 가능성
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Mobile secure keyboard to prevent KeyLogger attack and screen capture.
classWithSecureKeyboardExampleextendsStatefulWidget{
@override_WithSecureKeyboardExampleStatecreateState() =>
_WithSecureKeyboardExampleState();
}
class_WithSecureKeyboardExampleStateextendsState<WithSecureKeyboardExample> {
final _secureKeyboardController = SecureKeyboardController();
final _passwordEditor = TextEditingController();
final _passwordTextFieldFocusNode = FocusNode();
final _pinCodeEditor = TextEditingController();
final _pinCodeTextFieldFocusNode = FocusNode();
@overrideWidgetbuild(BuildContext context) {
// Set the WithSecureKeyboard widget as the top-level widget// in the build function so that the secure keyboard works properly.returnWithSecureKeyboard(
controller: _secureKeyboardController,
child: Scaffold(
appBar: AppBar(
title: Text('flutter_secure_keyboard'),
),
body: _buildContentView(),
),
);
}
Widget_buildContentView() {
// We recommend using the ListView widget to prevent widget overflow.returnListView(
padding: constEdgeInsets.all(8.0),
children: [
_buildPasswordTextField(),
SizedBox(height: 12.0),
_buildPinCodeTextField(),
],
);
}
Widget_buildPasswordTextField() {
returnColumn(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Password'),
TextFormField(
controller: _passwordEditor,
focusNode: _passwordTextFieldFocusNode,
// We recommended to set false to prevent the software keyboard from opening.
enableInteractiveSelection: false,
obscureText: true,
onTap: () {
_secureKeyboardController.show(
type: SecureKeyboardType.ALPHA_NUMERIC,
focusNode: _passwordTextFieldFocusNode,
initText: _passwordEditor.text,
hintText: 'password',
// Use onCharCodesChanged to have text entered in real time.
onCharCodesChanged: (List<int> charCodes) {
_passwordEditor.text = String.fromCharCodes(charCodes);
},
);
},
),
],
);
}
Widget_buildPinCodeTextField() {
returnColumn(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('PinCode'),
TextFormField(
controller: _pinCodeEditor,
focusNode: _pinCodeTextFieldFocusNode,
// We recommended to set false to prevent the software keyboard from opening.
enableInteractiveSelection: false,
obscureText: true,
onTap: () {
_secureKeyboardController.show(
type: SecureKeyboardType.NUMERIC,
focusNode: _pinCodeTextFieldFocusNode,
initText: _pinCodeEditor.text,
hintText: 'pinCode',
// Use onDoneKeyPressed to allow text to be entered when you press the done key,// or to do something like encryption.
onDoneKeyPressed: (List<int> charCodes) {
_pinCodeEditor.text = String.fromCharCodes(charCodes);
},
);
},
),
],
);
}
@overridevoiddispose() {
super.dispose();
_secureKeyboardController.dispose();
_passwordEditor.dispose();
_pinCodeEditor.dispose();
}
}
Package
WithSecureKeyboard - A widget that implements a secure keyboard with controller.
SecureKeyboardController - Controller to check or control the state of the secure keyboard.
Note: The parameters marked with an asterisk(*) are required.
WithSecureKeyboard
Parameter
Description
controller*
Controller to control the secure keyboard.
child*
A child widget with a secure keyboard.
keyboardHeight
The height of the keyboard. Default value is 280.0.
keyRadius
The radius of the keyboard key. Default value is 4.0.
keySpacing
The spacing between keyboard keys. Default value is 1.2.
keyInputMonitorPadding
The padding of the key input monitor. Default value is const EdgeInsets.only(left: 10.0, right: 5.0).
keyboardPadding
The padding of the keyboard. Default value is const EdgeInsets.symmetric(horizontal: 5.0).
backgroundColor
The background color of the keyboard. Default value is const Color(0xFF0A0A0A).
stringKeyColor
The color of the string key(alphanumeric, numeric..). Default value is const Color(0xFF313131).
actionKeyColor
The color of the action key(shift, backspace, clear..). Default value is const Color(0xFF222222).
doneKeyColor
The color of the done key. Default value is const Color(0xFF1C7CDC).
activatedKeyColor
The key color when the shift action key is activated. If the value is null, doneKeyColor is used.
keyTextStyle
The text style of the text inside the keyboard key. Default value is const TextStyle(color: Colors.white, fontSize: 17.0, fontWeight: FontWeight.w500).
inputTextStyle
The text style of the text inside the key input monitor. Default value is const TextStyle(color: Colors.white, fontSize: 17.0, fontWeight: FontWeight.w500).
SecureKeyboardController
Function
Description
isShowing
Whether the secure keyboard is showing.
show
Show secure keyboard.
hide
Hide secure keyboard.
SecureKeyboardController.show()
Parameter
Description
type*
The type of the secure keyboard.
focusNode
The FocusNode that will receive focus on.
initText
The initial value of the input text.
hintText
The hint text to display when the input text is empty.
inputTextLengthSymbol
The symbol to use when displaying the input text length.
doneKeyText
The text of the done key.
clearKeyText
The text of the clear key.
obscuringCharacter
The secure character to hide the input text. Default value is •.
maxLength
The maximum length of text that can be entered.
alwaysCaps
Whether to always display uppercase characters. Default value is false.
obscureText
Whether to hide input text as secure characters. Default value is true.
shuffleNumericKey
Whether to shuffle the position of the numeric keys. Default value is true.
hideKeyInputMonitor
Whether to hide the key input monitor. Default value is false.
disableKeyBubble
Whether to disable the key bubble. Default value is false.