Merge pull request #496 from James-Sangalli/0x-safe-key-imports

allows private key to have 0x or not
pull/498/head
James Sangalli 6 years ago committed by GitHub
commit b2b5fa8a03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      AlphaWallet/Info.plist
  2. 4
      AlphaWallet/UI/Form/PrivateKeyRule.swift
  3. 2
      AlphaWallet/Wallet/ViewControllers/ImportWalletViewController.swift

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.84</string>
<string>0.86</string>
<key>CFBundleURLTypes</key>
<array>
<dict>

@ -15,7 +15,9 @@ public struct PrivateKeyRule<T: Equatable>: RuleType {
public func isValid(value: T?) -> ValidationError? {
if let str = value as? String {
return (str.count != 64) ? validationError : nil
//allows for private key import to have 0x or not
let drop0xKey = str.drop0x
return (drop0xKey.count != 64) ? validationError : nil
}
return value != nil ? nil : validationError
}

@ -249,7 +249,7 @@ class ImportWalletViewController: UIViewController {
guard validate() else { return }
let keystoreInput = keystoreJSONTextView.value.trimmed
let privateKeyInput = privateKeyTextView.value.trimmed
let privateKeyInput = privateKeyTextView.value.trimmed.drop0x
let password = passwordTextField.value.trimmed
let watchInput = watchAddressTextField.value.trimmed

Loading…
Cancel
Save