项目作者: devikkim

项目描述 :
This is Crypto Keyboard ViewController.
高级语言: Swift
项目地址: git://github.com/devikkim/IKCryptoKeyboard.git
创建时间: 2018-11-07T06:30:09Z
项目社区:https://github.com/devikkim/IKCryptoKeyboard

开源协议:MIT License

下载


IKCryptoKeyboard

CI Status
Version
License
Platform

Demo

English/Korean Keyboard

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Swift 4.0
  • ios 9.3

Dependecy

Installation

IKCryptoKeyboard is available through CocoaPods. To install
it, simply add the following line to your Podfile:

  1. pod 'IKCryptoKeyboard'

How to use

  1. extension ViewController: UITextFieldDelegate{
  2. func textFieldDidBeginEditing(_ textField: UITextField) {
  3. _ = textField.resignFirstResponder()
  4. let vc = IKCryptoKeyBoardViewController()
  5. vc.delegate = self
  6. self.present(vc, animated: true)
  7. }
  8. }
  9. extension ViewController: IKCryptoKeyBoardViewControllerDelegate {
  10. // get encrypted data from IKCryptoKeyBoardViewController
  11. func didEncrypted(plain: String, encryptedData: Array<UInt8>) {
  12. // `plain` is replaced password as "aaaaa..."
  13. // `encryptedData` is encrypted password
  14. }
  15. // for debug
  16. func didDecrypted(decryptedData: Array<UInt8>) {
  17. // `decryptedData` is password
  18. }
  19. }

Customize

The Rules.

If you keep the rules, you can use all of the languages keyboard.

  1. let vc = IKCryptoKeyBoardViewController()
  2. var configure = IKCryptoKeyBoardConfigure()
  3. vc.configure = configure
  4. public struct IKCryptoKeyBoardConfigure {
  5. public struct Color {
  6. public var touchedKeyBackground = UIColor(red:0.20, green:0.39, blue:0.73, alpha:1.0)
  7. public var defaultKeyBackground = UIColor(red:0.00, green:0.19, blue:0.53, alpha:1.0)
  8. public var functionKeyBackground = UIColor(red:0.00, green:0.19, blue:0.53, alpha:1.0)
  9. public var keyboardBackground = UIColor(red:0.00, green:0.19, blue:0.53, alpha:1.0)
  10. public var functionKeyText = UIColor(red:1.0, green:1.0, blue:1.0, alpha:1.0)
  11. public var defaultKeyText = UIColor(red:0.0, green:0.0, blue:0.0, alpha:1.0)
  12. public var background = UIColor(red:1.0, green:1.0, blue:1.0, alpha:1.0)
  13. public init () {
  14. }
  15. }
  16. public struct Qwerty {
  17. public var firstLine: String
  18. public var secondLine: String
  19. public var thirdLine : String
  20. public init(firstLine: String, secondLine: String, thirdLine: String){
  21. self.firstLine = firstLine
  22. self.secondLine = secondLine
  23. self.thirdLine = thirdLine
  24. }
  25. }
  26. public enum IKCipherTypes {
  27. case aes
  28. case custom
  29. }
  30. public struct IKCipher {
  31. public var key: Array<UInt8> = "aaaaaaaaaaaaaaaa".bytes
  32. public var iv: Array<UInt8> = "aaaaaaaaaaaaaaaa".bytes
  33. public var type: IKCipherTypes = .aes
  34. public init (){
  35. }
  36. }
  37. public var isUseSubKeys = true
  38. public var titleName = "CryptoKeyBoard"
  39. public var informationText = "This is Crypto Keyboard ViewController"
  40. public var cancelButtonName = "Close"
  41. public var numberQwerty = "1234567890"
  42. public var specialsQwerty = "!@#$%^&*()-=\\`_+|~[];',./{}:\"<>?"
  43. public var mainQwerty = Qwerty(firstLine: "qwertyuiop",
  44. secondLine: "asdfghjkl",
  45. thirdLine: "zxcvbnm")
  46. public var subQwerty = Qwerty(firstLine: "ㅂㅈㄷㄱㅅㅛㅕㅑㅐㅔ",
  47. secondLine: "ㅁㄴㅇㄹㅎㅗㅓㅏㅣ",
  48. thirdLine: "ㅋㅌㅊㅍㅠㅜㅡ")
  49. public var shiftMainQwerty = Qwerty(firstLine: "QWERTYUIOP",
  50. secondLine: "ASDFGHJKL",
  51. thirdLine: "ZXCVBNM")
  52. public var shiftSubQwerty = Qwerty(firstLine: "ㅃㅉㄸㄲㅆㅛㅕㅑㅒㅖ",
  53. secondLine: "ㅁㄴㅇㄹㅎㅗㅓㅏㅣ",
  54. thirdLine: "ㅋㅌㅊㅍㅠㅜㅡ")
  55. ...
  56. public init(){
  57. }
  58. }

