Browse Source

IOSAD-227 Fix the sources

IOSAD-227
Dirk Zimmermann 9 months ago
parent
commit
763536d047
48 changed files with 4 additions and 328 deletions
  1. +4
    -3
      build-mac/pEpObjCAdapter.xcodeproj/project.pbxproj
  2. +0
    -57
      pEpObjCAdapter/build-linux/GNUmakefile
  3. +0
    -41
      pEpObjCAdapter/build-linux/README.md
  4. +0
    -7
      pEpObjCAdapter/build-linux/build-dependencies.sh
  5. +0
    -11
      pEpObjCAdapter/build-linux/dependency_builder/buildPEPObjCAdapterProtocols.sh
  6. +0
    -11
      pEpObjCAdapter/build-linux/dependency_builder/buildPEPObjCTypeUtils.sh
  7. +0
    -72
      pEpObjCAdapter/build-linux/test_project/GNUmakefile
  8. +0
    -16
      pEpObjCAdapter/build-linux/test_project/README.md
  9. +0
    -11
      pEpObjCAdapter/build-linux/test_project/build-dependencies.sh
  10. +0
    -99
      pEpObjCAdapter/build-linux/test_project/main.m
  11. +0
    -0
      src/Extensions/NSArray+Take.h
  12. +0
    -0
      src/Extensions/NSArray+Take.m
  13. +0
    -0
      src/Extensions/NSNumber+PEPRating+Internal.h
  14. +0
    -0
      src/Extensions/NSNumber+PEPRating.m
  15. +0
    -0
      src/Extensions/NSString+NormalizePassphrase.h
  16. +0
    -0
      src/Extensions/NSString+NormalizePassphrase.m
  17. +0
    -0
      src/Extensions/PEPIdentity+Reset.h
  18. +0
    -0
      src/Extensions/PEPIdentity+Reset.m
  19. +0
    -0
      src/Extensions/PEPInternalSession+PassphraseCache.h
  20. +0
    -0
      src/Extensions/PEPInternalSession+PassphraseCache.m
  21. +0
    -0
      src/Logger.h
  22. +0
    -0
      src/Logger.m
  23. +0
    -0
      src/PEPAutoPointer.h
  24. +0
    -0
      src/PEPAutoPointer.m
  25. +0
    -0
      src/PEPCSVScanner.h
  26. +0
    -0
      src/PEPCSVScanner.m
  27. +0
    -0
      src/PEPCopyableThread.h
  28. +0
    -0
      src/PEPCopyableThread.m
  29. +0
    -0
      src/PEPInternalConstants.h
  30. +0
    -0
      src/PEPInternalConstants.m
  31. +0
    -0
      src/PEPInternalSession.h
  32. +0
    -0
      src/PEPInternalSession.m
  33. +0
    -0
      src/PEPObjCAdapter+Internal.h
  34. +0
    -0
      src/PEPObjCAdapter.m
  35. +0
    -0
      src/PEPPassphraseCache.h
  36. +0
    -0
      src/PEPPassphraseCache.m
  37. +0
    -0
      src/PEPPassphraseCacheEntry.h
  38. +0
    -0
      src/PEPPassphraseCacheEntry.m
  39. +0
    -0
      src/PEPPassphraseCacheInternal.h
  40. +0
    -0
      src/PEPPassphraseUtil.h
  41. +0
    -0
      src/PEPPassphraseUtil.m
  42. +0
    -0
      src/PEPQueue.h
  43. +0
    -0
      src/PEPQueue.m
  44. +0
    -0
      src/PEPSession.m
  45. +0
    -0
      src/PEPSessionProvider.h
  46. +0
    -0
      src/PEPSessionProvider.m
  47. +0
    -0
      src/PEPSync.m
  48. +0
    -0
      src/PEPSync_Internal.h

+ 4
- 3
build-mac/pEpObjCAdapter.xcodeproj/project.pbxproj View File

