From 6f113dd7b3b4de918c4efb81d38a1ffe1d391b5b Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 27 Sep 2016 11:57:29 +0200 Subject: OLMKit: Make the project build Make OLMKit CocoaPods expose the obj-c wrapper of libolm --- xcode/OLMKit.xcodeproj/project.pbxproj | 522 +++++++++++++++++++++++++++++++++ 1 file changed, 522 insertions(+) create mode 100644 xcode/OLMKit.xcodeproj/project.pbxproj (limited to 'xcode/OLMKit.xcodeproj/project.pbxproj') diff --git a/xcode/OLMKit.xcodeproj/project.pbxproj b/xcode/OLMKit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b50341b --- /dev/null +++ b/xcode/OLMKit.xcodeproj/project.pbxproj @@ -0,0 +1,522 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 3274F6021D9A633A005282E4 /* OLMKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3274F5F81D9A633A005282E4 /* OLMKit.framework */; }; + 3274F6071D9A633A005282E4 /* OLMKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3274F6061D9A633A005282E4 /* OLMKitTests.m */; }; + 3274F6131D9A698E005282E4 /* OLMKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3274F6121D9A698E005282E4 /* OLMKit.h */; }; + 7DBAD311AEA85CF6DB80DCFA /* libPods-OLMKitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7123FABE917D0FB140E036B7 /* libPods-OLMKitTests.a */; }; + D667051A0BA47E17CCC4E5D7 /* libPods-OLMKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F2F22FE8F173AF845B882805 /* libPods-OLMKit.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 3274F6031D9A633A005282E4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3274F5EF1D9A633A005282E4 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3274F5F71D9A633A005282E4; + remoteInfo = OLMKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1B226B371526F2782C9D6372 /* Pods-OLMKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OLMKit.release.xcconfig"; path = "Pods/Target Support Files/Pods-OLMKit/Pods-OLMKit.release.xcconfig"; sourceTree = ""; }; + 3274F5F81D9A633A005282E4 /* OLMKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OLMKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3274F5FC1D9A633A005282E4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3274F6011D9A633A005282E4 /* OLMKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OLMKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3274F6061D9A633A005282E4 /* OLMKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OLMKitTests.m; sourceTree = ""; }; + 3274F6081D9A633A005282E4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3274F6121D9A698E005282E4 /* OLMKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OLMKit.h; sourceTree = ""; }; + 7123FABE917D0FB140E036B7 /* libPods-OLMKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OLMKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 875BA7A520258EA15A31DD82 /* Pods-OLMKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OLMKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OLMKitTests/Pods-OLMKitTests.debug.xcconfig"; sourceTree = ""; }; + D48E486DAE1F59F4F7EA8C25 /* Pods-OLMKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OLMKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-OLMKitTests/Pods-OLMKitTests.release.xcconfig"; sourceTree = ""; }; + E50E6B16E3433A5EB3297DEE /* Pods-OLMKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OLMKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OLMKit/Pods-OLMKit.debug.xcconfig"; sourceTree = ""; }; + F2F22FE8F173AF845B882805 /* libPods-OLMKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OLMKit.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3274F5F41D9A633A005282E4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D667051A0BA47E17CCC4E5D7 /* libPods-OLMKit.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3274F5FE1D9A633A005282E4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3274F6021D9A633A005282E4 /* OLMKit.framework in Frameworks */, + 7DBAD311AEA85CF6DB80DCFA /* libPods-OLMKitTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1FA3F53DFAAAA773F07F5E56 /* Pods */ = { + isa = PBXGroup; + children = ( + E50E6B16E3433A5EB3297DEE /* Pods-OLMKit.debug.xcconfig */, + 1B226B371526F2782C9D6372 /* Pods-OLMKit.release.xcconfig */, + 875BA7A520258EA15A31DD82 /* Pods-OLMKitTests.debug.xcconfig */, + D48E486DAE1F59F4F7EA8C25 /* Pods-OLMKitTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 3274F5EE1D9A633A005282E4 = { + isa = PBXGroup; + children = ( + 3274F5FA1D9A633A005282E4 /* OLMKit */, + 3274F6051D9A633A005282E4 /* OLMKitTests */, + 3274F5F91D9A633A005282E4 /* Products */, + 1FA3F53DFAAAA773F07F5E56 /* Pods */, + A5D2E6F079A29F7CC2A8D9FE /* Frameworks */, + ); + sourceTree = ""; + }; + 3274F5F91D9A633A005282E4 /* Products */ = { + isa = PBXGroup; + children = ( + 3274F5F81D9A633A005282E4 /* OLMKit.framework */, + 3274F6011D9A633A005282E4 /* OLMKitTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 3274F5FA1D9A633A005282E4 /* OLMKit */ = { + isa = PBXGroup; + children = ( + 3274F6121D9A698E005282E4 /* OLMKit.h */, + 3274F5FC1D9A633A005282E4 /* Info.plist */, + ); + path = OLMKit; + sourceTree = ""; + }; + 3274F6051D9A633A005282E4 /* OLMKitTests */ = { + isa = PBXGroup; + children = ( + 3274F6061D9A633A005282E4 /* OLMKitTests.m */, + 3274F6081D9A633A005282E4 /* Info.plist */, + ); + path = OLMKitTests; + sourceTree = ""; + }; + A5D2E6F079A29F7CC2A8D9FE /* Frameworks */ = { + isa = PBXGroup; + children = ( + F2F22FE8F173AF845B882805 /* libPods-OLMKit.a */, + 7123FABE917D0FB140E036B7 /* libPods-OLMKitTests.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 3274F5F51D9A633A005282E4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 3274F6131D9A698E005282E4 /* OLMKit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3274F5F71D9A633A005282E4 /* OLMKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3274F60C1D9A633B005282E4 /* Build configuration list for PBXNativeTarget "OLMKit" */; + buildPhases = ( + 7FBCB292198F4156D9CA3B8D /* [CP] Check Pods Manifest.lock */, + 3274F5F31D9A633A005282E4 /* Sources */, + 3274F5F41D9A633A005282E4 /* Frameworks */, + 3274F5F51D9A633A005282E4 /* Headers */, + 3274F5F61D9A633A005282E4 /* Resources */, + 30F93582035CD30D211A6C76 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OLMKit; + productName = OLMKit; + productReference = 3274F5F81D9A633A005282E4 /* OLMKit.framework */; + productType = "com.apple.product-type.framework"; + }; + 3274F6001D9A633A005282E4 /* OLMKitTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3274F60F1D9A633B005282E4 /* Build configuration list for PBXNativeTarget "OLMKitTests" */; + buildPhases = ( + 47E69E5BE6A019858DC41D4F /* [CP] Check Pods Manifest.lock */, + 3274F5FD1D9A633A005282E4 /* Sources */, + 3274F5FE1D9A633A005282E4 /* Frameworks */, + 3274F5FF1D9A633A005282E4 /* Resources */, + 0A185F0CAE96B33A4CD91B6A /* [CP] Embed Pods Frameworks */, + 793D0533290528B7C0E17CAD /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3274F6041D9A633A005282E4 /* PBXTargetDependency */, + ); + name = OLMKitTests; + productName = OLMKitTests; + productReference = 3274F6011D9A633A005282E4 /* OLMKitTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3274F5EF1D9A633A005282E4 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0800; + ORGANIZATIONNAME = matrix.org; + TargetAttributes = { + 3274F5F71D9A633A005282E4 = { + CreatedOnToolsVersion = 8.0; + ProvisioningStyle = Automatic; + }; + 3274F6001D9A633A005282E4 = { + CreatedOnToolsVersion = 8.0; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 3274F5F21D9A633A005282E4 /* Build configuration list for PBXProject "OLMKit" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 3274F5EE1D9A633A005282E4; + productRefGroup = 3274F5F91D9A633A005282E4 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3274F5F71D9A633A005282E4 /* OLMKit */, + 3274F6001D9A633A005282E4 /* OLMKitTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3274F5F61D9A633A005282E4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3274F5FF1D9A633A005282E4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0A185F0CAE96B33A4CD91B6A /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-OLMKitTests/Pods-OLMKitTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 30F93582035CD30D211A6C76 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-OLMKit/Pods-OLMKit-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 47E69E5BE6A019858DC41D4F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 793D0533290528B7C0E17CAD /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-OLMKitTests/Pods-OLMKitTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 7FBCB292198F4156D9CA3B8D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3274F5F31D9A633A005282E4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3274F5FD1D9A633A005282E4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3274F6071D9A633A005282E4 /* OLMKitTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 3274F6041D9A633A005282E4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3274F5F71D9A633A005282E4 /* OLMKit */; + targetProxy = 3274F6031D9A633A005282E4 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 3274F60A1D9A633B005282E4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3274F60B1D9A633B005282E4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 3274F60D1D9A633B005282E4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E50E6B16E3433A5EB3297DEE /* Pods-OLMKit.debug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = OLMKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = org.matrix.OLMKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 3274F60E1D9A633B005282E4 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1B226B371526F2782C9D6372 /* Pods-OLMKit.release.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = OLMKit/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = org.matrix.OLMKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 3274F6101D9A633B005282E4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 875BA7A520258EA15A31DD82 /* Pods-OLMKitTests.debug.xcconfig */; + buildSettings = { + INFOPLIST_FILE = OLMKitTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = org.matrix.OLMKitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 3274F6111D9A633B005282E4 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D48E486DAE1F59F4F7EA8C25 /* Pods-OLMKitTests.release.xcconfig */; + buildSettings = { + INFOPLIST_FILE = OLMKitTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = org.matrix.OLMKitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3274F5F21D9A633A005282E4 /* Build configuration list for PBXProject "OLMKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3274F60A1D9A633B005282E4 /* Debug */, + 3274F60B1D9A633B005282E4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3274F60C1D9A633B005282E4 /* Build configuration list for PBXNativeTarget "OLMKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3274F60D1D9A633B005282E4 /* Debug */, + 3274F60E1D9A633B005282E4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3274F60F1D9A633B005282E4 /* Build configuration list for PBXNativeTarget "OLMKitTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3274F6101D9A633B005282E4 /* Debug */, + 3274F6111D9A633B005282E4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3274F5EF1D9A633A005282E4 /* Project object */; +} -- cgit v1.2.3-70-g09d2 From 7ae6410f3714cb56d337213fb47afddbb5935cf9 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 10 Oct 2016 18:00:54 +0200 Subject: OLMKit: Add tests for OLMInboundGroupSession and OLMOutboundGroupSession --- xcode/OLMKit.xcodeproj/project.pbxproj | 4 ++ xcode/OLMKitTests/OLMKitGroupTests.m | 76 +++++++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 15 deletions(-) (limited to 'xcode/OLMKit.xcodeproj/project.pbxproj') diff --git a/xcode/OLMKit.xcodeproj/project.pbxproj b/xcode/OLMKit.xcodeproj/project.pbxproj index b50341b..fa02539 100644 --- a/xcode/OLMKit.xcodeproj/project.pbxproj +++ b/xcode/OLMKit.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 3274F6021D9A633A005282E4 /* OLMKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3274F5F81D9A633A005282E4 /* OLMKit.framework */; }; 3274F6071D9A633A005282E4 /* OLMKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3274F6061D9A633A005282E4 /* OLMKitTests.m */; }; 3274F6131D9A698E005282E4 /* OLMKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3274F6121D9A698E005282E4 /* OLMKit.h */; }; + 32A151311DABDD4300400192 /* OLMKitGroupTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32A151301DABDD4300400192 /* OLMKitGroupTests.m */; }; 7DBAD311AEA85CF6DB80DCFA /* libPods-OLMKitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7123FABE917D0FB140E036B7 /* libPods-OLMKitTests.a */; }; D667051A0BA47E17CCC4E5D7 /* libPods-OLMKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F2F22FE8F173AF845B882805 /* libPods-OLMKit.a */; }; /* End PBXBuildFile section */ @@ -32,6 +33,7 @@ 3274F6061D9A633A005282E4 /* OLMKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OLMKitTests.m; sourceTree = ""; }; 3274F6081D9A633A005282E4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3274F6121D9A698E005282E4 /* OLMKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OLMKit.h; sourceTree = ""; }; + 32A151301DABDD4300400192 /* OLMKitGroupTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OLMKitGroupTests.m; sourceTree = ""; }; 7123FABE917D0FB140E036B7 /* libPods-OLMKitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OLMKitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 875BA7A520258EA15A31DD82 /* Pods-OLMKitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OLMKitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OLMKitTests/Pods-OLMKitTests.debug.xcconfig"; sourceTree = ""; }; D48E486DAE1F59F4F7EA8C25 /* Pods-OLMKitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OLMKitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-OLMKitTests/Pods-OLMKitTests.release.xcconfig"; sourceTree = ""; }; @@ -104,6 +106,7 @@ isa = PBXGroup; children = ( 3274F6061D9A633A005282E4 /* OLMKitTests.m */, + 32A151301DABDD4300400192 /* OLMKitGroupTests.m */, 3274F6081D9A633A005282E4 /* Info.plist */, ); path = OLMKitTests; @@ -318,6 +321,7 @@ buildActionMask = 2147483647; files = ( 3274F6071D9A633A005282E4 /* OLMKitTests.m in Sources */, + 32A151311DABDD4300400192 /* OLMKitGroupTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/xcode/OLMKitTests/OLMKitGroupTests.m b/xcode/OLMKitTests/OLMKitGroupTests.m index bcf83ef..9f5ad10 100644 --- a/xcode/OLMKitTests/OLMKitGroupTests.m +++ b/xcode/OLMKitTests/OLMKitGroupTests.m @@ -1,13 +1,25 @@ -// -// OLMKitGroupTests.m -// OLMKit -// -// Created by Emmanuel ROHEE on 10/10/16. -// Copyright © 2016 matrix.org. All rights reserved. -// +/* + Copyright 2016 OpenMarket Ltd + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ #import +#import + +#include "olm/olm.h" + @interface OLMKitGroupTests : XCTestCase @end @@ -24,16 +36,50 @@ [super tearDown]; } -- (void)testExample { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. +- (void)testAliceAndBob { + + OLMOutboundGroupSession *aliceSession = [[OLMOutboundGroupSession alloc] initOutboundGroupSession]; + XCTAssertGreaterThan(aliceSession.sessionIdentifier.length, 0); + XCTAssertGreaterThan(aliceSession.sessionKey.length, 0); + XCTAssertEqual(aliceSession.messageIndex, 0); + + // Store the session key before starting encrypting + NSString *sessionKey = aliceSession.sessionKey; + + NSString *message = @"Hello!"; + NSString *aliceToBobMsg = [aliceSession encryptMessage:message]; + + XCTAssertEqual(aliceSession.messageIndex, 1); + XCTAssertGreaterThanOrEqual(aliceToBobMsg.length, 0); + + OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:sessionKey]; + XCTAssertEqualObjects(aliceSession.sessionIdentifier, bobSession.sessionIdentifier); + + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + XCTAssertEqualObjects(message, plaintext); +} + +- (void)testOutboundGroupSessionSerialization { + + OLMOutboundGroupSession *aliceSession = [[OLMOutboundGroupSession alloc] initOutboundGroupSession]; + + NSData *aliceData = [NSKeyedArchiver archivedDataWithRootObject:aliceSession]; + OLMOutboundGroupSession *aliceSession2 = [NSKeyedUnarchiver unarchiveObjectWithData:aliceData]; + + XCTAssertEqualObjects(aliceSession2.sessionKey, aliceSession.sessionKey); + XCTAssertEqualObjects(aliceSession2.sessionIdentifier, aliceSession.sessionIdentifier); } -- (void)testPerformanceExample { - // This is an example of a performance test case. - [self measureBlock:^{ - // Put the code you want to measure the time of here. - }]; +- (void)testInboundGroupSessionSerialization { + + OLMOutboundGroupSession *aliceSession = [[OLMOutboundGroupSession alloc] initOutboundGroupSession]; + + OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:aliceSession.sessionKey]; + + NSData *bobData = [NSKeyedArchiver archivedDataWithRootObject:bobSession]; + OLMInboundGroupSession *bobSession2 = [NSKeyedUnarchiver unarchiveObjectWithData:bobData]; + + XCTAssertEqualObjects(bobSession2.sessionIdentifier, aliceSession.sessionIdentifier); } @end -- cgit v1.2.3-70-g09d2 From 27a8c28da4e5c62d8863ee3d30642109d713c4d6 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 7 Nov 2016 17:27:09 +0100 Subject: OLMKit: Update obj-c wrapper to 2.0.0 --- OLMKit.podspec | 4 ++-- xcode/OLMKit.xcodeproj/project.pbxproj | 4 ++-- xcode/OLMKit/OLMInboundGroupSession.h | 2 +- xcode/OLMKit/OLMInboundGroupSession.m | 4 ++-- xcode/OLMKitTests/OLMKitGroupTests.m | 4 +++- xcode/Podfile.lock | 14 +++++++------- 6 files changed, 17 insertions(+), 15 deletions(-) (limited to 'xcode/OLMKit.xcodeproj/project.pbxproj') diff --git a/OLMKit.podspec b/OLMKit.podspec index 3c56773..0877e3a 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -1,8 +1,8 @@ Pod::Spec.new do |s| # The libolm version - MAJOR = 1 - MINOR = 3 + MAJOR = 2 + MINOR = 0 PATCH = 0 s.name = "OLMKit" diff --git a/xcode/OLMKit.xcodeproj/project.pbxproj b/xcode/OLMKit.xcodeproj/project.pbxproj index fa02539..0ec7587 100644 --- a/xcode/OLMKit.xcodeproj/project.pbxproj +++ b/xcode/OLMKit.xcodeproj/project.pbxproj @@ -273,7 +273,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 793D0533290528B7C0E17CAD /* [CP] Copy Pods Resources */ = { @@ -303,7 +303,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/xcode/OLMKit/OLMInboundGroupSession.h b/xcode/OLMKit/OLMInboundGroupSession.h index a507490..46de3a0 100644 --- a/xcode/OLMKit/OLMInboundGroupSession.h +++ b/xcode/OLMKit/OLMInboundGroupSession.h @@ -24,6 +24,6 @@ - (NSString*)sessionIdentifier; /** base64 ciphertext -> UTF-8 plaintext */ -- (NSString*)decryptMessage:(NSString*)message; +- (NSString*)decryptMessage:(NSString*)message messageIndex:(NSUInteger*)messageIndex; @end diff --git a/xcode/OLMKit/OLMInboundGroupSession.m b/xcode/OLMKit/OLMInboundGroupSession.m index d95d1ab..ea79e14 100644 --- a/xcode/OLMKit/OLMInboundGroupSession.m +++ b/xcode/OLMKit/OLMInboundGroupSession.m @@ -79,7 +79,7 @@ return idString; } -- (NSString *)decryptMessage:(NSString *)message +- (NSString *)decryptMessage:(NSString *)message messageIndex:(NSUInteger*)messageIndex { NSParameterAssert(message != nil); NSData *messageData = [message dataUsingEncoding:NSUTF8StringEncoding]; @@ -96,7 +96,7 @@ // message buffer is destroyed by olm_group_decrypt_max_plaintext_length mutMessage = messageData.mutableCopy; NSMutableData *plaintextData = [NSMutableData dataWithLength:maxPlaintextLength]; - size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length); + size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length, messageIndex); if (plaintextLength == olm_error()) { const char *error = olm_inbound_group_session_last_error(session); NSAssert(NO, @"olm_group_decrypt error: %s", error); diff --git a/xcode/OLMKitTests/OLMKitGroupTests.m b/xcode/OLMKitTests/OLMKitGroupTests.m index 9f5ad10..cdfb704 100644 --- a/xcode/OLMKitTests/OLMKitGroupTests.m +++ b/xcode/OLMKitTests/OLMKitGroupTests.m @@ -55,8 +55,10 @@ OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:sessionKey]; XCTAssertEqualObjects(aliceSession.sessionIdentifier, bobSession.sessionIdentifier); - NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + NSUInteger messageIndex; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg messageIndex:&messageIndex]; XCTAssertEqualObjects(message, plaintext); + XCTAssertEqual(messageIndex, 0); } - (void)testOutboundGroupSessionSerialization { diff --git a/xcode/Podfile.lock b/xcode/Podfile.lock index b091109..3ac110a 100644 --- a/xcode/Podfile.lock +++ b/xcode/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - OLMKit (1.3.0): - - OLMKit/olmc (= 1.3.0) - - OLMKit/olmcpp (= 1.3.0) - - OLMKit/olmc (1.3.0) - - OLMKit/olmcpp (1.3.0) + - OLMKit (2.0.0): + - OLMKit/olmc (= 2.0.0) + - OLMKit/olmcpp (= 2.0.0) + - OLMKit/olmc (2.0.0) + - OLMKit/olmcpp (2.0.0) DEPENDENCIES: - OLMKit (from `../OLMKit.podspec`) @@ -13,8 +13,8 @@ EXTERNAL SOURCES: :path: ../OLMKit.podspec SPEC CHECKSUMS: - OLMKit: 49b73677a77988cc25e51d023f39a8a3e451cb23 + OLMKit: ed17cdf7695bc0de1e2bf98243eb65f5b9ddebc1 PODFILE CHECKSUM: 4e261dae61d833ec5585ced2473023b98909fd35 -COCOAPODS: 1.0.1 +COCOAPODS: 1.1.1 -- cgit v1.2.3-70-g09d2 From 7ee17a295738f0db8cab74cec2343a577f2ade45 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 14 Nov 2016 17:35:24 +0100 Subject: OLMKit: Add missing implementations for matchesInboundSession matchesInboundSessionFrom --- xcode/OLMKit.xcodeproj/project.pbxproj | 8 +++++--- xcode/OLMKit/OLMSession.m | 35 ++++++++++++++++++++++++++++++++++ xcode/OLMKitTests/OLMKitTests.m | 11 +++++++++-- xcode/Podfile.lock | 2 +- 4 files changed, 50 insertions(+), 6 deletions(-) (limited to 'xcode/OLMKit.xcodeproj/project.pbxproj') diff --git a/xcode/OLMKit.xcodeproj/project.pbxproj b/xcode/OLMKit.xcodeproj/project.pbxproj index 0ec7587..a3b636f 100644 --- a/xcode/OLMKit.xcodeproj/project.pbxproj +++ b/xcode/OLMKit.xcodeproj/project.pbxproj @@ -182,7 +182,7 @@ 3274F5EF1D9A633A005282E4 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0810; ORGANIZATIONNAME = matrix.org; TargetAttributes = { 3274F5F71D9A633A005282E4 = { @@ -273,7 +273,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 793D0533290528B7C0E17CAD /* [CP] Copy Pods Resources */ = { @@ -303,7 +303,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -354,6 +354,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -405,6 +406,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/xcode/OLMKit/OLMSession.m b/xcode/OLMKit/OLMSession.m index a47deb1..eee65a9 100644 --- a/xcode/OLMKit/OLMSession.m +++ b/xcode/OLMKit/OLMSession.m @@ -156,6 +156,41 @@ return idString; } +- (BOOL)matchesInboundSession:(NSString *)oneTimeKeyMessage { + NSData *otk = [oneTimeKeyMessage dataUsingEncoding:NSUTF8StringEncoding]; + + size_t result = olm_matches_inbound_session(_session, otk.bytes, otk.length); + if (result == 1) { + return YES; + } + else { + if (result == olm_error()) { + const char *error = olm_session_last_error(_session); + NSLog(@"olm_matches_inbound_session error: %s", error); + } + return NO; + } +} + +- (BOOL)matchesInboundSessionFrom:(NSString *)theirIdentityKey oneTimeKeyMessage:(NSString *)oneTimeKeyMessage { + NSData *idKey = [theirIdentityKey dataUsingEncoding:NSUTF8StringEncoding]; + NSData *otk = [oneTimeKeyMessage dataUsingEncoding:NSUTF8StringEncoding]; + + size_t result = olm_matches_inbound_session_from(_session, + idKey.bytes, idKey.length, + otk.bytes, otk.length); + if (result == 1) { + return YES; + } + else { + if (result == olm_error()) { + const char *error = olm_session_last_error(_session); + NSLog(@"olm_matches_inbound_session error: %s", error); + } + return NO; + } +} + - (OLMMessage*) encryptMessage:(NSString*)message error:(NSError**)error { size_t messageType = olm_encrypt_message_type(_session); size_t randomLength = olm_encrypt_random_length(_session); diff --git a/xcode/OLMKitTests/OLMKitTests.m b/xcode/OLMKitTests/OLMKitTests.m index 251c90e..1adbde2 100644 --- a/xcode/OLMKitTests/OLMKitTests.m +++ b/xcode/OLMKitTests/OLMKitTests.m @@ -52,6 +52,15 @@ NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg error:&error]; XCTAssertEqualObjects(message, plaintext); XCTAssertNil(error); + + XCTAssert([bobSession matchesInboundSession:aliceToBobMsg.ciphertext]); + XCTAssertFalse([aliceSession matchesInboundSession:@"ARandomOtkMessage"]); + + NSString *aliceIdKey = alice.identityKeys[@"curve25519"]; + XCTAssert([bobSession matchesInboundSessionFrom:aliceIdKey oneTimeKeyMessage:aliceToBobMsg.ciphertext]); + XCTAssertFalse([bobSession matchesInboundSessionFrom:@"ARandomIdKey" oneTimeKeyMessage:aliceToBobMsg.ciphertext]); + XCTAssertFalse([bobSession matchesInboundSessionFrom:aliceIdKey oneTimeKeyMessage:@"ARandomOtkMessage"]); + BOOL success = [bob removeOneTimeKeysForSession:bobSession]; XCTAssertTrue(success); } @@ -96,8 +105,6 @@ XCTAssertEqualObjects(msg1, dMsg1); XCTAssertEqualObjects(msg2, dMsg2); XCTAssertEqualObjects(msg3, dMsg3); - - } - (void) testAccountSerialization { diff --git a/xcode/Podfile.lock b/xcode/Podfile.lock index 3ac110a..2d69849 100644 --- a/xcode/Podfile.lock +++ b/xcode/Podfile.lock @@ -13,7 +13,7 @@ EXTERNAL SOURCES: :path: ../OLMKit.podspec SPEC CHECKSUMS: - OLMKit: ed17cdf7695bc0de1e2bf98243eb65f5b9ddebc1 + OLMKit: 5f2894a210ca99ad17128af4fd3beeeeb0eca404 PODFILE CHECKSUM: 4e261dae61d833ec5585ced2473023b98909fd35 -- cgit v1.2.3-70-g09d2