IOSAD-50 moves internal stuff to PEPInternalSession IOSAD-50
authorbuff <andreas@pep-project.org>
Wed, 11 Oct 2017 12:40:46 +0200
branchIOSAD-50
changeset 272c456123edfa7
parent 271 e5892f491b15
child 273 d6c7bcbbefd2
IOSAD-50 moves internal stuff to PEPInternalSession
pEpObjCAdapter.xcodeproj/project.pbxproj
pEpObjCAdapter/PEPInternalSession+Internal.h
pEpObjCAdapter/PEPInternalSession.h
pEpObjCAdapter/PEPInternalSession.m
pEpObjCAdapter/PEPObjCAdapter+Internal.h
pEpObjCAdapter/PEPObjCAdapter.h
pEpObjCAdapter/PEPObjCAdapter.m
pEpObjCAdapter/PEPSession.h
pEpObjCAdapter/PEPSession.m
pEpObjCAdapter/PEPSessionProvider.m
     1.1 --- a/pEpObjCAdapter.xcodeproj/project.pbxproj	Wed Oct 11 10:04:33 2017 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/project.pbxproj	Wed Oct 11 12:40:46 2017 +0200
     1.3 @@ -128,7 +128,6 @@
     1.4  		43209B301ECC2ACD007E7E2E /* PEPObjCAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPObjCAdapter.m; sourceTree = "<group>"; };
     1.5  		43209B311ECC2ACD007E7E2E /* PEPQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPQueue.h; sourceTree = "<group>"; };
     1.6  		43209B321ECC2ACD007E7E2E /* PEPQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPQueue.m; sourceTree = "<group>"; };
     1.7 -		43209B331ECC2ACD007E7E2E /* PEPInternalSession+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PEPInternalSession+Internal.h"; sourceTree = "<group>"; };
     1.8  		43209B341ECC2ACD007E7E2E /* PEPInternalSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPInternalSession.h; sourceTree = "<group>"; };
     1.9  		43209B351ECC2ACD007E7E2E /* PEPInternalSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPInternalSession.m; sourceTree = "<group>"; };
    1.10  		432EF6091C58B77900B6782A /* 0xB623F674.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 0xB623F674.asc; sourceTree = "<group>"; };
    1.11 @@ -224,7 +223,6 @@
    1.12  				43209B301ECC2ACD007E7E2E /* PEPObjCAdapter.m */,
    1.13  				43209B311ECC2ACD007E7E2E /* PEPQueue.h */,
    1.14  				43209B321ECC2ACD007E7E2E /* PEPQueue.m */,
    1.15 -				43209B331ECC2ACD007E7E2E /* PEPInternalSession+Internal.h */,
    1.16  				43209B341ECC2ACD007E7E2E /* PEPInternalSession.h */,
    1.17  				43209B351ECC2ACD007E7E2E /* PEPInternalSession.m */,
    1.18  				43D27DE41F5DA78700795687 /* NSDictionary+Extension.h */,
     2.1 --- a/pEpObjCAdapter/PEPInternalSession+Internal.h	Wed Oct 11 10:04:33 2017 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,136 +0,0 @@
     2.4 -//
     2.5 -//  PEPSession+Internal.h
     2.6 -//  pEpiOSAdapter
     2.7 -//
     2.8 -//  Created by Edouard Tisserant on 16.05.17.
     2.9 -//  Copyright © 2017 p≡p. All rights reserved.
    2.10 -//
    2.11 -
    2.12 -#ifndef PEPSession_internal_h
    2.13 -#define PEPSession_internal_h
    2.14 -
    2.15 -#import "PEPObjCAdapter.h"
    2.16 -
    2.17 -@interface PEPInternalSession ()
    2.18 -
    2.19 -@property (nonatomic) PEP_SESSION _Nullable session;
    2.20 -
    2.21 -- (id _Nullable)initInternal;
    2.22 -
    2.23 -/** Decrypt a message */
    2.24 -- (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    2.25 -                            dest:(PEPDict * _Nullable * _Nullable)dst
    2.26 -                            keys:(PEPStringList * _Nullable * _Nullable)keys;
    2.27 -
    2.28 -/** Re-evaluate rating of decrypted message */
    2.29 -- (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src;
    2.30 -
    2.31 -/** Encrypt a message */
    2.32 -- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    2.33 -                           extra:(nullable PEPStringList *)keys
    2.34 -                            dest:(PEPDict * _Nullable * _Nullable)dst;
    2.35 -
    2.36 -/** Encrypt a message for the given identity, which is usually a mySelf identity */
    2.37 -- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    2.38 -                        identity:(nonnull PEPDict *)identity
    2.39 -                            dest:(PEPDict * _Nullable * _Nullable)dst;
    2.40 -
    2.41 -/** Determine the status color of a message to be sent */
    2.42 -- (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg;
    2.43 -
    2.44 -/** Determine the rating of an identity */
    2.45 -- (PEP_rating)identityRating:(nonnull PEPDict *)identity;
    2.46 -
    2.47 -/** Get trustwords for a fingerprint */
    2.48 -- (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
    2.49 -                      shortened:(BOOL)shortened;
    2.50 -
    2.51 -/**
    2.52 - Supply an account used by our user himself. The identity is supplemented with the missing parts
    2.53 - 
    2.54 - An identity is a `NSDictionary` mapping a field name as `NSString` to different values.
    2.55 - An identity can have the following fields (all other keys are ignored).
    2.56 - It is not necessary to supply all fields; missing fields are supplemented by p≡p engine.
    2.57 - 
    2.58 - @"username": real name or nick name (if pseudonymous) of identity
    2.59 - @"address": URI or SMTP address
    2.60 - @"user_id": persistent unique ID for identity
    2.61 - @"lang": preferred languageID for communication with this ID (default: @"en")
    2.62 - @"fpr": fingerprint of key to use for communication with this ID
    2.63 - @"comm_type": communication type code (usually not needed)
    2.64 - 
    2.65 - As an example:
    2.66 - 
    2.67 - User has a mailbox. The mail address is "Dipul Khatri <dipul@inboxcube.com>". Then this would be:
    2.68 - 
    2.69 - NSDictionary *ident = [NSDictionary dictionaryWithObjectsAndKeys:
    2.70 - @"Dipul Khatri", @"username", @"dipul@inboxcube.com", @"address",
    2.71 - @"23", @"user_id", nil];
    2.72 - 
    2.73 - */
    2.74 -- (void)mySelf:(nonnull PEPMutableDict *)identity;
    2.75 -
    2.76 -/**
    2.77 - Supplement missing information for an arbitrary identity (used for communication partners).
    2.78 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    2.79 - */
    2.80 -- (void)updateIdentity:(nonnull PEPMutableDict *)identity;
    2.81 -
    2.82 -/**
    2.83 - Mark a key as trusted with a person.
    2.84 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    2.85 - */
    2.86 -- (void)trustPersonalKey:(nonnull PEPMutableDict *)identity;
    2.87 -
    2.88 -/**
    2.89 - if a key is not trusted by the user tell this using this message
    2.90 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    2.91 - */
    2.92 -- (void)keyMistrusted:(nonnull PEPMutableDict *)identity;
    2.93 -
    2.94 -/**
    2.95 - Use this to undo keyCompromized or trustPersonalKey
    2.96 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    2.97 - */
    2.98 -- (void)keyResetTrust:(nonnull PEPMutableDict *)identity;
    2.99 -
   2.100 -#pragma mark -- Internal API (testing etc.)
   2.101 -
   2.102 -/** For testing purpose, manual key import */
   2.103 -- (void)importKey:(nonnull NSString *)keydata;
   2.104 -
   2.105 -- (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
   2.106 -     description:(nullable NSString *)description comment:(nullable NSString *)comment;
   2.107 -
   2.108 -/**
   2.109 - Retrieves the log from the engine.
   2.110 - */
   2.111 -- (nonnull NSString *)getLog;
   2.112 -
   2.113 -/** Determine trustwords for two identities */
   2.114 -- (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   2.115 -                                    identity2:(nonnull PEPDict *)identity2
   2.116 -                                     language:(nullable NSString *)language
   2.117 -                                         full:(BOOL)full;
   2.118 -
   2.119 -/** Determine trustwords between sender of a message and receiving identity */
   2.120 -- (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   2.121 -                                   receiverDict:(nonnull PEPDict *)receiverDict
   2.122 -                                      keysArray:(PEPStringList * _Nullable)keysArray
   2.123 -                                       language:(nullable NSString *)language
   2.124 -                                           full:(BOOL)full
   2.125 -                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus;
   2.126 -
   2.127 -/**
   2.128 - @returns The list of supported languages for trustwords.
   2.129 - */
   2.130 -- (NSArray<PEPLanguage *> * _Nonnull)languageList;
   2.131 -
   2.132 -/**
   2.133 - Directly invokes the engine's undo_last_mistrust() function
   2.134 - */
   2.135 -- (PEP_STATUS)undoLastMistrust;
   2.136 -
   2.137 -@end
   2.138 -
   2.139 -#endif /* PEPSession_internal_h */
     3.1 --- a/pEpObjCAdapter/PEPInternalSession.h	Wed Oct 11 10:04:33 2017 +0200
     3.2 +++ b/pEpObjCAdapter/PEPInternalSession.h	Wed Oct 11 12:40:46 2017 +0200
     3.3 @@ -8,11 +8,135 @@
     3.4  
     3.5  #import <Foundation/Foundation.h>
     3.6  
     3.7 +#import "PEPObjCAdapter.h" //BUFF: remove 
     3.8 +
     3.9  /**
    3.10 + Represents a real pEp session (in contrat to PEPSession, which is a fake session to handle to the client).
    3.11 + Never expose this class to the user.
    3.12   N threads <-> N sessions, with the constraint that a session is never used
    3.13   in a pEpEngine call more than once at the same time.
    3.14   */
    3.15  @interface PEPInternalSession : NSObject
    3.16 +
    3.17 +@property (nonatomic) PEP_SESSION _Nullable session;
    3.18 +
    3.19  // We do not want the client to use a PEPSession. The client is supposed to use PEPObjCAdapter() only.
    3.20  // Find everything in PEPSession+Internal.h
    3.21 +
    3.22 +- (id _Nullable)initInternal;
    3.23 +
    3.24 +/** Decrypt a message */
    3.25 +- (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    3.26 +                            dest:(PEPDict * _Nullable * _Nullable)dst
    3.27 +                            keys:(PEPStringList * _Nullable * _Nullable)keys;
    3.28 +
    3.29 +/** Re-evaluate rating of decrypted message */
    3.30 +- (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src;
    3.31 +
    3.32 +/** Encrypt a message */
    3.33 +- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    3.34 +                           extra:(nullable PEPStringList *)keys
    3.35 +                            dest:(PEPDict * _Nullable * _Nullable)dst;
    3.36 +
    3.37 +/** Encrypt a message for the given identity, which is usually a mySelf identity */
    3.38 +- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    3.39 +                        identity:(nonnull PEPDict *)identity
    3.40 +                            dest:(PEPDict * _Nullable * _Nullable)dst;
    3.41 +
    3.42 +/** Determine the status color of a message to be sent */
    3.43 +- (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg;
    3.44 +
    3.45 +/** Determine the rating of an identity */
    3.46 +- (PEP_rating)identityRating:(nonnull PEPDict *)identity;
    3.47 +
    3.48 +/** Get trustwords for a fingerprint */
    3.49 +- (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
    3.50 +                      shortened:(BOOL)shortened;
    3.51 +
    3.52 +/**
    3.53 + Supply an account used by our user himself. The identity is supplemented with the missing parts
    3.54 +
    3.55 + An identity is a `NSDictionary` mapping a field name as `NSString` to different values.
    3.56 + An identity can have the following fields (all other keys are ignored).
    3.57 + It is not necessary to supply all fields; missing fields are supplemented by p≡p engine.
    3.58 +
    3.59 + @"username": real name or nick name (if pseudonymous) of identity
    3.60 + @"address": URI or SMTP address
    3.61 + @"user_id": persistent unique ID for identity
    3.62 + @"lang": preferred languageID for communication with this ID (default: @"en")
    3.63 + @"fpr": fingerprint of key to use for communication with this ID
    3.64 + @"comm_type": communication type code (usually not needed)
    3.65 +
    3.66 + As an example:
    3.67 +
    3.68 + User has a mailbox. The mail address is "Dipul Khatri <dipul@inboxcube.com>". Then this would be:
    3.69 +
    3.70 + NSDictionary *ident = [NSDictionary dictionaryWithObjectsAndKeys:
    3.71 + @"Dipul Khatri", @"username", @"dipul@inboxcube.com", @"address",
    3.72 + @"23", @"user_id", nil];
    3.73 +
    3.74 + */
    3.75 +- (void)mySelf:(nonnull PEPMutableDict *)identity;
    3.76 +
    3.77 +/**
    3.78 + Supplement missing information for an arbitrary identity (used for communication partners).
    3.79 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    3.80 + */
    3.81 +- (void)updateIdentity:(nonnull PEPMutableDict *)identity;
    3.82 +
    3.83 +/**
    3.84 + Mark a key as trusted with a person.
    3.85 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    3.86 + */
    3.87 +- (void)trustPersonalKey:(nonnull PEPMutableDict *)identity;
    3.88 +
    3.89 +/**
    3.90 + if a key is not trusted by the user tell this using this message
    3.91 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    3.92 + */
    3.93 +- (void)keyMistrusted:(nonnull PEPMutableDict *)identity;
    3.94 +
    3.95 +/**
    3.96 + Use this to undo keyCompromized or trustPersonalKey
    3.97 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    3.98 + */
    3.99 +- (void)keyResetTrust:(nonnull PEPMutableDict *)identity;
   3.100 +
   3.101 +#pragma mark -- Internal API (testing etc.)
   3.102 +
   3.103 +/** For testing purpose, manual key import */
   3.104 +- (void)importKey:(nonnull NSString *)keydata;
   3.105 +
   3.106 +- (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
   3.107 +     description:(nullable NSString *)description comment:(nullable NSString *)comment;
   3.108 +
   3.109 +/**
   3.110 + Retrieves the log from the engine.
   3.111 + */
   3.112 +- (nonnull NSString *)getLog;
   3.113 +
   3.114 +/** Determine trustwords for two identities */
   3.115 +- (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   3.116 +                                    identity2:(nonnull PEPDict *)identity2
   3.117 +                                     language:(nullable NSString *)language
   3.118 +                                         full:(BOOL)full;
   3.119 +
   3.120 +/** Determine trustwords between sender of a message and receiving identity */
   3.121 +- (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   3.122 +                                   receiverDict:(nonnull PEPDict *)receiverDict
   3.123 +                                      keysArray:(PEPStringList * _Nullable)keysArray
   3.124 +                                       language:(nullable NSString *)language
   3.125 +                                           full:(BOOL)full
   3.126 +                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus;
   3.127 +
   3.128 +/**
   3.129 + @returns The list of supported languages for trustwords.
   3.130 + */
   3.131 +- (NSArray<PEPLanguage *> * _Nonnull)languageList;
   3.132 +
   3.133 +/**
   3.134 + Directly invokes the engine's undo_last_mistrust() function
   3.135 + */
   3.136 +- (PEP_STATUS)undoLastMistrust;
   3.137 +
   3.138  @end
     4.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Wed Oct 11 10:04:33 2017 +0200
     4.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Wed Oct 11 12:40:46 2017 +0200
     4.3 @@ -7,7 +7,6 @@
     4.4  //
     4.5  
     4.6  #import "PEPInternalSession.h"
     4.7 -#import "PEPInternalSession+Internal.h"
     4.8  #import "PEPObjCAdapter.h"
     4.9  #import "PEPObjCAdapter+Internal.h"
    4.10  #import "PEPMessage.h"
     5.1 --- a/pEpObjCAdapter/PEPObjCAdapter+Internal.h	Wed Oct 11 10:04:33 2017 +0200
     5.2 +++ b/pEpObjCAdapter/PEPObjCAdapter+Internal.h	Wed Oct 11 12:40:46 2017 +0200
     5.3 @@ -13,7 +13,6 @@
     5.4  
     5.5  #import "PEPQueue.h"
     5.6  #import "PEPInternalSession.h"
     5.7 -#import "PEPInternalSession+Internal.h"
     5.8  
     5.9  @interface PEPObjCAdapter ()
    5.10  
    5.11 @@ -32,7 +31,6 @@
    5.12  + (void)bindSession:(PEPInternalSession*)session;
    5.13  + (void)unbindSession:(PEPInternalSession*)session;
    5.14  
    5.15 -
    5.16  @end
    5.17  
    5.18  #endif /* PEPIOSAdapter_Internal_h */
     6.1 --- a/pEpObjCAdapter/PEPObjCAdapter.h	Wed Oct 11 10:04:33 2017 +0200
     6.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.h	Wed Oct 11 12:40:46 2017 +0200
     6.3 @@ -8,7 +8,7 @@
     6.4  
     6.5  #import <Foundation/Foundation.h>
     6.6  
     6.7 -#import "PEPMessage.h"
     6.8 +#import "PEPSession.h"
     6.9  #include "sync_app.h"
    6.10  
    6.11  @class PEPLanguage;
    6.12 @@ -23,14 +23,8 @@
    6.13  - (PEP_STATUS)fastPolling:(bool)isfast;
    6.14  @end
    6.15  
    6.16 -typedef NSDictionary<NSString *, id> PEPDict;
    6.17 -typedef NSMutableDictionary<NSString *, id> PEPMutableDict;
    6.18 -typedef NSArray<NSString *> PEPStringList;
    6.19 -
    6.20  @interface PEPObjCAdapter : NSObject
    6.21  
    6.22 -+ (void)cleanup;
    6.23 -
    6.24  /**
    6.25   The HOME URL, where all pEp related files will be stored.
    6.26   */
    6.27 @@ -61,120 +55,4 @@
    6.28   */
    6.29  + (void)stopSync;
    6.30  
    6.31 -#pragma mark - PEPSession Public Methods
    6.32 -
    6.33 -/** Decrypt a message */
    6.34 -- (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    6.35 -                            dest:(PEPDict * _Nullable * _Nullable)dst
    6.36 -                            keys:(PEPStringList * _Nullable * _Nullable)keys;
    6.37 -
    6.38 -/** Re-evaluate rating of decrypted message */
    6.39 -- (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src;
    6.40 -
    6.41 -/** Encrypt a message */
    6.42 -- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    6.43 -                           extra:(nullable PEPStringList *)keys
    6.44 -                            dest:(PEPDict * _Nullable * _Nullable)dst;
    6.45 -
    6.46 -/** Encrypt a message for the given identity, which is usually a mySelf identity */
    6.47 -- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    6.48 -                        identity:(nonnull PEPDict *)identity
    6.49 -                            dest:(PEPDict * _Nullable * _Nullable)dst;
    6.50 -
    6.51 -/** Determine the status color of a message to be sent */
    6.52 -- (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg;
    6.53 -
    6.54 -/** Determine the rating of an identity */
    6.55 -- (PEP_rating)identityRating:(nonnull PEPDict *)identity;
    6.56 -
    6.57 -/** Get trustwords for a fingerprint */
    6.58 -- (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
    6.59 -                      shortened:(BOOL)shortened;
    6.60 -
    6.61 -/**
    6.62 - Supply an account used by our user himself. The identity is supplemented with the missing parts
    6.63 - 
    6.64 - An identity is a `NSDictionary` mapping a field name as `NSString` to different values.
    6.65 - An identity can have the following fields (all other keys are ignored).
    6.66 - It is not necessary to supply all fields; missing fields are supplemented by p≡p engine.
    6.67 - 
    6.68 - @"username": real name or nick name (if pseudonymous) of identity
    6.69 - @"address": URI or SMTP address
    6.70 - @"user_id": persistent unique ID for identity
    6.71 - @"lang": preferred languageID for communication with this ID (default: @"en")
    6.72 - @"fpr": fingerprint of key to use for communication with this ID
    6.73 - @"comm_type": communication type code (usually not needed)
    6.74 - 
    6.75 - As an example:
    6.76 - 
    6.77 - User has a mailbox. The mail address is "Dipul Khatri <dipul@inboxcube.com>". Then this would be:
    6.78 - 
    6.79 - NSDictionary *ident = [NSDictionary dictionaryWithObjectsAndKeys:
    6.80 - @"Dipul Khatri", @"username", @"dipul@inboxcube.com", @"address",
    6.81 - @"23", @"user_id", nil];
    6.82 - 
    6.83 - */
    6.84 -- (void)mySelf:(nonnull PEPMutableDict *)identity;
    6.85 -
    6.86 -/**
    6.87 - Supplement missing information for an arbitrary identity (used for communication partners).
    6.88 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    6.89 - */
    6.90 -- (void)updateIdentity:(nonnull PEPMutableDict *)identity;
    6.91 -
    6.92 -/**
    6.93 - Mark a key as trusted with a person.
    6.94 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    6.95 - */
    6.96 -- (void)trustPersonalKey:(nonnull PEPMutableDict *)identity;
    6.97 -
    6.98 -/**
    6.99 - if a key is not trusted by the user tell this using this message
   6.100 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
   6.101 - */
   6.102 -- (void)keyMistrusted:(nonnull PEPMutableDict *)identity;
   6.103 -
   6.104 -/**
   6.105 - Use this to undo keyCompromized or trustPersonalKey
   6.106 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
   6.107 - */
   6.108 -- (void)keyResetTrust:(nonnull PEPMutableDict *)identity;
   6.109 -
   6.110 -#pragma mark -- Internal API (testing etc.)
   6.111 -
   6.112 -/** For testing purpose, manual key import */
   6.113 -- (void)importKey:(nonnull NSString *)keydata;
   6.114 -
   6.115 -- (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
   6.116 -     description:(nullable NSString *)description comment:(nullable NSString *)comment;
   6.117 -
   6.118 -/**
   6.119 - Retrieves the log from the engine.
   6.120 - */
   6.121 -- (nonnull NSString *)getLog;
   6.122 -
   6.123 -/** Determine trustwords for two identities */
   6.124 -- (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   6.125 -                                    identity2:(nonnull PEPDict *)identity2
   6.126 -                                     language:(nullable NSString *)language
   6.127 -                                         full:(BOOL)full;
   6.128 -
   6.129 -/** Determine trustwords between sender of a message and receiving identity */
   6.130 -- (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   6.131 -                                   receiverDict:(nonnull PEPDict *)receiverDict
   6.132 -                                      keysArray:(PEPStringList * _Nullable)keysArray
   6.133 -                                       language:(nullable NSString *)language
   6.134 -                                           full:(BOOL)full
   6.135 -                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus;
   6.136 -
   6.137 -/**
   6.138 - @returns The list of supported languages for trustwords.
   6.139 - */
   6.140 -- (NSArray<PEPLanguage *> * _Nonnull)languageList;
   6.141 -
   6.142 -/**
   6.143 - Directly invokes the engine's undo_last_mistrust() function
   6.144 - */
   6.145 -- (PEP_STATUS)undoLastMistrust;
   6.146 -
   6.147  @end
     7.1 --- a/pEpObjCAdapter/PEPObjCAdapter.m	Wed Oct 11 10:04:33 2017 +0200
     7.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.m	Wed Oct 11 12:40:46 2017 +0200
     7.3 @@ -110,11 +110,6 @@
     7.4  
     7.5  @implementation PEPObjCAdapter
     7.6  
     7.7 -+ (void)cleanup
     7.8 -{
     7.9 -    [PEPSessionProvider cleanup];
    7.10 -}
    7.11 -
    7.12  + (void)initialize
    7.13  {
    7.14      s_homeURL = [self createApplicationDirectory];
    7.15 @@ -454,262 +449,4 @@
    7.16      
    7.17  }
    7.18  
    7.19 -#pragma mark - PEPSession Public Methods - non static
    7.20 -
    7.21 -- (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    7.22 -                            dest:(PEPDict * _Nullable * _Nullable)dst
    7.23 -                            keys:(PEPStringList * _Nullable * _Nullable)keys
    7.24 -{
    7.25 -    return [PEPObjCAdapter decryptMessageDict:src dest:(PEPDict * _Nullable * _Nullable)dst
    7.26 -                                         keys:(PEPStringList * _Nullable * _Nullable)keys];
    7.27 -}
    7.28 -
    7.29 -- (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src
    7.30 -{
    7.31 -    return [PEPObjCAdapter reEvaluateMessageRating:src];
    7.32 -}
    7.33 -
    7.34 -- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    7.35 -                           extra:(nullable PEPStringList *)keys
    7.36 -                            dest:(PEPDict * _Nullable * _Nullable)dst
    7.37 -{
    7.38 -    return [PEPObjCAdapter encryptMessageDict:src extra:keys dest:dst];
    7.39 -}
    7.40 -
    7.41 -- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    7.42 -                        identity:(nonnull PEPDict *)identity
    7.43 -                            dest:(PEPDict * _Nullable * _Nullable)dst
    7.44 -{
    7.45 -    return [PEPObjCAdapter encryptMessageDict:src identity:identity dest:dst];
    7.46 -}
    7.47 -
    7.48 -- (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg
    7.49 -{
    7.50 -    return [PEPObjCAdapter outgoingMessageColor:msg];
    7.51 -}
    7.52 -
    7.53 -- (PEP_rating)identityRating:(nonnull PEPDict *)identity
    7.54 -{
    7.55 -    return [PEPObjCAdapter identityRating:identity];
    7.56 -}
    7.57 -
    7.58 -- (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
    7.59 -                      shortened:(BOOL)shortened
    7.60 -{
    7.61 -    return [PEPObjCAdapter trustwords:fpr forLanguage:languageID shortened:shortened];
    7.62 -}
    7.63 -
    7.64 -- (void)mySelf:(nonnull PEPMutableDict *)identity
    7.65 -{
    7.66 -    [PEPObjCAdapter mySelf:identity];
    7.67 -}
    7.68 -
    7.69 -- (void)updateIdentity:(nonnull PEPMutableDict *)identity
    7.70 -{
    7.71 -    [PEPObjCAdapter updateIdentity:identity];
    7.72 -}
    7.73 -
    7.74 -- (void)trustPersonalKey:(nonnull PEPMutableDict *)identity
    7.75 -{
    7.76 -    [PEPObjCAdapter trustPersonalKey:identity];
    7.77 -}
    7.78 -
    7.79 -- (void)keyMistrusted:(nonnull PEPMutableDict *)identity
    7.80 -{
    7.81 -    [PEPObjCAdapter keyMistrusted:identity];
    7.82 -}
    7.83 -
    7.84 -- (void)keyResetTrust:(nonnull PEPMutableDict *)identity
    7.85 -{
    7.86 -    [PEPObjCAdapter keyResetTrust:identity];
    7.87 -}
    7.88 -
    7.89 -#pragma mark Internal API (testing etc.)
    7.90 -
    7.91 -- (void)importKey:(nonnull NSString *)keydata
    7.92 -{
    7.93 -    [PEPObjCAdapter importKey:keydata];
    7.94 -}
    7.95 -
    7.96 -- (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
    7.97 -     description:(nullable NSString *)description comment:(nullable NSString *)comment
    7.98 -{
    7.99 -    [PEPObjCAdapter logTitle:title entity:entity description:description comment:comment];
   7.100 -}
   7.101 -
   7.102 -- (nonnull NSString *)getLog
   7.103 -{
   7.104 -    return [PEPObjCAdapter getLog];
   7.105 -}
   7.106 -
   7.107 -- (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   7.108 -                                    identity2:(nonnull PEPDict *)identity2
   7.109 -                                     language:(nullable NSString *)language
   7.110 -                                         full:(BOOL)full
   7.111 -{
   7.112 -    return [PEPObjCAdapter getTrustwordsIdentity1:identity1
   7.113 -                                        identity2:identity2
   7.114 -                                         language:language
   7.115 -                                             full:full];
   7.116 -}
   7.117 -
   7.118 -- (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   7.119 -                                   receiverDict:(nonnull PEPDict *)receiverDict
   7.120 -                                      keysArray:(PEPStringList * _Nullable)keysArray
   7.121 -                                       language:(nullable NSString *)language
   7.122 -                                           full:(BOOL)full
   7.123 -                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus
   7.124 -{
   7.125 -    return [PEPObjCAdapter getTrustwordsMessageDict:messageDict
   7.126 -                                       receiverDict:receiverDict
   7.127 -                                          keysArray:keysArray
   7.128 -                                           language:language
   7.129 -                                               full:full
   7.130 -                                    resultingStatus:resultingStatus];
   7.131 -}
   7.132 -
   7.133 -- (NSArray<PEPLanguage *> * _Nonnull)languageList
   7.134 -{
   7.135 -    return [PEPObjCAdapter languageList];
   7.136 -}
   7.137 -
   7.138 -- (PEP_STATUS)undoLastMistrust
   7.139 -{
   7.140 -    return [PEPObjCAdapter undoLastMistrust];
   7.141 -}
   7.142 -
   7.143 -#pragma mark - PEPSession Public Methods - static
   7.144 -
   7.145 -+ (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
   7.146 -                            dest:(PEPDict * _Nullable * _Nullable)dst
   7.147 -                            keys:(PEPStringList * _Nullable * _Nullable)keys
   7.148 -{
   7.149 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.150 -    return [session decryptMessageDict:src dest:dst keys:keys];
   7.151 -}
   7.152 -
   7.153 -+ (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src
   7.154 -{
   7.155 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.156 -    return [session reEvaluateMessageRating:src];
   7.157 -}
   7.158 -
   7.159 -+ (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
   7.160 -                           extra:(nullable PEPStringList *)keys
   7.161 -                            dest:(PEPDict * _Nullable * _Nullable)dst
   7.162 -{
   7.163 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.164 -    return [session encryptMessageDict:src extra:keys dest:dst];
   7.165 -}
   7.166 -
   7.167 -+ (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
   7.168 -                        identity:(nonnull PEPDict *)identity
   7.169 -                            dest:(PEPDict * _Nullable * _Nullable)dst
   7.170 -{
   7.171 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.172 -    return [session encryptMessageDict:src identity:identity dest:dst];
   7.173 -}
   7.174 -
   7.175 -+ (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg
   7.176 -{
   7.177 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.178 -    return [session outgoingMessageColor:msg];
   7.179 -}
   7.180 -
   7.181 -+ (PEP_rating)identityRating:(nonnull PEPDict *)identity
   7.182 -{
   7.183 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.184 -    return [session identityRating:identity];
   7.185 -}
   7.186 -
   7.187 -+ (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
   7.188 -                      shortened:(BOOL)shortened
   7.189 -{
   7.190 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.191 -    return [session trustwords:fpr forLanguage:languageID shortened:shortened];
   7.192 -}
   7.193 -
   7.194 -+ (void)mySelf:(nonnull PEPMutableDict *)identity
   7.195 -{
   7.196 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.197 -    [session mySelf:identity];
   7.198 -}
   7.199 -
   7.200 -+ (void)updateIdentity:(nonnull PEPMutableDict *)identity
   7.201 -{
   7.202 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.203 -    [session updateIdentity:identity];
   7.204 -}
   7.205 -
   7.206 -+ (void)trustPersonalKey:(nonnull PEPMutableDict *)identity
   7.207 -{
   7.208 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.209 -    [session trustPersonalKey:identity];
   7.210 -}
   7.211 -
   7.212 -+ (void)keyMistrusted:(nonnull PEPMutableDict *)identity
   7.213 -{
   7.214 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.215 -    [session keyMistrusted:identity];
   7.216 -}
   7.217 -
   7.218 -+ (void)keyResetTrust:(nonnull PEPMutableDict *)identity
   7.219 -{
   7.220 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.221 -    [session keyResetTrust:identity];
   7.222 -}
   7.223 -
   7.224 -#pragma mark Internal API (testing etc.)
   7.225 -
   7.226 -+ (void)importKey:(nonnull NSString *)keydata
   7.227 -{
   7.228 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.229 -    [session importKey:keydata];
   7.230 -}
   7.231 -
   7.232 -+ (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
   7.233 -     description:(nullable NSString *)description comment:(nullable NSString *)comment
   7.234 -{
   7.235 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.236 -    [session logTitle:title entity:entity description:description comment:comment];
   7.237 -}
   7.238 -
   7.239 -+ (nonnull NSString *)getLog
   7.240 -{
   7.241 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.242 -    return [session getLog];
   7.243 -}
   7.244 -
   7.245 -+ (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   7.246 -                                    identity2:(nonnull PEPDict *)identity2
   7.247 -                                     language:(nullable NSString *)language
   7.248 -                                         full:(BOOL)full
   7.249 -{
   7.250 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.251 -    return [session getTrustwordsIdentity1:identity1 identity2:identity2 language:language full:full];
   7.252 -}
   7.253 -
   7.254 -+ (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   7.255 -                                   receiverDict:(nonnull PEPDict *)receiverDict
   7.256 -                                      keysArray:(PEPStringList * _Nullable)keysArray
   7.257 -                                       language:(nullable NSString *)language
   7.258 -                                           full:(BOOL)full
   7.259 -                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus
   7.260 -{
   7.261 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.262 -    return [session getTrustwordsMessageDict:messageDict receiverDict:receiverDict keysArray:keysArray language:language full:full resultingStatus:resultingStatus];
   7.263 -}
   7.264 -
   7.265 -+ (NSArray<PEPLanguage *> * _Nonnull)languageList
   7.266 -{
   7.267 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.268 -    return [session languageList];
   7.269 -}
   7.270 -
   7.271 -+ (PEP_STATUS)undoLastMistrust
   7.272 -{
   7.273 -    PEPInternalSession *session = [PEPSessionProvider session];
   7.274 -    return [session undoLastMistrust];
   7.275 -}
   7.276 -
   7.277  @end
     8.1 --- a/pEpObjCAdapter/PEPSession.h	Wed Oct 11 10:04:33 2017 +0200
     8.2 +++ b/pEpObjCAdapter/PEPSession.h	Wed Oct 11 12:40:46 2017 +0200
     8.3 @@ -8,6 +8,138 @@
     8.4  
     8.5  #import <Foundation/Foundation.h>
     8.6  
     8.7 +#import "PEPMessage.h"
     8.8 +
     8.9 +typedef NSDictionary<NSString *, id> PEPDict;
    8.10 +typedef NSMutableDictionary<NSString *, id> PEPMutableDict;
    8.11 +typedef NSArray<NSString *> PEPStringList;
    8.12 +
    8.13 +@class PEPLanguage;
    8.14 +
    8.15 +/**
    8.16 + Fake session to handle to the client.
    8.17 +
    8.18 + Assures all calls are handled on the correct internal session for the thread it is called on.
    8.19 + You can instatntiate and use this session how often and wherever you want. Also over multiple threads.
    8.20 +
    8.21 + Note: You must call `cleanup()` once before your process gets terminated to be able to gracefully shutdown.
    8.22 + */
    8.23  @interface PEPSession : NSObject
    8.24  
    8.25 +- (void)cleanup;
    8.26 +
    8.27 +/** Decrypt a message */
    8.28 +- (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    8.29 +                            dest:(PEPDict * _Nullable * _Nullable)dst
    8.30 +                            keys:(PEPStringList * _Nullable * _Nullable)keys;
    8.31 +
    8.32 +/** Re-evaluate rating of decrypted message */
    8.33 +- (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src;
    8.34 +
    8.35 +/** Encrypt a message */
    8.36 +- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    8.37 +                           extra:(nullable PEPStringList *)keys
    8.38 +                            dest:(PEPDict * _Nullable * _Nullable)dst;
    8.39 +
    8.40 +/** Encrypt a message for the given identity, which is usually a mySelf identity */
    8.41 +- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    8.42 +                        identity:(nonnull PEPDict *)identity
    8.43 +                            dest:(PEPDict * _Nullable * _Nullable)dst;
    8.44 +
    8.45 +/** Determine the status color of a message to be sent */
    8.46 +- (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg;
    8.47 +
    8.48 +/** Determine the rating of an identity */
    8.49 +- (PEP_rating)identityRating:(nonnull PEPDict *)identity;
    8.50 +
    8.51 +/** Get trustwords for a fingerprint */
    8.52 +- (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
    8.53 +                      shortened:(BOOL)shortened;
    8.54 +
    8.55 +/**
    8.56 + Supply an account used by our user himself. The identity is supplemented with the missing parts
    8.57 +
    8.58 + An identity is a `NSDictionary` mapping a field name as `NSString` to different values.
    8.59 + An identity can have the following fields (all other keys are ignored).
    8.60 + It is not necessary to supply all fields; missing fields are supplemented by p≡p engine.
    8.61 +
    8.62 + @"username": real name or nick name (if pseudonymous) of identity
    8.63 + @"address": URI or SMTP address
    8.64 + @"user_id": persistent unique ID for identity
    8.65 + @"lang": preferred languageID for communication with this ID (default: @"en")
    8.66 + @"fpr": fingerprint of key to use for communication with this ID
    8.67 + @"comm_type": communication type code (usually not needed)
    8.68 +
    8.69 + As an example:
    8.70 +
    8.71 + User has a mailbox. The mail address is "Dipul Khatri <dipul@inboxcube.com>". Then this would be:
    8.72 +
    8.73 + NSDictionary *ident = [NSDictionary dictionaryWithObjectsAndKeys:
    8.74 + @"Dipul Khatri", @"username", @"dipul@inboxcube.com", @"address",
    8.75 + @"23", @"user_id", nil];
    8.76 +
    8.77 + */
    8.78 +- (void)mySelf:(nonnull PEPMutableDict *)identity;
    8.79 +
    8.80 +/**
    8.81 + Supplement missing information for an arbitrary identity (used for communication partners).
    8.82 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    8.83 + */
    8.84 +- (void)updateIdentity:(nonnull PEPMutableDict *)identity;
    8.85 +
    8.86 +/**
    8.87 + Mark a key as trusted with a person.
    8.88 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    8.89 + */
    8.90 +- (void)trustPersonalKey:(nonnull PEPMutableDict *)identity;
    8.91 +
    8.92 +/**
    8.93 + if a key is not trusted by the user tell this using this message
    8.94 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
    8.95 + */
    8.96 +- (void)keyMistrusted:(nonnull PEPMutableDict *)identity;
    8.97 +
    8.98 +/**
    8.99 + Use this to undo keyCompromized or trustPersonalKey
   8.100 + See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
   8.101 + */
   8.102 +- (void)keyResetTrust:(nonnull PEPMutableDict *)identity;
   8.103 +
   8.104 +#pragma mark -- Internal API (testing etc.)
   8.105 +
   8.106 +/** For testing purpose, manual key import */
   8.107 +- (void)importKey:(nonnull NSString *)keydata;
   8.108 +
   8.109 +- (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
   8.110 +     description:(nullable NSString *)description comment:(nullable NSString *)comment;
   8.111 +
   8.112 +/**
   8.113 + Retrieves the log from the engine.
   8.114 + */
   8.115 +- (nonnull NSString *)getLog;
   8.116 +
   8.117 +/** Determine trustwords for two identities */
   8.118 +- (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   8.119 +                                    identity2:(nonnull PEPDict *)identity2
   8.120 +                                     language:(nullable NSString *)language
   8.121 +                                         full:(BOOL)full;
   8.122 +
   8.123 +/** Determine trustwords between sender of a message and receiving identity */
   8.124 +- (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   8.125 +                                   receiverDict:(nonnull PEPDict *)receiverDict
   8.126 +                                      keysArray:(PEPStringList * _Nullable)keysArray
   8.127 +                                       language:(nullable NSString *)language
   8.128 +                                           full:(BOOL)full
   8.129 +                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus;
   8.130 +
   8.131 +/**
   8.132 + @returns The list of supported languages for trustwords.
   8.133 + */
   8.134 +- (NSArray<PEPLanguage *> * _Nonnull)languageList;
   8.135 +
   8.136 +/**
   8.137 + Directly invokes the engine's undo_last_mistrust() function
   8.138 + */
   8.139 +- (PEP_STATUS)undoLastMistrust;
   8.140 +
   8.141  @end
     9.1 --- a/pEpObjCAdapter/PEPSession.m	Wed Oct 11 10:04:33 2017 +0200
     9.2 +++ b/pEpObjCAdapter/PEPSession.m	Wed Oct 11 12:40:46 2017 +0200
     9.3 @@ -8,6 +8,272 @@
     9.4  
     9.5  #import "PEPSession.h"
     9.6  
     9.7 +#import "PEPInternalSession.h"
     9.8 +#import "PEPSessionProvider.h"
     9.9 +
    9.10  @implementation PEPSession
    9.11  
    9.12 +#pragma mark - Public API
    9.13 +
    9.14 +- (void)cleanup
    9.15 +{
    9.16 +    [PEPSessionProvider cleanup];
    9.17 +}
    9.18 +
    9.19 +- (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
    9.20 +                            dest:(PEPDict * _Nullable * _Nullable)dst
    9.21 +                            keys:(PEPStringList * _Nullable * _Nullable)keys
    9.22 +{
    9.23 +    return [PEPSession decryptMessageDict:src dest:(PEPDict * _Nullable * _Nullable)dst
    9.24 +                                         keys:(PEPStringList * _Nullable * _Nullable)keys];
    9.25 +}
    9.26 +
    9.27 +- (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src
    9.28 +{
    9.29 +    return [PEPSession reEvaluateMessageRating:src];
    9.30 +}
    9.31 +
    9.32 +- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    9.33 +                           extra:(nullable PEPStringList *)keys
    9.34 +                            dest:(PEPDict * _Nullable * _Nullable)dst
    9.35 +{
    9.36 +    return [PEPSession encryptMessageDict:src extra:keys dest:dst];
    9.37 +}
    9.38 +
    9.39 +- (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
    9.40 +                        identity:(nonnull PEPDict *)identity
    9.41 +                            dest:(PEPDict * _Nullable * _Nullable)dst
    9.42 +{
    9.43 +    return [PEPSession encryptMessageDict:src identity:identity dest:dst];
    9.44 +}
    9.45 +
    9.46 +- (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg
    9.47 +{
    9.48 +    return [PEPSession outgoingMessageColor:msg];
    9.49 +}
    9.50 +
    9.51 +- (PEP_rating)identityRating:(nonnull PEPDict *)identity
    9.52 +{
    9.53 +    return [PEPSession identityRating:identity];
    9.54 +}
    9.55 +
    9.56 +- (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
    9.57 +                      shortened:(BOOL)shortened
    9.58 +{
    9.59 +    return [PEPSession trustwords:fpr forLanguage:languageID shortened:shortened];
    9.60 +}
    9.61 +
    9.62 +- (void)mySelf:(nonnull PEPMutableDict *)identity
    9.63 +{
    9.64 +    [PEPSession mySelf:identity];
    9.65 +}
    9.66 +
    9.67 +- (void)updateIdentity:(nonnull PEPMutableDict *)identity
    9.68 +{
    9.69 +    [PEPSession updateIdentity:identity];
    9.70 +}
    9.71 +
    9.72 +- (void)trustPersonalKey:(nonnull PEPMutableDict *)identity
    9.73 +{
    9.74 +    [PEPSession trustPersonalKey:identity];
    9.75 +}
    9.76 +
    9.77 +- (void)keyMistrusted:(nonnull PEPMutableDict *)identity
    9.78 +{
    9.79 +    [PEPSession keyMistrusted:identity];
    9.80 +}
    9.81 +
    9.82 +- (void)keyResetTrust:(nonnull PEPMutableDict *)identity
    9.83 +{
    9.84 +    [PEPSession keyResetTrust:identity];
    9.85 +}
    9.86 +
    9.87 +#pragma mark Internal API (testing etc.)
    9.88 +
    9.89 +- (void)importKey:(nonnull NSString *)keydata
    9.90 +{
    9.91 +    [PEPSession importKey:keydata];
    9.92 +}
    9.93 +
    9.94 +- (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
    9.95 +     description:(nullable NSString *)description comment:(nullable NSString *)comment
    9.96 +{
    9.97 +    [PEPSession logTitle:title entity:entity description:description comment:comment];
    9.98 +}
    9.99 +
   9.100 +- (nonnull NSString *)getLog
   9.101 +{
   9.102 +    return [PEPSession getLog];
   9.103 +}
   9.104 +
   9.105 +- (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   9.106 +                                    identity2:(nonnull PEPDict *)identity2
   9.107 +                                     language:(nullable NSString *)language
   9.108 +                                         full:(BOOL)full
   9.109 +{
   9.110 +    return [PEPSession getTrustwordsIdentity1:identity1
   9.111 +                                        identity2:identity2
   9.112 +                                         language:language
   9.113 +                                             full:full];
   9.114 +}
   9.115 +
   9.116 +- (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   9.117 +                                   receiverDict:(nonnull PEPDict *)receiverDict
   9.118 +                                      keysArray:(PEPStringList * _Nullable)keysArray
   9.119 +                                       language:(nullable NSString *)language
   9.120 +                                           full:(BOOL)full
   9.121 +                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus
   9.122 +{
   9.123 +    return [PEPSession getTrustwordsMessageDict:messageDict
   9.124 +                                       receiverDict:receiverDict
   9.125 +                                          keysArray:keysArray
   9.126 +                                           language:language
   9.127 +                                               full:full
   9.128 +                                    resultingStatus:resultingStatus];
   9.129 +}
   9.130 +
   9.131 +- (NSArray<PEPLanguage *> * _Nonnull)languageList
   9.132 +{
   9.133 +    return [PEPSession languageList];
   9.134 +}
   9.135 +
   9.136 +- (PEP_STATUS)undoLastMistrust
   9.137 +{
   9.138 +    return [PEPSession undoLastMistrust];
   9.139 +}
   9.140 +
   9.141 +#pragma mark - Static 
   9.142 +
   9.143 ++ (PEP_rating)decryptMessageDict:(nonnull PEPDict *)src
   9.144 +                            dest:(PEPDict * _Nullable * _Nullable)dst
   9.145 +                            keys:(PEPStringList * _Nullable * _Nullable)keys
   9.146 +{
   9.147 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.148 +    return [session decryptMessageDict:src dest:dst keys:keys];
   9.149 +}
   9.150 +
   9.151 ++ (PEP_rating)reEvaluateMessageRating:(nonnull PEPDict *)src
   9.152 +{
   9.153 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.154 +    return [session reEvaluateMessageRating:src];
   9.155 +}
   9.156 +
   9.157 ++ (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
   9.158 +                           extra:(nullable PEPStringList *)keys
   9.159 +                            dest:(PEPDict * _Nullable * _Nullable)dst
   9.160 +{
   9.161 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.162 +    return [session encryptMessageDict:src extra:keys dest:dst];
   9.163 +}
   9.164 +
   9.165 ++ (PEP_STATUS)encryptMessageDict:(nonnull PEPDict *)src
   9.166 +                        identity:(nonnull PEPDict *)identity
   9.167 +                            dest:(PEPDict * _Nullable * _Nullable)dst
   9.168 +{
   9.169 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.170 +    return [session encryptMessageDict:src identity:identity dest:dst];
   9.171 +}
   9.172 +
   9.173 ++ (PEP_rating)outgoingMessageColor:(nonnull PEPDict *)msg
   9.174 +{
   9.175 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.176 +    return [session outgoingMessageColor:msg];
   9.177 +}
   9.178 +
   9.179 ++ (PEP_rating)identityRating:(nonnull PEPDict *)identity
   9.180 +{
   9.181 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.182 +    return [session identityRating:identity];
   9.183 +}
   9.184 +
   9.185 ++ (nonnull NSArray *)trustwords:(nonnull NSString *)fpr forLanguage:(nonnull NSString *)languageID
   9.186 +                      shortened:(BOOL)shortened
   9.187 +{
   9.188 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.189 +    return [session trustwords:fpr forLanguage:languageID shortened:shortened];
   9.190 +}
   9.191 +
   9.192 ++ (void)mySelf:(nonnull PEPMutableDict *)identity
   9.193 +{
   9.194 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.195 +    [session mySelf:identity];
   9.196 +}
   9.197 +
   9.198 ++ (void)updateIdentity:(nonnull PEPMutableDict *)identity
   9.199 +{
   9.200 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.201 +    [session updateIdentity:identity];
   9.202 +}
   9.203 +
   9.204 ++ (void)trustPersonalKey:(nonnull PEPMutableDict *)identity
   9.205 +{
   9.206 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.207 +    [session trustPersonalKey:identity];
   9.208 +}
   9.209 +
   9.210 ++ (void)keyMistrusted:(nonnull PEPMutableDict *)identity
   9.211 +{
   9.212 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.213 +    [session keyMistrusted:identity];
   9.214 +}
   9.215 +
   9.216 ++ (void)keyResetTrust:(nonnull PEPMutableDict *)identity
   9.217 +{
   9.218 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.219 +    [session keyResetTrust:identity];
   9.220 +}
   9.221 +
   9.222 +#pragma mark Internal API (testing etc.)
   9.223 +
   9.224 ++ (void)importKey:(nonnull NSString *)keydata
   9.225 +{
   9.226 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.227 +    [session importKey:keydata];
   9.228 +}
   9.229 +
   9.230 ++ (void)logTitle:(nonnull NSString *)title entity:(nonnull NSString *)entity
   9.231 +     description:(nullable NSString *)description comment:(nullable NSString *)comment
   9.232 +{
   9.233 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.234 +    [session logTitle:title entity:entity description:description comment:comment];
   9.235 +}
   9.236 +
   9.237 ++ (nonnull NSString *)getLog
   9.238 +{
   9.239 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.240 +    return [session getLog];
   9.241 +}
   9.242 +
   9.243 ++ (nullable NSString *)getTrustwordsIdentity1:(nonnull PEPDict *)identity1
   9.244 +                                    identity2:(nonnull PEPDict *)identity2
   9.245 +                                     language:(nullable NSString *)language
   9.246 +                                         full:(BOOL)full
   9.247 +{
   9.248 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.249 +    return [session getTrustwordsIdentity1:identity1 identity2:identity2 language:language full:full];
   9.250 +}
   9.251 +
   9.252 ++ (nullable NSString *)getTrustwordsMessageDict:(nonnull PEPDict *)messageDict
   9.253 +                                   receiverDict:(nonnull PEPDict *)receiverDict
   9.254 +                                      keysArray:(PEPStringList * _Nullable)keysArray
   9.255 +                                       language:(nullable NSString *)language
   9.256 +                                           full:(BOOL)full
   9.257 +                                resultingStatus:(PEP_STATUS * _Nullable)resultingStatus
   9.258 +{
   9.259 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.260 +    return [session getTrustwordsMessageDict:messageDict receiverDict:receiverDict keysArray:keysArray language:language full:full resultingStatus:resultingStatus];
   9.261 +}
   9.262 +
   9.263 ++ (NSArray<PEPLanguage *> * _Nonnull)languageList
   9.264 +{
   9.265 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.266 +    return [session languageList];
   9.267 +}
   9.268 +
   9.269 ++ (PEP_STATUS)undoLastMistrust
   9.270 +{
   9.271 +    PEPInternalSession *session = [PEPSessionProvider session];
   9.272 +    return [session undoLastMistrust];
   9.273 +}
   9.274 +
   9.275  @end
    10.1 --- a/pEpObjCAdapter/PEPSessionProvider.m	Wed Oct 11 10:04:33 2017 +0200
    10.2 +++ b/pEpObjCAdapter/PEPSessionProvider.m	Wed Oct 11 12:40:46 2017 +0200
    10.3 @@ -9,7 +9,6 @@
    10.4  #import "PEPSessionProvider.h"
    10.5  
    10.6  #import "PEPInternalSession.h"
    10.7 -#import "PEPInternalSession+Internal.h"
    10.8  #import "PEPCopyableThread.h"
    10.9  
   10.10  @implementation PEPSessionProvider
   10.11 @@ -22,7 +21,7 @@
   10.12  + (PEPInternalSession * _Nonnull)session
   10.13  {
   10.14      [[self sessionForThreadLock] lock];
   10.15 -
   10.16 +    
   10.17      PEPCopyableThread *currentThread = [[PEPCopyableThread alloc] initWithThread:[NSThread currentThread]];
   10.18      NSMutableDictionary<PEPCopyableThread*,PEPInternalSession*> *dict = [self sessionForThreadDict];
   10.19      PEPInternalSession *session = dict[currentThread];
   10.20 @@ -30,24 +29,24 @@
   10.21          session = [[PEPInternalSession alloc] initInternal];
   10.22          dict[currentThread] = session;
   10.23      }
   10.24 -    [self nullifySesssionOfFinishedThreads];
   10.25 -
   10.26 +    [self nullifySessionsOfFinishedThreads];
   10.27 +    
   10.28      [[self sessionForThreadLock] unlock];
   10.29 -
   10.30 +    
   10.31      return session;
   10.32  }
   10.33  
   10.34  + (void)cleanup
   10.35  {
   10.36      [[self sessionForThreadLock] lock];
   10.37 -
   10.38 +    
   10.39      NSMutableDictionary<PEPCopyableThread*,PEPInternalSession*> *dict = [self sessionForThreadDict];
   10.40      for (PEPCopyableThread *thread in dict.allKeys) {
   10.41          [thread cancel];
   10.42          [self nullifySessionForThread:thread];
   10.43      }
   10.44      [dict removeAllObjects];
   10.45 -
   10.46 +    
   10.47      [[self sessionForThreadLock] unlock];
   10.48  }
   10.49  
   10.50 @@ -73,7 +72,7 @@
   10.51  
   10.52  #pragma mark -
   10.53  
   10.54 -+ (void)nullifySesssionOfFinishedThreads
   10.55 ++ (void)nullifySessionsOfFinishedThreads
   10.56  {
   10.57      NSMutableDictionary<PEPCopyableThread*,PEPInternalSession*> *dict = [self sessionForThreadDict];
   10.58      for (PEPCopyableThread *thread in dict.allKeys) {
   10.59 @@ -90,7 +89,7 @@
   10.60      [self performSelector:@selector(nullifySession:)
   10.61                   onThread:thread.thread
   10.62                 withObject:session
   10.63 -            waitUntilDone:YES];
   10.64 +            waitUntilDone:NO];
   10.65      dict[thread] = nil;
   10.66  }
   10.67