@ -545,7 +545,7 @@
35FB0ABD1B57F99D00377032 /* Security.framework */,
35FB0ABB1B57F97E00377032 /* CFNetwork.framework */,
1552D99B257663F200A92F71 /* PublicHeaders */,
43209B251ECC2ACD007E7E2E /* pEpObjCAdapter */,
43209B251ECC2ACD007E7E2E /* src */,
1552D93C2576602D00A92F71 /* PEPObjCAdapter_macOS */,
1543DC67257943CE0041EFB5 /* PEPObjCAdapter_iOS */,
64415E181BE94FCB00F6CBB2 /* pEpObjCTests */,
@ -567,7 +567,7 @@
name = Products;
sourceTree = "<group>";
};
43209B251ECC2ACD007E7E2E /* pEpObjCAdapter */ = {
43209B251ECC2ACD007E7E2E /* src */ = {
isa = PBXGroup;
children = (
438C0EE1254026E200337922 /* Extensions */,
@ -600,7 +600,8 @@
43E1A7AB252B421D00307A7D /* Logger.h */,
15C3089326E8B8550013F39F /* Logger.m */,
);
path = pEpObjCAdapter;
name = src;
path = ../src;
sourceTree = "<group>";
};
43447C51221D448500B6323E /* Frameworks */ = {


+ 0
- 57
pEpObjCAdapter/build-linux/GNUmakefile View File

@ -1,57 +0,0 @@
#
# Dox: http://www.gnustep.org/resources/documentation/make_1.html
#
# To Run: `make messages=yes shared=no debug=yes
#
# Include the common variables defined by the Makefile Package
include $(GNUSTEP_MAKEFILES)/common.make
# Build Dependencies
SHELL_RESULT := $(shell ./build-dependencies.sh)
LIBRARY_NAME = pEpObjCAdapter
# Build pre-compiled prefix header
GNUSTEPHELPER_DIR=../../../pepgnustephelper
FLAGS_FOR_PRECOMPILED_HEADER_DEBUG="-pthread -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1 -DGNUSTEP_BASE_LIBRARY=1 -I./obj/pEpObjCTypes.obj/PrecompiledHeaders/ObjC -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fobjc-runtime=gnustep-2.0 -fobjc-arc -fPIC -g -fblocks -fobjc-runtime=gnustep-2.0 -fblocks -fconstant-string-class=NSConstantString -I../PublicHeaders/ -I../src/ -I../src/PEPEqualableTools -I. -I/home/user/GNUstep/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/System/Library/Headers -fblocks -x objective-c -I/usr/include/libxml2 -I/usr/include/libxml2 -I/usr/include/p11-kit-1"
FLAGS_FOR_PRECOMPILED_HEADER_RELEASE="-pthread -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1 -DGNUSTEP_BASE_LIBRARY=1 -I./obj/pEpObjCTypes.obj/PrecompiledHeaders/ObjC -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fobjc-runtime=gnustep-2.0 -fobjc-arc -fPIC -g -O2 -fblocks -fobjc-runtime=gnustep-2.0 -fblocks -fconstant-string-class=NSConstantString -I../PublicHeaders/ -I../src/ -I../src/PEPEqualableTools -I. -I/home/user/GNUstep/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/System/Library/Headers -fblocks -x objective-c -I/usr/include/libxml2 -I/usr/include/libxml2 -I/usr/include/p11-kit-1"
ifeq ($(debug), yes)
FLAGS_FOR_PRECOMPILED_HEADER = ${FLAGS_FOR_PRECOMPILED_HEADER_DEBUG}
else
FLAGS_FOR_PRECOMPILED_HEADER = ${FLAGS_FOR_PRECOMPILED_HEADER_RELEASE}
endif
SHELL_RESULT := $(shell ${GNUSTEPHELPER_DIR}/build-precompiled-header.sh ${FLAGS_FOR_PRECOMPILED_HEADER})
# Keep. Useful to manually figure out flags for precompiled header.
# pEpObjCAdapter_OBJC_PRECOMPILED_HEADERS = PEPObjCGNUStepOptimizations.h
# Header Search Paths
#Finds all dirs containing headers and prefixes with "-I"
ALL_LOCAL_INCLUDE_HEADER_DIRS_PREFIXED := $(shell find ~/local/include/ -type d | sed -e 's/^/-I/;')
PEP_OBJC_TYPES_HEADER_DIRS_PREFIXED := -I../../Subprojects/PEPObjCTypes/PEPObjCTypes/PublicHeaders/
PEP_OBJC_TYPE_UTILS_HEADER_DIRS_PREFIXED := -I../../Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/PublicHeaders/
PEP_OBJC_ADAPTER_PROTOCOLS_HEADER_DIRS_PREFIXED := -I../../Subprojects/PEPObjCAdapterProtocols/PEPObjCAdapterProtocols/PublicHeaders/
PEP_OBJC_ADAPTER_HEADER_DIRS_PREFIXED := $(shell find ../../pEpObjCAdapter/ -type d | sed -e 's/^/-I/;')
pEpObjCAdapter_INCLUDE_DIRS = ${PEP_OBJC_ADAPTER_HEADER_DIRS_PREFIXED} ${ALL_LOCAL_INCLUDE_HEADER_DIRS_PREFIXED} ${PEP_OBJC_TYPES_HEADER_DIRS_PREFIXED} ${PEP_OBJC_TYPE_UTILS_HEADER_DIRS_PREFIXED} ${PEP_OBJC_ADAPTER_PROTOCOLS_HEADER_DIRS_PREFIXED}
# SRC Files
ALL_DOT_M_FILES := $(shell find ../ -type f -name "*.m")
pEpObjCAdapter_OBJC_FILES = ${ALL_DOT_M_FILES}
pEpObjCAdapter_RESOURCE_FILES =
# Build Settings
pEpObjCAdapter_LDFLAGS = ../../Subprojects/PEPObjCTypes/PEPObjCTypes/build-linux/build/libpEpObjCTypes.a ../../Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/build-linux/build/libpEpObjCTypeUtils.a ../../Subprojects/PEPObjCAdapterProtocols/PEPObjCAdapterProtocols/build-linux/build/libpEpObjCAdapterProtocols.a
ADDITIONAL_OBJCFLAGS += -include-pch PEPObjCGNUStepOptimizations.h.gch -Winvalid-pch
ADDITIONAL_OBJC_LIBS = -ldispatch
ADDITIONAL_FLAGS = -fobjc-runtime=gnustep-2.0 -fobjc-arc -fPIC -g -O0
HEADER_FILES_INSTALL_DIR = build
# For lib
include $(GNUSTEP_MAKEFILES)/library.make
# Copy Artefacts
SHELL_RESULT := $(shell mkdir -p build)
SHELL_RESULT := $(shell cp obj/*.a build/)

+ 0
- 41
pEpObjCAdapter/build-linux/README.md View File

@ -1,41 +0,0 @@
# HowToBuild pEpObjCAdapter for Linux
Only Debian 11 is currently tested.
Our GNUstep envirnoment must be setup. You can find HowTo setup GNUstep on Debian 11 [here](https://devdocs.pep.security/IPSec/Team%20%26%20Development/Objective-C/Cross%20Platform%20Objective-C%20%26%20Swift/Cross%20Platform%20Objective-C/VirtualBox%20Setup%20-%3E%20Debian%2011%20Plus%20GNUstep.html). There is also a Debian 11 Virtual Box image with GNUstep already setup (find info [here](https://devdocs.pep.security/IPSec/Team%20%26%20Development/Objective-C/Cross%20Platform%20Objective-C%20%26%20Swift/Cross%20Platform%20Objective-C/HowTo%20-%3E%20Build%20GNUstep%20On%20Debian%2011.html)).
## Install Required Tools
````
apt install sudo curl git build-essential python3 clang pkg-config nettle-dev capnproto libssl-dev python3-lxml libtool autoconf uuid-dev sqlite3 libsqlite3-dev
curl https://sh.rustup.rs -sSf | sh
source ~/.bashrc
``
## Install Dependencies
```
mkdir src_pEpObjCAdapter
cd src_pEpObjCAdapter
git clone http://pep-security.lu/gitlab/ipsec/common-dependency-build-helpers-4-linux.git
cd common-dependency-build-helpers-4-linux
sh build.sh
cd ..
git clone http://pep-security.lu/gitlab/ipsec/pepgnustephelper.git
git clone https://gitea.pep.foundation/pep.foundation/pEpObjCAdapter.git
```
## Build for Linux
```
cd pEpObjCAdapter/pEpObjCAdapter/build-linux
make install messages=yes shared=yes debug=yes
```
## Known Issues
Until now we failed linking to libpEpObjCAdapter statically due to not being able to link Categories.
### Build Dir & Build Artefacts
You can find the build artefacts in `/usr/GNUstep/Local/Library/Libraries`.

+ 0
- 7
pEpObjCAdapter/build-linux/build-dependencies.sh View File

@ -1,7 +0,0 @@
SCRIPT_DIR=$(dirname "$0")
CURRENT_DIR=$(pwd)
cd ${SCRIPT_DIR}
SCRIPT_DIR=$(pwd)
sh ${SCRIPT_DIR}/dependency_builder/buildPEPObjCAdapterProtocols.sh
sh ${SCRIPT_DIR}/dependency_builder/buildPEPObjCTypeUtils.sh

+ 0
- 11
pEpObjCAdapter/build-linux/dependency_builder/buildPEPObjCAdapterProtocols.sh View File

@ -1,11 +0,0 @@
SCRIPT_DIR=$(dirname "$0")
CURRENT_DIR=$(pwd)
cd ${SCRIPT_DIR}
SCRIPT_DIR=$(pwd)
PEP_OBJC_ADAPTER_PROTOCOLS_BUILD_LINUX_DIR="${SCRIPT_DIR}/../../../Subprojects/PEPObjCAdapterProtocols/PEPObjCAdapterProtocols/build-linux"
cd ${PEP_OBJC_ADAPTER_PROTOCOLS_BUILD_LINUX_DIR}
make install messages=yes shared=no
cd ${CURRENT_DIR}

+ 0
- 11
pEpObjCAdapter/build-linux/dependency_builder/buildPEPObjCTypeUtils.sh View File

@ -1,11 +0,0 @@
SCRIPT_DIR=$(dirname "$0")
CURRENT_DIR=$(pwd)
cd ${SCRIPT_DIR}
SCRIPT_DIR=$(pwd)
PEP_OBJC_TYPEUTILS_BUILD_LINUX_DIR="${SCRIPT_DIR}/../../../Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/build-linux"
cd ${PEP_OBJC_TYPEUTILS_BUILD_LINUX_DIR}
make install messages=yes shared=no
cd ${CURRENT_DIR}

+ 0
- 72
pEpObjCAdapter/build-linux/test_project/GNUmakefile View File

@ -1,72 +0,0 @@
#
# An example GNUmakefile
#
# To Run: `make messages=yes
# Include the common variables defined by the Makefile Package
include $(GNUSTEP_MAKEFILES)/common.make
#include $(GNUSTEP_MAKEFILES)/rules.make
#######################################
# Sampel Excecutable Using PEPObjCAdapter
#######################################
# Build Dependencies
SHELL_RESULT := $(shell ./build-dependencies.sh)
TOOL_NAME = ClientOfObjcAdapter
# Build pre-compiled prefix header
GNUSTEPHELPER_DIR=../../../../pepgnustephelper
FLAGS_FOR_PRECOMPILED_HEADER_DEBUG="-pthread -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1 -DGNUSTEP_BASE_LIBRARY=1 -I./obj/pEpObjCTypes.obj/PrecompiledHeaders/ObjC -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fobjc-runtime=gnustep-2.0 -fobjc-arc -fPIC -g -fblocks -fobjc-runtime=gnustep-2.0 -fblocks -fconstant-string-class=NSConstantString -I../PublicHeaders/ -I../src/ -I../src/PEPEqualableTools -I. -I/home/user/GNUstep/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/System/Library/Headers -fblocks -x objective-c -I/usr/include/libxml2 -I/usr/include/libxml2 -I/usr/include/p11-kit-1"
FLAGS_FOR_PRECOMPILED_HEADER_RELEASE="-pthread -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1 -DGNUSTEP_BASE_LIBRARY=1 -I./obj/pEpObjCTypes.obj/PrecompiledHeaders/ObjC -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fobjc-runtime=gnustep-2.0 -fobjc-arc -fPIC -g -O2 -fblocks -fobjc-runtime=gnustep-2.0 -fblocks -fconstant-string-class=NSConstantString -I../PublicHeaders/ -I../src/ -I../src/PEPEqualableTools -I. -I/home/user/GNUstep/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers -I/usr/GNUstep/System/Library/Headers -fblocks -x objective-c -I/usr/include/libxml2 -I/usr/include/libxml2 -I/usr/include/p11-kit-1"
ifeq ($(debug), yes)
FLAGS_FOR_PRECOMPILED_HEADER = ${FLAGS_FOR_PRECOMPILED_HEADER_DEBUG}
else
FLAGS_FOR_PRECOMPILED_HEADER = ${FLAGS_FOR_PRECOMPILED_HEADER_RELEASE}
endif
SHELL_RESULT := $(shell ${GNUSTEPHELPER_DIR}/build-precompiled-header.sh ${FLAGS_FOR_PRECOMPILED_HEADER})
# Keep. Useful to manually figure out flags for precompiled header.
#pEpObjCAdapter_OBJC_PRECOMPILED_HEADERS = ${GNUSTEPHELPER_DIR}/PEPObjCGNUStepOptimizations.h
# Header Search Paths
PEP_OBJC_TYPES_HEADER_DIRS_PREFIXED := -I../../../Subprojects/PEPObjCTypes/PEPObjCTypes/PublicHeaders/
PEP_OBJC_TYPE_UTILS_HEADER_DIRS_PREFIXED := -I../../../Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/PublicHeaders/
PEP_OBJC_ADAPTER_PROTOCOLS_HEADER_DIRS_PREFIXED := -I../../../Subprojects/PEPObjCAdapterProtocols/PEPObjCAdapterProtocols/PublicHeaders/
PEP_OBJC_ADAPTER_HEADER_DIRS_PREFIXED := $(shell find ../../../pEpObjCAdapter/ -type d | sed -e 's/^/-I/;')
CLIENT_OF_OBJC_ADAPTER_HEADER_DIRS_PREFIXED := $(shell find ../ -type d | sed -e 's/^/-I/;')
ClientOfObjcAdapter_INCLUDE_DIRS = ${CLIENT_OF_OBJC_ADAPTER_HEADER_DIRS_PREFIXED} ${PEP_OBJC_TYPES_HEADER_DIRS_PREFIXED} ${PEP_OBJC_TYPE_UTILS_HEADER_DIRS_PREFIXED} ${PEP_OBJC_ADAPTER_PROTOCOLS_HEADER_DIRS_PREFIXED} ${PEP_OBJC_ADAPTER_HEADER_DIRS_PREFIXED}
# SRC Files
ALL_DOT_M_FILES := $(shell find . -type f -name "*.m")
ClientOfObjcAdapter_OBJC_FILES = main.m
ClientOfObjcAdapter_RESOURCE_FILES =
ADDITIONAL_OBJCFLAGS += -include-pch PEPObjCGNUStepOptimizations.h.gch -Winvalid-pch
ADDITIONAL_FLAGS += -fobjc-runtime=gnustep-2.0 -fobjc-arc
## Linking Libs - Take Care !! The Order *DOES* Matter
ADDITIONAL_OBJC_LIBS = -ldispatch \
-l/usr/GNUstep/Local/Library/Libraries/libpEpObjCAdapter.so \
-l/usr/GNUstep/Local/Library/Libraries/libpEpObjCAdapterProtocols.a \
-l/usr/GNUstep/Local/Library/Libraries/libpEpObjCTypeUtils.a\
-l/usr/GNUstep/Local/Library/Libraries/libpEpObjCTypes.a \
-l${HOME}/local/lib/libpEpEngine.a \
-luuid \
-lz \
-l${HOME}/local/lib/libetpan.a \
-l${HOME}/local/lib/libasn1.a \
-l${HOME}/local/lib/libsqlite3.a \
-lpthread \
-ldl \
-l${HOME}/local/lib/libsequoia_openpgp_ffi.a \
-l${HOME}/local/lib/libhogweed.a \
-l${HOME}/local/lib/libnettle.a \
-l${HOME}/local/lib/libgmp.a
# -l/usr/GNUstep/Local/Library/Libraries/libpEpObjCAdapter.a\
ADDITIONAL_LDFLAGS += -L/usr/GNUstep/Local/Library/Libraries
include $(GNUSTEP_MAKEFILES)/tool.make

+ 0
- 16
pEpObjCAdapter/build-linux/test_project/README.md View File

@ -1,16 +0,0 @@
# ClientOfObjcAdapter
Builds an executable using the pEpObjCAdapter as a POC.
Feel free to add more usages of pEpObjCAdapter to reproduce issues or such.
## HowTo Build
```
make
```
## HowTo Run
```
./obj/ClientOfObjcAdapter
```

+ 0
- 11
pEpObjCAdapter/build-linux/test_project/build-dependencies.sh View File

@ -1,11 +0,0 @@
SCRIPT_DIR=$(dirname "$0")
CURRENT_DIR=$(pwd)
cd ${SCRIPT_DIR}
SCRIPT_DIR=$(pwd)
PEP_OBJC_ADAPTER_BUILD_LINUX_DIR="${SCRIPT_DIR}/.."
cd ${PEP_OBJC_ADAPTER_BUILD_LINUX_DIR}
# chagne after finding a fix for "Categories not linked statically"
make install messages=yes shared=yes
cd ${CURRENT_DIR}

+ 0
- 99
pEpObjCAdapter/build-linux/test_project/main.m View File

@ -1,99 +0,0 @@
/// Simple test using pEpObjCAdapter on Linux & GNUstep.
#import <Foundation/Foundation.h>
#import <PEPSession.h>
#import <PEPMessage.h>
#import <PEPIdentity.h>
/// Calls myselve and encrypts a message.
void test_using_objc_adapter() {
NSLog(@"test_using_objc_adapter: Starting");
NSString *ownUserID = @"ownUserID";
NSString *ownAddress = @"me@ownAddress.com";
NSString *ownUserName = @"My Name";
PEPIdentity *me = [[PEPIdentity alloc] initWithAddress:ownAddress
userID:ownUserID
userName:ownUserName
isOwn:YES
fingerPrint:nil
commType:PEPCommTypeUnknown
language:nil];
PEPMessage *srcMsg = [PEPMessage new];
srcMsg.from = me;
srcMsg.to = @[me];
srcMsg.direction = PEPMsgDirectionOutgoing;
srcMsg.shortMessage = @"shortMessage";
srcMsg.longMessage = @"longMessage";
srcMsg.longMessageFormatted = @"longMessageFormatted";
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
dispatch_async(dispatch_get_global_queue(0, 0), ^{ // 0 == DISPATCH_QUEUE_PRORITY_DEFAULT
NSLog(@"test_using_objc_adapter: ### call myself ###");
PEPSession *session = [PEPSession new];
[session mySelf:me errorCallback:^(NSError * _Nonnull error) {
NSLog(@"Error: %@", error);
dispatch_group_leave(group);
} successCallback:^(PEPIdentity * _Nonnull identity) {
PEPSession *session = [PEPSession new];
NSLog(@"test_using_objc_adapter: ### encryptMessage ###");
[session encryptMessage:srcMsg extraKeys:nil errorCallback:^(NSError * _Nonnull error) {
NSLog(@"test_using_objc_adapter: Error encryptMessage: %@", error);
dispatch_group_leave(group);
} successCallback:^(PEPMessage * _Nonnull srcMessage, PEPMessage * _Nonnull destMessage) {
NSLog(@"test_using_objc_adapter: Encrypted message: %@", destMessage);
NSLog(@"test_using_objc_adapter: Original message: %@", srcMessage);
PEPMessage *encryptedMsg = destMessage;
PEPRating rating = PEPRatingUndefined;
PEPStringList *keys = nil;
NSLog(@"test_using_objc_adapter: ### decryptMessage ###");
[session decryptMessage:destMessage flags:NULL extraKeys:keys errorCallback:^(NSError * _Nonnull error) {
NSLog(@"test_using_objc_adapter: Error decryptMessage: %@", error);
dispatch_group_leave(group);
} successCallback:^(PEPMessage *decryptSrcMessage,
PEPMessage *decryptDstMessage,
PEPStringList *keyList,
PEPRating rating,
PEPDecryptFlags flags,
BOOL isFormerlyEncryptedReuploadedMessage) {
NSLog(@"test_using_objc_adapter: Decrypted message: %@", decryptDstMessage);
NSLog(@"test_using_objc_adapter: keyList: %@", keyList);
NSLog(@"test_using_objc_adapter: rating: %d", rating);
NSLog(@"test_using_objc_adapter: keyList: %d", flags);
NSLog(@"test_using_objc_adapter: isFormerlyEncryptedReuploadedMessage: %d", isFormerlyEncryptedReuploadedMessage);
dispatch_group_leave(group);
}];
}];
}];
});
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
NSLog(@"test_using_objc_adapter: Done");
});
NSLog(@"test_using_objc_adapter: waiting for adapter to return");
}
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSLog(@"main");
test_using_objc_adapter();
NSLog(@"Entering runloop");
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[runLoop run];
}
NSLog(@"bye!");
return 0;
}

pEpObjCAdapter/Extensions/NSArray+Take.h → src/Extensions/NSArray+Take.h View File


pEpObjCAdapter/Extensions/NSArray+Take.m → src/Extensions/NSArray+Take.m View File


pEpObjCAdapter/Extensions/NSNumber+PEPRating+Internal.h → src/Extensions/NSNumber+PEPRating+Internal.h View File


pEpObjCAdapter/Extensions/NSNumber+PEPRating.m → src/Extensions/NSNumber+PEPRating.m View File


pEpObjCAdapter/Extensions/NSString+NormalizePassphrase.h → src/Extensions/NSString+NormalizePassphrase.h View File


pEpObjCAdapter/Extensions/NSString+NormalizePassphrase.m → src/Extensions/NSString+NormalizePassphrase.m View File


pEpObjCAdapter/Extensions/PEPIdentity+Reset.h → src/Extensions/PEPIdentity+Reset.h View File


pEpObjCAdapter/Extensions/PEPIdentity+Reset.m → src/Extensions/PEPIdentity+Reset.m View File


pEpObjCAdapter/Extensions/PEPInternalSession+PassphraseCache.h → src/Extensions/PEPInternalSession+PassphraseCache.h View File


pEpObjCAdapter/Extensions/PEPInternalSession+PassphraseCache.m → src/Extensions/PEPInternalSession+PassphraseCache.m View File


pEpObjCAdapter/Logger.h → src/Logger.h View File


pEpObjCAdapter/Logger.m → src/Logger.m View File


pEpObjCAdapter/PEPAutoPointer.h → src/PEPAutoPointer.h View File


pEpObjCAdapter/PEPAutoPointer.m → src/PEPAutoPointer.m View File


pEpObjCAdapter/PEPCSVScanner.h → src/PEPCSVScanner.h View File


pEpObjCAdapter/PEPCSVScanner.m → src/PEPCSVScanner.m View File


pEpObjCAdapter/PEPCopyableThread.h → src/PEPCopyableThread.h View File


pEpObjCAdapter/PEPCopyableThread.m → src/PEPCopyableThread.m View File


pEpObjCAdapter/PEPInternalConstants.h → src/PEPInternalConstants.h View File


pEpObjCAdapter/PEPInternalConstants.m → src/PEPInternalConstants.m View File


pEpObjCAdapter/PEPInternalSession.h → src/PEPInternalSession.h View File


pEpObjCAdapter/PEPInternalSession.m → src/PEPInternalSession.m View File


pEpObjCAdapter/PEPObjCAdapter+Internal.h → src/PEPObjCAdapter+Internal.h View File


pEpObjCAdapter/PEPObjCAdapter.m → src/PEPObjCAdapter.m View File


pEpObjCAdapter/PEPPassphraseCache.h → src/PEPPassphraseCache.h View File


pEpObjCAdapter/PEPPassphraseCache.m → src/PEPPassphraseCache.m View File


pEpObjCAdapter/PEPPassphraseCacheEntry.h → src/PEPPassphraseCacheEntry.h View File


pEpObjCAdapter/PEPPassphraseCacheEntry.m → src/PEPPassphraseCacheEntry.m View File


pEpObjCAdapter/PEPPassphraseCacheInternal.h → src/PEPPassphraseCacheInternal.h View File


pEpObjCAdapter/PEPPassphraseUtil.h → src/PEPPassphraseUtil.h View File


pEpObjCAdapter/PEPPassphraseUtil.m → src/PEPPassphraseUtil.m View File


pEpObjCAdapter/PEPQueue.h → src/PEPQueue.h View File


pEpObjCAdapter/PEPQueue.m → src/PEPQueue.m View File


pEpObjCAdapter/PEPSession.m → src/PEPSession.m View File


pEpObjCAdapter/PEPSessionProvider.h → src/PEPSessionProvider.h View File


pEpObjCAdapter/PEPSessionProvider.m → src/PEPSessionProvider.m View File


pEpObjCAdapter/PEPSync.m → src/PEPSync.m View File


pEpObjCAdapter/PEPSync_Internal.h → src/PEPSync_Internal.h View File


Loading…
Cancel
Save