Code Monkey home page Code Monkey logo

ikcryptokeyboard's Introduction

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:

pod 'IKCryptoKeyboard'

How to use

extension ViewController: UITextFieldDelegate{

  func textFieldDidBeginEditing(_ textField: UITextField) {
    _ = textField.resignFirstResponder()
    
    let vc = IKCryptoKeyBoardViewController()
    vc.delegate = self
    
    self.present(vc, animated: true)
  }
}

extension ViewController: IKCryptoKeyBoardViewControllerDelegate {
  // get encrypted data from IKCryptoKeyBoardViewController
  func didEncrypted(plain: String, encryptedData: Array<UInt8>) {
    // `plain` is replaced password as "aaaaa..."
    // `encryptedData` is encrypted password
  }
  
  // for debug
  func didDecrypted(decryptedData: Array<UInt8>) {
  // `decryptedData` is password
  }
}

Customize

The Rules.

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

let vc = IKCryptoKeyBoardViewController()
var configure = IKCryptoKeyBoardConfigure()
vc.configure = configure


public struct IKCryptoKeyBoardConfigure {
  
  public struct Color {
    public var touchedKeyBackground = UIColor(red:0.20, green:0.39, blue:0.73, alpha:1.0)
    public var defaultKeyBackground = UIColor(red:0.00, green:0.19, blue:0.53, alpha:1.0)
    public var functionKeyBackground = UIColor(red:0.00, green:0.19, blue:0.53, alpha:1.0)
    public var keyboardBackground = UIColor(red:0.00, green:0.19, blue:0.53, alpha:1.0)
    
    public var functionKeyText = UIColor(red:1.0, green:1.0, blue:1.0, alpha:1.0)
    public var defaultKeyText = UIColor(red:0.0, green:0.0, blue:0.0, alpha:1.0)
    
    public var background = UIColor(red:1.0, green:1.0, blue:1.0, alpha:1.0)
    public init () {
      
    }
  }
  
  public struct Qwerty {
    public var firstLine: String
    public var secondLine: String
    public var thirdLine : String
    
    public init(firstLine: String, secondLine: String, thirdLine: String){
      self.firstLine = firstLine
      self.secondLine = secondLine
      self.thirdLine = thirdLine
    }
  }
  
  public enum IKCipherTypes {
    case aes
    case custom
  }
  
  public struct IKCipher {
    public var key: Array<UInt8> = "aaaaaaaaaaaaaaaa".bytes
    public var iv: Array<UInt8> = "aaaaaaaaaaaaaaaa".bytes
    public var type: IKCipherTypes = .aes
    
    public init (){
    }
  }
  
  public var isUseSubKeys = true
  public var titleName = "CryptoKeyBoard"
  public var informationText = "This is Crypto Keyboard ViewController"
  public var cancelButtonName = "Close"
  
  public var numberQwerty = "1234567890"
  
  public var specialsQwerty = "!@#$%^&*()-=\\`_+|~[];',./{}:\"<>?"
  
  public var mainQwerty = Qwerty(firstLine: "qwertyuiop",
                                 secondLine: "asdfghjkl",
                                 thirdLine: "zxcvbnm")
  
  public var subQwerty = Qwerty(firstLine: "ㅂㅈㄷㄱㅅㅛㅕㅑㅐㅔ",
                                secondLine: "ㅁㄴㅇㄹㅎㅗㅓㅏㅣ",
                                thirdLine: "ㅋㅌㅊㅍㅠㅜㅡ")
  
  public var shiftMainQwerty = Qwerty(firstLine: "QWERTYUIOP",
                                      secondLine: "ASDFGHJKL",
                                      thirdLine: "ZXCVBNM")
  
  public var shiftSubQwerty = Qwerty(firstLine: "ㅃㅉㄸㄲㅆㅛㅕㅑㅒㅖ",
                                     secondLine: "ㅁㄴㅇㄹㅎㅗㅓㅏㅣ",
                                     thirdLine: "ㅋㅌㅊㅍㅠㅜㅡ")

  ...
  public init(){
    
  }
}

Custom Example

  • Deutsch Crypto Keyboard
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

  • Ressian Crypto Keyboard
configure.isUseSubKeys = false
configure.informationText = "This is Ressian Crypto Keyboard"
configure.mainQwerty.firstLine = "йцукенгшщзх"
configure.mainQwerty.secondLine = "фывапролджэ"
configure.mainQwerty.thirdLine = "ячсмитьбю"
    
configure.shiftMainQwerty.firstLine = "ЙЦУКЕНГШЩЗХ"
configure.shiftMainQwerty.secondLine = "ФЫВАПРОЛДЖЭ"
configure.shiftMainQwerty.thirdLine = "ЯЧСМИТЬБЮ"
    
configure.color.defaultKeyBackground = UIColor(red:0.13, green:0.33, blue:0.99, alpha:1.0)
configure.color.touchedKeyBackground = .gray
configure.color.keyboardBackground = UIColor(red:0.99, green:0.99, blue:0.99, alpha:1.0)
configure.color.functionKeyBackground = UIColor(red:0.83, green:0.27, blue:0.27, alpha:1.0)
configure.color.functionKeyText = .white
configure.color.defaultKeyText = .white
configure.color.background = .white

Use Custom Cipher

if you want custom cipher encrypt & decrypt,

let vc = IKCryptoKeyBoardViewController()
var configure = IKCryptoKeyBoardConfigure()
vc.configure.cipher.type = .custom // default is aes
vc.configure = configure

extension ViewController: IKCryptoKeyBoardViewControllerDelegate {
  func doEncrypt(plain: String) -> Array<UInt8> {
    // describe encrypt function
  }
  
  // for debug
  func doDecrypt(encrypted: Array<UInt8>) -> Array<UInt8> {
    // describe decrypt function
  }
}

Author

devikkim, [email protected]

License

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

ikcryptokeyboard's People

Contributors

devikkim avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.