From 468c4b6f61c2c2fa5b5c910db51490551b963d37 Mon Sep 17 00:00:00 2001 From: AshCenso Date: Tue, 28 Aug 2018 08:49:34 +0300 Subject: [PATCH] remove cryptoswift --- Nynja-Bridging-Header.h | 1 + .../Resources/Nynja-Share-Bridging-Header.h | 9 +++ Nynja.xcodeproj/project.pbxproj | 76 +++++++++++++------ .../Array/ArrayExtension+UInt8.swift | 15 ++++ .../SwiftLibrary/String/String+Crypto.swift | 56 ++++++++++++++ Nynja/Services/StorageService.swift | 1 - .../Array/ArrayExtensionUInt8Test.swift | 22 ++++++ .../Foundation/String/StringCryptoTest.swift | 27 +++++++ Podfile | 4 +- 9 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 Nynja-Share/Resources/Nynja-Share-Bridging-Header.h create mode 100644 Nynja/Extensions/SwiftLibrary/Array/ArrayExtension+UInt8.swift create mode 100644 Nynja/Extensions/SwiftLibrary/String/String+Crypto.swift create mode 100644 NynjaUnitTests/Extensions/Foundation/Array/ArrayExtensionUInt8Test.swift create mode 100644 NynjaUnitTests/Extensions/Foundation/String/StringCryptoTest.swift diff --git a/Nynja-Bridging-Header.h b/Nynja-Bridging-Header.h index 6bd4e17a6..f6bb2d72e 100644 --- a/Nynja-Bridging-Header.h +++ b/Nynja-Bridging-Header.h @@ -7,3 +7,4 @@ //#import "SDWebImage/UIImageView+WebCache.h" //#import "SDWebImage/SDWebImageManager.h" #import "NynjaSDK/NynjaSDK.h" +#import diff --git a/Nynja-Share/Resources/Nynja-Share-Bridging-Header.h b/Nynja-Share/Resources/Nynja-Share-Bridging-Header.h new file mode 100644 index 000000000..288defdf2 --- /dev/null +++ b/Nynja-Share/Resources/Nynja-Share-Bridging-Header.h @@ -0,0 +1,9 @@ +// +// Nynja-Share-Bridging-Header.h +// Nynja +// +// Created by Ash on 8/23/18. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +#import diff --git a/Nynja.xcodeproj/project.pbxproj b/Nynja.xcodeproj/project.pbxproj index a5dbe2362..87beb6568 100644 --- a/Nynja.xcodeproj/project.pbxproj +++ b/Nynja.xcodeproj/project.pbxproj @@ -629,7 +629,15 @@ 5C468A609C445962C0D19DD3 /* HistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D6900257B1AB2CA0BC834EB /* HistoryViewController.swift */; }; 5DBBAAF3AAB09B2D4E71B806 /* AddContactViaPhoneViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FB993F14055EAE59F572530 /* AddContactViaPhoneViewController.swift */; }; 5E278E14F45F56BACB71271C /* VideoPreviewWireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F5541C91FE7845F3E5C7EB2 /* VideoPreviewWireframe.swift */; }; + 5E3D9CF02134AE94004EA746 /* StringCryptoTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E3D9CEF2134AE94004EA746 /* StringCryptoTest.swift */; }; + 5E546BF42133D9080072648B /* ArrayExtension+UInt8.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EC261E92133CF32008E360D /* ArrayExtension+UInt8.swift */; }; + 5EAA699D2134ACF30086D5ED /* String+Crypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EAA699C2134ACF30086D5ED /* String+Crypto.swift */; }; + 5EAA699E2134ACF30086D5ED /* String+Crypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EAA699C2134ACF30086D5ED /* String+Crypto.swift */; }; + 5EAA69A02134AD2F0086D5ED /* String+Crypto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EAA699C2134ACF30086D5ED /* String+Crypto.swift */; }; 5EB13FDBA6153EE67366115F /* ScheduleMessageInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5095F3CF5921F107D81C8652 /* ScheduleMessageInteractor.swift */; }; + 5EC261EA2133CF32008E360D /* ArrayExtension+UInt8.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EC261E92133CF32008E360D /* ArrayExtension+UInt8.swift */; }; + 5EC261EB2133CF52008E360D /* ArrayExtension+UInt8.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EC261E92133CF32008E360D /* ArrayExtension+UInt8.swift */; }; + 5EC261F02133CFDB008E360D /* ArrayExtensionUInt8Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EC261EF2133CFDB008E360D /* ArrayExtensionUInt8Test.swift */; }; 5ED473EC698E99DC021E553A /* MapSearchInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BD49CF323041B47A752603E /* MapSearchInteractor.swift */; }; 619C44B00CC7B169077CDEC2 /* EditProfileProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B377AA90A6B6BA0120C31F1 /* EditProfileProtocols.swift */; }; 628E2C26BE0854DB1DF64990 /* SplashWireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = C22259D46BE5732B494C4C7D /* SplashWireframe.swift */; }; @@ -1546,12 +1554,9 @@ A4A242482060373000B0A804 /* BaseHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4A242472060373000B0A804 /* BaseHandler.swift */; }; A4A242492060373A00B0A804 /* BaseHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4A242472060373000B0A804 /* BaseHandler.swift */; }; A4A2424F2060390000B0A804 /* Handlers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4A2424E2060390000B0A804 /* Handlers.swift */; }; - A4AB8E512105EB60005F9B0C /* TextFieldTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4AB8E502105EB60005F9B0C /* TextFieldTest.swift */; }; A4AB8E522105EC46005F9B0C /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = A43B258720AB1DFA00FF8107 /* TextField.swift */; }; A4AB8E532105EC4B005F9B0C /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A46032512105D3E1009783DA /* TextView.swift */; }; A4AB8E542105EC9A005F9B0C /* InputsCachePolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A460324E2105C9A1009783DA /* InputsCachePolicy.swift */; }; - A4AB8E562105ECD7005F9B0C /* TextViewTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4AB8E552105ECD7005F9B0C /* TextViewTest.swift */; }; - A4AB8E582105F47C005F9B0C /* InputsCachePolicyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4AB8E572105F47C005F9B0C /* InputsCachePolicyTest.swift */; }; A4B32EB5207E89A4009838C8 /* PlaceDescriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B32EB4207E89A4009838C8 /* PlaceDescriptionView.swift */; }; A4B544E620EFAECE00EB7B0F /* LinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B544E520EFAECE00EB7B0F /* LinkModel.swift */; }; A4B544E820EFB15C00EB7B0F /* errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B544E720EFB15C00EB7B0F /* errors.swift */; }; @@ -2693,6 +2698,11 @@ 5BC1D38020D3B54B002A44B3 /* CallInfoViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallInfoViewLayout.swift; sourceTree = ""; }; 5BC1D38320D3B670002A44B3 /* CallCreatorMediator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallCreatorMediator.swift; sourceTree = ""; }; 5D3E868EE32625048BCB13A8 /* HistoryInteractor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = HistoryInteractor.swift; sourceTree = ""; }; + 5E3D9CEF2134AE94004EA746 /* StringCryptoTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringCryptoTest.swift; sourceTree = ""; }; + 5E5A5333212ECA0200BCEDE5 /* Nynja-Share-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Nynja-Share-Bridging-Header.h"; sourceTree = ""; }; + 5EAA699C2134ACF30086D5ED /* String+Crypto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Crypto.swift"; sourceTree = ""; }; + 5EC261E92133CF32008E360D /* ArrayExtension+UInt8.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ArrayExtension+UInt8.swift"; sourceTree = ""; }; + 5EC261EF2133CFDB008E360D /* ArrayExtensionUInt8Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensionUInt8Test.swift; sourceTree = ""; }; 5EEA3D18EFB98D7959F993E4 /* AddParticipantsProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AddParticipantsProtocols.swift; sourceTree = ""; }; 5F509C0C8B9C738DBC7ABE07 /* SecurityViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SecurityViewController.swift; sourceTree = ""; }; 61B964D5CB991533BA5C164C /* HistoryPresenter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = HistoryPresenter.swift; sourceTree = ""; }; @@ -3435,9 +3445,6 @@ A4A242472060373000B0A804 /* BaseHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseHandler.swift; sourceTree = ""; }; A4A2424C206038D100B0A804 /* Handlers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Handlers.swift; sourceTree = ""; }; A4A2424E2060390000B0A804 /* Handlers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Handlers.swift; sourceTree = ""; }; - A4AB8E502105EB60005F9B0C /* TextFieldTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldTest.swift; sourceTree = ""; }; - A4AB8E552105ECD7005F9B0C /* TextViewTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewTest.swift; sourceTree = ""; }; - A4AB8E572105F47C005F9B0C /* InputsCachePolicyTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputsCachePolicyTest.swift; sourceTree = ""; }; A4B32EB4207E89A4009838C8 /* PlaceDescriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceDescriptionView.swift; sourceTree = ""; }; A4B544E520EFAECE00EB7B0F /* LinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkModel.swift; sourceTree = ""; }; A4B544E720EFB15C00EB7B0F /* errors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = errors.swift; sourceTree = ""; }; @@ -5494,6 +5501,7 @@ 356275711F9D32AE00D2A7F0 /* Resources */ = { isa = PBXGroup; children = ( + 5E5A5333212ECA0200BCEDE5 /* Nynja-Share-Bridging-Header.h */, F17209BF209237DB0018877A /* Nynja-Share.entitlements */, 357809A71F9765CF00C9680C /* MainInterface.storyboard */, 357809AA1F9765CF00C9680C /* Info.plist */, @@ -6498,6 +6506,22 @@ path = View; sourceTree = ""; }; + 5E3D9CEE2134AE7D004EA746 /* String */ = { + isa = PBXGroup; + children = ( + 5E3D9CEF2134AE94004EA746 /* StringCryptoTest.swift */, + ); + path = String; + sourceTree = ""; + }; + 5EC261ED2133CFA8008E360D /* Array */ = { + isa = PBXGroup; + children = ( + 5EC261EF2133CFDB008E360D /* ArrayExtensionUInt8Test.swift */, + ); + path = Array; + sourceTree = ""; + }; 6002E0651297C852142C0DEF /* View */ = { isa = PBXGroup; children = ( @@ -8831,6 +8855,8 @@ A421BB75210B4ED8006F2608 /* Foundation */ = { isa = PBXGroup; children = ( + 5E3D9CEE2134AE7D004EA746 /* String */, + 5EC261ED2133CFA8008E360D /* Array */, A421BB76210B4EE1006F2608 /* Dictionary */, ); path = Foundation; @@ -9174,6 +9200,7 @@ A43B25B720AB1E7600FF8107 /* String+Links.swift */, A43B25B820AB1E7600FF8107 /* String+LocationURL.swift */, A43D3C5020C56D1500A5D7D9 /* String+Search.swift */, + 5EAA699C2134ACF30086D5ED /* String+Crypto.swift */, ); path = String; sourceTree = ""; @@ -9962,16 +9989,6 @@ path = Handlers; sourceTree = ""; }; - A4AB8E4F2105EB39005F9B0C /* InputsCachePolicy */ = { - isa = PBXGroup; - children = ( - A4AB8E502105EB60005F9B0C /* TextFieldTest.swift */, - A4AB8E552105ECD7005F9B0C /* TextViewTest.swift */, - A4AB8E572105F47C005F9B0C /* InputsCachePolicyTest.swift */, - ); - path = InputsCachePolicy; - sourceTree = ""; - }; A4B544ED20EFB48A00EB7B0F /* BERT */ = { isa = PBXGroup; children = ( @@ -11485,6 +11502,7 @@ 4B1D7E102029FF5000703228 /* Array+WheelItemModel.swift */, 4B4266C2204D923400194BC1 /* Array+UIView.swift */, 26DCB25320692237001EF0AB /* Array+Feature.swift */, + 5EC261E92133CF32008E360D /* ArrayExtension+UInt8.swift */, ); path = Array; sourceTree = ""; @@ -12280,7 +12298,6 @@ isa = PBXGroup; children = ( A421BB74210B4EC2006F2608 /* Extensions */, - A4AB8E4F2105EB39005F9B0C /* InputsCachePolicy */, FB816EEC20B5B30E00093DCD /* Services */, F1C37AAD209A1BF4005EA197 /* Info.plist */, ); @@ -12994,7 +13011,7 @@ "${BUILT_PRODUCTS_DIR}/CryptoSwift/CryptoSwift.framework", "${BUILT_PRODUCTS_DIR}/GRDBCipher/GRDBCipher.framework", "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", - "${BUILT_PRODUCTS_DIR}/GoogleToolboxForMac/GoogleToolboxForMac.framework", + "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", "${BUILT_PRODUCTS_DIR}/JTAppleCalendar/JTAppleCalendar.framework", "${BUILT_PRODUCTS_DIR}/MDFTextAccessibility/MDFTextAccessibility.framework", "${BUILT_PRODUCTS_DIR}/MaterialComponents/MaterialComponents.framework", @@ -13018,7 +13035,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CryptoSwift.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRDBCipher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleToolboxForMac.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JTAppleCalendar.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MDFTextAccessibility.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MaterialComponents.framework", @@ -13053,6 +13070,7 @@ "${BUILT_PRODUCTS_DIR}/JTAppleCalendar/JTAppleCalendar.framework", "${BUILT_PRODUCTS_DIR}/MDFTextAccessibility/MDFTextAccessibility.framework", "${BUILT_PRODUCTS_DIR}/MaterialComponents/MaterialComponents.framework", + "${PODS_ROOT}/NynjaSDK/NynjaSDK.framework", "${BUILT_PRODUCTS_DIR}/QRCode/QRCode.framework", "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SQLCipher/SQLCipher.framework", @@ -13072,6 +13090,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JTAppleCalendar.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MDFTextAccessibility.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MaterialComponents.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NynjaSDK.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QRCode.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLCipher.framework", @@ -13182,6 +13201,7 @@ F11786EA20AC374E007A9A1B /* Color.swift in Sources */, 265F5D27209B6D39008ACCC8 /* GCD.swift in Sources */, A497F56B20EFA86C005CC60F /* HandlerService.swift in Sources */, + 5EC261EB2133CF52008E360D /* ArrayExtension+UInt8.swift in Sources */, A4F3DAAA208493C100FF71C7 /* StorageService.swift in Sources */, A42CE56C20692EDB000889CC /* p2p.swift in Sources */, 85458CF6212D770900BA8814 /* Message+Files.swift in Sources */, @@ -13427,6 +13447,7 @@ A42CE5DC20692EDB000889CC /* iterator_Spec.swift in Sources */, A42CE5CA20692EDB000889CC /* Profile_Spec.swift in Sources */, A42CE58E20692EDB000889CC /* ok2.swift in Sources */, + 5EAA699E2134ACF30086D5ED /* String+Crypto.swift in Sources */, F11786EB20AC3778007A9A1B /* Configurable.swift in Sources */, 26B32B6B1FE1717900888A0A /* WeakRef.swift in Sources */, A42CE5D220692EDB000889CC /* receiveTask_Spec.swift in Sources */, @@ -13851,6 +13872,7 @@ 2648B1501FEAA889007F2AAE /* IdBuilder.swift in Sources */, 2C95C06FF47CF32C3B35FF4F /* TutorialInteractor.swift in Sources */, 8EBFF1692004033F00CC4C25 /* GroupAudiosCell.swift in Sources */, + 5EAA699D2134ACF30086D5ED /* String+Crypto.swift in Sources */, 855AC540208E45AA00DC2335 /* StickerCellModel.swift in Sources */, 3A2A99831EFAD2FB002749B3 /* PageControl.swift in Sources */, E784388156A5228026955A54 /* TutorialWireframe.swift in Sources */, @@ -14039,6 +14061,7 @@ 854751492093BDD300F8D5F8 /* CollectionViewScrollProxy.swift in Sources */, 850C301B204DA87A00DB26C2 /* PrivacyListPresenter.swift in Sources */, 267BE28E1FDE9FCC00C47E18 /* SettingsGroupWireFrame.swift in Sources */, + 5EC261EA2133CF32008E360D /* ArrayExtension+UInt8.swift in Sources */, A4679BA620B2DD0F0021FE9C /* SubscribersSelectorWireFrame.swift in Sources */, 2648C41A2069B52100863614 /* ChangeNumberViewLayout.swift in Sources */, 8514D52420EE48A30002378A /* NynjaContextMenuItemsFactory+Messages.swift in Sources */, @@ -15179,7 +15202,6 @@ FB816EF820B5B89700093DCD /* StringAtom.swift in Sources */, A4CB153A21039BD800C3B68B /* JailbreakDetectorTest.swift in Sources */, FB816EF420B5B85E00093DCD /* Room.swift in Sources */, - A4AB8E562105ECD7005F9B0C /* TextViewTest.swift in Sources */, 85458CFB212D7B2100BA8814 /* FeatureExtension+BERT.swift in Sources */, 85458CF9212D785A00BA8814 /* DescExtension+BERT.swift in Sources */, A49EE6D7210B110800B700B1 /* Link.swift in Sources */, @@ -15189,14 +15211,16 @@ 85458CE6212D73CF00BA8814 /* P2pExtension.swift in Sources */, A4330A582109D6130060BD93 /* QueryFactory.swift in Sources */, A49EE6DC210B257000B700B1 /* UserInfo.swift in Sources */, + 5E546BF42133D9080072648B /* ArrayExtension+UInt8.swift in Sources */, A49EE6D8210B110C00B700B1 /* Service.swift in Sources */, - A4AB8E582105F47C005F9B0C /* InputsCachePolicyTest.swift in Sources */, + 5EC261F02133CFDB008E360D /* ArrayExtensionUInt8Test.swift in Sources */, FB816EF920B5B8A700093DCD /* Desc.swift in Sources */, 852003FC20D45B48007C0036 /* BertBinConvertible.swift in Sources */, FB816EF320B5B85900093DCD /* Contact.swift in Sources */, A4AB8E542105EC9A005F9B0C /* InputsCachePolicy.swift in Sources */, 85458CDB212D6FFE00BA8814 /* String+Split.swift in Sources */, A4AB8E532105EC4B005F9B0C /* TextView.swift in Sources */, + 5EAA69A02134AD2F0086D5ED /* String+Crypto.swift in Sources */, FB816EFA20B5B8B000093DCD /* Member.swift in Sources */, A4CB153C21039C1B00C3B68B /* JDMechanism.swift in Sources */, 85458CF1212D75D300BA8814 /* mucExtension+BERT.swift in Sources */, @@ -15204,12 +15228,12 @@ 85458CF7212D771700BA8814 /* MessageExtension.swift in Sources */, FB816EF620B5B88C00093DCD /* Message.swift in Sources */, 85458CF0212D75CE00BA8814 /* p2pExtension+BERT.swift in Sources */, + 5E3D9CF02134AE94004EA746 /* StringCryptoTest.swift in Sources */, A49EE6DB210B254A00B700B1 /* UserInfoTest.swift in Sources */, A406E39C210B482100435B3E /* DictionaryExtension.swift in Sources */, A4123DD72102324900AF585A /* KeychainService.swift in Sources */, FB816EF720B5B89100093DCD /* Feature.swift in Sources */, A421BB78210B4EEF006F2608 /* DictionaryExtensionTest.swift in Sources */, - A4AB8E512105EB60005F9B0C /* TextFieldTest.swift in Sources */, FB816EF120B5B5C200093DCD /* HistoryRequestModel.swift in Sources */, A406E396210B34D300435B3E /* QueryFactoryTest.swift in Sources */, ); @@ -15319,6 +15343,7 @@ PROVISIONING_PROFILE = "69f3dc99-df33-4a29-8a8a-8d93926a3535"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Share/Resources/Nynja-Share-Bridging-Header.h"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -15348,6 +15373,7 @@ PROVISIONING_PROFILE_SPECIFIER = ProductionBundle_AppstoreExt; SKIP_INSTALL = YES; SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Share/Resources/Nynja-Share-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -15646,6 +15672,7 @@ PROVISIONING_PROFILE = "0ac45157-141b-4e67-9a87-602efcd8cb35"; PROVISIONING_PROFILE_SPECIFIER = DevBundle_DevExt; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Share/Resources/Nynja-Share-Bridging-Header.h"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -15714,6 +15741,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -15836,6 +15864,7 @@ PROVISIONING_PROFILE = "f232c367-7000-49c5-b32c-0efb36c5f2e3"; PROVISIONING_PROFILE_SPECIFIER = NynjaRC_adhocExt; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Share/Resources/Nynja-Share-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -15905,6 +15934,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -15929,6 +15959,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -15953,6 +15984,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nynja.mobile.communicator.NynjaUnitTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Nynja-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension+UInt8.swift b/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension+UInt8.swift new file mode 100644 index 000000000..19ddc24ee --- /dev/null +++ b/Nynja/Extensions/SwiftLibrary/Array/ArrayExtension+UInt8.swift @@ -0,0 +1,15 @@ +// +// ArrayExtension+UInt8.swift +// Nynja +// +// Created by Ash on 8/27/18. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +import Foundation + +extension Array where Element == UInt8 { + func toBase64() -> String? { + return Data(bytes: self).base64EncodedString() + } +} diff --git a/Nynja/Extensions/SwiftLibrary/String/String+Crypto.swift b/Nynja/Extensions/SwiftLibrary/String/String+Crypto.swift new file mode 100644 index 000000000..5edcf59d6 --- /dev/null +++ b/Nynja/Extensions/SwiftLibrary/String/String+Crypto.swift @@ -0,0 +1,56 @@ +// +// String+Crypto.swift +// Nynja +// +// Created by Ash on 8/28/18. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +import Foundation + + +extension String { + func sha256() -> String { + if let stringData = data(using: .utf8) { + return hexStringFromData(input: digest(input: stringData as NSData)) + } + + return "" + } + + func md5() -> String { + let length = Int(CC_MD5_DIGEST_LENGTH) + var digest = [UInt8](repeating: 0, count: length) + + if let d = data(using: .utf8) { + let _ = d.withUnsafeBytes { (body: UnsafePointer) in + CC_MD5(body, CC_LONG(d.count), &digest) + } + } + + return (0.. NSData { + let digestLength = Int(CC_SHA256_DIGEST_LENGTH) + var hash = [UInt8](repeating: 0, count: digestLength) + CC_SHA256(input.bytes, UInt32(input.length), &hash) + return NSData(bytes: hash, length: digestLength) + } + + func hexStringFromData(input: NSData) -> String { + var bytes = [UInt8](repeating: 0, count: input.length) + input.getBytes(&bytes, length: input.length) + + var hexString = "" + for byte in bytes { + hexString += String(format:"%02x", UInt8(byte)) + } + + return hexString + } +} diff --git a/Nynja/Services/StorageService.swift b/Nynja/Services/StorageService.swift index f977495ac..d489c629a 100644 --- a/Nynja/Services/StorageService.swift +++ b/Nynja/Services/StorageService.swift @@ -8,7 +8,6 @@ import Foundation import GRDBCipher -import CryptoSwift //MARK: - The Game is began class StorageService { diff --git a/NynjaUnitTests/Extensions/Foundation/Array/ArrayExtensionUInt8Test.swift b/NynjaUnitTests/Extensions/Foundation/Array/ArrayExtensionUInt8Test.swift new file mode 100644 index 000000000..bc267448a --- /dev/null +++ b/NynjaUnitTests/Extensions/Foundation/Array/ArrayExtensionUInt8Test.swift @@ -0,0 +1,22 @@ +// +// ArrayExtensionUInt8Test.swift +// NynjaUnitTests +// +// Created by Ash on 8/27/18. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +import XCTest + +class ArrayExtensionUInt8Test: XCTestCase { + + let initialValue: [UInt8] = [10, 20, 12, 144, 6, 18] + let gage: String = "ChQMkAYS" + + + func testArrayToBase64Method() { + let base64 = initialValue.toBase64() + + XCTAssertEqual(base64, gage) + } +} diff --git a/NynjaUnitTests/Extensions/Foundation/String/StringCryptoTest.swift b/NynjaUnitTests/Extensions/Foundation/String/StringCryptoTest.swift new file mode 100644 index 000000000..482b8ceb5 --- /dev/null +++ b/NynjaUnitTests/Extensions/Foundation/String/StringCryptoTest.swift @@ -0,0 +1,27 @@ +// +// StringCryptoTest.swift +// NynjaUnitTests +// +// Created by Ash on 8/28/18. +// Copyright © 2018 TecSynt Solutions. All rights reserved. +// + +import XCTest + +class StringCryptoTest: XCTestCase { + private let initialString = "qwerty" + private let sha256Gage = "65e84be33532fb784c48129675f9eff3a682b27168c0ea744b2cf58ee02337c5" + private let md5Gage = "d8578edf8458ce06fbc5bb76a58c5ca4" + + func testSha256Method() { + let sha256 = initialString.sha256() + + XCTAssertEqual(sha256, sha256Gage) + } + + func testMd5Method() { + let md5 = initialString.md5() + + XCTAssertEqual(md5, md5Gage) + } +} diff --git a/Podfile b/Podfile index 24d6d400b..3e86f8476 100644 --- a/Podfile +++ b/Podfile @@ -40,8 +40,6 @@ def commonPodsForNynja pod 'JTAppleCalendar', '~> 7.0' pod 'NynjaSDK', '~> 1.4.2' - - pod 'CryptoSwift' end def commonPodsForNynjaTests @@ -62,6 +60,7 @@ def commonPodsForNynjaTests pod 'AutoScrollLabel' pod 'MaterialComponents/FlexibleHeader' pod 'JTAppleCalendar', '~> 7.0' + pod 'NynjaSDK', '~> 1.4.2' end def commonPodsForNynjaShare @@ -71,7 +70,6 @@ def commonPodsForNynjaShare pod 'SnapKit', '~> 4.0.0' pod 'SDWebImage', '~> 4.0' pod 'GRDBCipher', '~> 2.10.0' - pod 'CryptoSwift' end def commonPodsForNynjaUIKit -- GitLab