Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

Commit

Permalink
Strip 0x when saving keys (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandro-isaza committed Feb 20, 2018
1 parent 449d928 commit 39e8750
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
11 changes: 10 additions & 1 deletion Sources/KeystoreKey.swift
Expand Up @@ -173,9 +173,18 @@ extension KeystoreKey: Codable {

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(address.description, forKey: .address)
try container.encode(address.description.drop0x(), forKey: .address)
try container.encode(id, forKey: .id)
try container.encode(crypto, forKey: .crypto)
try container.encode(version, forKey: .version)
}
}

private extension String {
func drop0x() -> String {
if hasPrefix("0x") {
return String(dropFirst(2))
}
return self
}
}
7 changes: 4 additions & 3 deletions TrustKeystore.podspec
@@ -1,16 +1,17 @@
Pod::Spec.new do |s|
s.name = 'TrustKeystore'
s.version = '0.1.3'
s.version = '0.2.0'
s.summary = 'A general-purpose Ethereum keystore for managing wallets.'
s.homepage = 'https://github.com/TrustWallet/trust-keystore'
s.license = 'GPL'
s.authors = { 'Alejandro Isaza' => 'al@isaza.ca' }

s.ios.deployment_target = '9.0'
s.ios.deployment_target = '10.0'

s.source = { git: 'https://github.com/TrustWallet/trust-keystore.git', tag: s.version }
s.source_files = "Sources"
s.source_files = "Sources/**/*.swift"

s.dependency 'BigInt'
s.dependency 'CryptoSwift'
s.dependency 'secp256k1_ios', '~> 0.1.0'
s.dependency 'TrezorCrypto'
Expand Down
2 changes: 0 additions & 2 deletions TrustKeystore.xcodeproj/project.pbxproj
Expand Up @@ -704,7 +704,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = Benchmark/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.trustwalletapp.KeystoreBenchmark;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -720,7 +719,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = Benchmark/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.trustwalletapp.KeystoreBenchmark;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down

0 comments on commit 39e8750

Please sign in to comment.