From 9c5580ba909cbaf1c34386f8f47f033516f12a9f Mon Sep 17 00:00:00 2001 From: Russel Date: Tue, 28 Jul 2020 11:24:02 +0300 Subject: [PATCH 1/3] remove unnecessary file --- Crypto/Chaincode.swift | 8 ------- Crypto/KeypairFactory.swift | 8 ------- Crypto/SR25519KeypairFactory.swift | 8 ------- Crypto/SeedFactory.swift | 36 ------------------------------ 4 files changed, 60 deletions(-) delete mode 100644 Crypto/Chaincode.swift delete mode 100644 Crypto/KeypairFactory.swift delete mode 100644 Crypto/SR25519KeypairFactory.swift delete mode 100644 Crypto/SeedFactory.swift diff --git a/Crypto/Chaincode.swift b/Crypto/Chaincode.swift deleted file mode 100644 index b0d8726..0000000 --- a/Crypto/Chaincode.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// Chaincode.swift -// FearlessUtils -// -// Created by Ruslan Rezin on 24.07.2020. -// - -import Foundation diff --git a/Crypto/KeypairFactory.swift b/Crypto/KeypairFactory.swift deleted file mode 100644 index 6cf47c8..0000000 --- a/Crypto/KeypairFactory.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// KeypairFactory.swift -// FearlessUtils -// -// Created by Ruslan Rezin on 24.07.2020. -// - -import Foundation diff --git a/Crypto/SR25519KeypairFactory.swift b/Crypto/SR25519KeypairFactory.swift deleted file mode 100644 index 56178ba..0000000 --- a/Crypto/SR25519KeypairFactory.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// SR25519KeypairFactory.swift -// FearlessUtils -// -// Created by Ruslan Rezin on 24.07.2020. -// - -import Foundation diff --git a/Crypto/SeedFactory.swift b/Crypto/SeedFactory.swift deleted file mode 100644 index 2571931..0000000 --- a/Crypto/SeedFactory.swift +++ /dev/null @@ -1,36 +0,0 @@ -import Foundation -import IrohaCrypto - -public typealias SeedFactoryResult = (seed: Data, mnemonic: IRMnemonicProtocol) - -public protocol SeedFactoryProtocol { - func createSeed(from password: String, strength: IRMnemonicStrength) throws -> SeedFactoryResult - func deriveSeed(from mnemonicWords: String, password: String) throws -> SeedFactoryResult -} - -public struct SeedFactory: SeedFactoryProtocol { - private static let seedLength: Int = 32 - - private let seedFactory: SNBIP39SeedCreatorProtocol = SNBIP39SeedCreator() - private let mnemonicCreator: IRMnemonicCreatorProtocol - - public init(mnemonicLanguage: IRMnemonicLanguage = .english) { - mnemonicCreator = IRMnemonicCreator(language: mnemonicLanguage) - } - - public func createSeed(from password: String, - strength: IRMnemonicStrength) throws -> SeedFactoryResult { - let mnemonic = try mnemonicCreator.randomMnemonic(strength) - let seed = try seedFactory.deriveSeed(from: mnemonic.entropy(), passphrase: password) - - return SeedFactoryResult(seed: seed.prefix(Self.seedLength), mnemonic: mnemonic) - } - - public func deriveSeed(from mnemonicWords: String, - password: String) throws -> SeedFactoryResult { - let mnemonic = try mnemonicCreator.mnemonic(fromList: mnemonicWords) - let seed = try seedFactory.deriveSeed(from: mnemonic.entropy(), passphrase: password) - - return SeedFactoryResult(seed: seed.prefix(Self.seedLength), mnemonic: mnemonic) - } -} From 5ab178117bc4556963765529d2955f57938db8e0 Mon Sep 17 00:00:00 2001 From: Russel Date: Tue, 28 Jul 2020 11:31:35 +0300 Subject: [PATCH 2/3] fix tests --- FearlessUtils.podspec | 1 + Tests/Crypto/KeypairDeriviationTests.swift | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/FearlessUtils.podspec b/FearlessUtils.podspec index 6d49563..ff6425e 100644 --- a/FearlessUtils.podspec +++ b/FearlessUtils.podspec @@ -27,5 +27,6 @@ Pod::Spec.new do |s| s.test_spec do |ts| ts.source_files = 'Tests/**/*.swift' + ts.resources = ['Tests/**/*.json'] end end diff --git a/Tests/Crypto/KeypairDeriviationTests.swift b/Tests/Crypto/KeypairDeriviationTests.swift index 409fad1..83c3de2 100644 --- a/Tests/Crypto/KeypairDeriviationTests.swift +++ b/Tests/Crypto/KeypairDeriviationTests.swift @@ -4,7 +4,8 @@ import FearlessUtils class KeypairDeriviationTests: XCTestCase { func testSr25519FromTestVectors() throws { - guard let url = Bundle(for: Self.self).url(forResource: "sr25519HDKD", withExtension: "json") else { + guard let url = Bundle(for: KeypairDeriviationTests.self) + .url(forResource: "sr25519HDKD", withExtension: "json") else { XCTFail("Can't find resource") return } From ff388bf12b072c2d71626d708db458d149aeeacd Mon Sep 17 00:00:00 2001 From: Russel Date: Tue, 28 Jul 2020 11:32:05 +0300 Subject: [PATCH 3/3] version increase --- FearlessUtils.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FearlessUtils.podspec b/FearlessUtils.podspec index ff6425e..8e01d30 100644 --- a/FearlessUtils.podspec +++ b/FearlessUtils.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'FearlessUtils' - s.version = '0.1.0' + s.version = '0.2.0' s.summary = 'Utility library that implements clients specific logic to interact with substrate based networks' s.homepage = 'https://github.com/soramitsu/fearless-utils-iOS'