Custom Example

  • Deutsch Crypto Keyboard
    ``` swift
    configure.isUseSubKeys = false
    configure.informationText = “This is Deutsch Crypto Keyboard”
    configure.mainQwerty.firstLine = “qwertzuiopü”
    configure.mainQwerty.secondLine = “asdfghjklöä”
    configure.mainQwerty.thirdLine = “yxcvbnm”

configure.shiftMainQwerty.firstLine = “QWERTZUIOPÜ”
configure.shiftMainQwerty.secondLine = “ASDFGHJKLÖÄ”
configure.shiftMainQwerty.thirdLine = “YXCVBNM”

configure.color.defaultKeyBackground = UIColor(red:0.83, green:0.72, blue:0.21, alpha:1.0)
configure.color.touchedKeyBackground = .gray
configure.color.functionKeyBackground = UIColor(red:0.70, green:0.08, blue:0.08, alpha:1.0)
configure.color.keyboardBackground = UIColor(red:0.17, green:0.14, blue:0.14, alpha:1.0)
configure.color.functionKeyText = .black
configure.color.defaultKeyText = .black
configure.color.background = .white

  1. <img src="/Screenshots/Deutsch.png" />
  2. - Ressian Crypto Keyboard
  3. ``` swift
  4. configure.isUseSubKeys = false
  5. configure.informationText = "This is Ressian Crypto Keyboard"
  6. configure.mainQwerty.firstLine = "йцукенгшщзх"
  7. configure.mainQwerty.secondLine = "фывапролджэ"
  8. configure.mainQwerty.thirdLine = "ячсмитьбю"
  9. configure.shiftMainQwerty.firstLine = "ЙЦУКЕНГШЩЗХ"
  10. configure.shiftMainQwerty.secondLine = "ФЫВАПРОЛДЖЭ"
  11. configure.shiftMainQwerty.thirdLine = "ЯЧСМИТЬБЮ"
  12. configure.color.defaultKeyBackground = UIColor(red:0.13, green:0.33, blue:0.99, alpha:1.0)
  13. configure.color.touchedKeyBackground = .gray
  14. configure.color.keyboardBackground = UIColor(red:0.99, green:0.99, blue:0.99, alpha:1.0)
  15. configure.color.functionKeyBackground = UIColor(red:0.83, green:0.27, blue:0.27, alpha:1.0)
  16. configure.color.functionKeyText = .white
  17. configure.color.defaultKeyText = .white
  18. configure.color.background = .white

Use Custom Cipher

if you want custom cipher encrypt & decrypt,

  1. let vc = IKCryptoKeyBoardViewController()
  2. var configure = IKCryptoKeyBoardConfigure()
  3. vc.configure.cipher.type = .custom // default is aes
  4. vc.configure = configure
  5. extension ViewController: IKCryptoKeyBoardViewControllerDelegate {
  6. func doEncrypt(plain: String) -> Array<UInt8> {
  7. // describe encrypt function
  8. }
  9. // for debug
  10. func doDecrypt(encrypted: Array<UInt8>) -> Array<UInt8> {
  11. // describe decrypt function
  12. }
  13. }

Author

devikkim, devikkim@gmail.com

License

IKCryptoKeyboard is available under the MIT license. See the LICENSE file for more info.