RSNumberPad is a library that provides a randomized numeric keypad for use in iOS applications.
By providing the user with a randomly changing numeric keypad, this library improves security during password entry. The library also supports dark mode and landscape mode, and automatically raises the view when the keyboard covers a text field to give the user a visual representation of the text field.
Light Mode | Dark Mode |
---|---|
Landscape Mode (Light) | Landscape Mode (Dark) |
---|---|
-
Using CocoaPods:
pod 'RSNumberPad'
-
Using Swift Package Manager:
import PackageDescription let package = Package( name: "AppName", dependencies: [ .Package(url: "https://github.com/devxsby/RSNumberPad", .upToNextMajor(from: "1.3.2")), ] )
- iOS 13.0+
Create an instance of RSNumberPad and place it in the required location. The keyboard is automatically configured when added to the view.
Use the savePassword(key: String, password: String)
method to hash and store the password entered by the user. This method uses a key to securely store the password in the keychain.
Use the checkPassword(key: String, password: String)
method to verify the password entered by the user. This method uses a key to retrieve the password from the keychain and compares it with the password entered by the user.
Each time the user invokes the keypad, the positions of the numbers are randomly changed. This makes it difficult to predict the user's password input pattern.
The password entered by the user is hashed using the SALT algorithm using a combination of UUIDs, and this hash is stored securely in the iOS keychain.
The password entered by the user is hashed and compared with the value stored in the keychain. This verifies the accuracy of the password.
RSNumberPad fully supports iOS's dark mode. When dark mode is enabled, the keypad's theme will automatically change to a dark color.
RSNumberPad fully supports landscape mode. When the device is rotated to landscape orientation, the keypad view will automatically adjust to landscape mode.
If the keypad covers the text field, the view will automatically rise to allow the user to visually see the text field.
For enhanced security, RSNumberPad disables the copy and paste function within the text field. This makes it impossible for users to paste copied content into the text field, further securing sensitive data entry.
In addition to the 'Done' button, RSNumberPad improves usability by allowing users to dismiss the keypad by tapping outside of the text field area. This feature provides a more intuitive way for users to control the keypad's visibility.
In addition to these, this library applies the MVVM architecture to separate the view and the model and to allow the keypad view to be customized freely according to needs. Therefore, updates to control the state of each button (number, delete, random) or to change the shape, size, etc. of the keypad are planned.
devxsby, [email protected]
RSNumberPad is under MIT license. See the LICENSE file for more info.