pEpObjCAdapterFramework/PEPIdentity.h
author Dirk Zimmermann <dz@pep.security>
Fri, 20 Sep 2019 10:01:48 +0200
branchIOSAD-141
changeset 1250 b6a4d30abd26
parent 1206 1883fde7438a
child 1390 1730a4a4d115
permissions -rw-r--r--
IOSAD-141 Test for "hammering" the engine.
     1 //
     2 //  PEPIdentity.h
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 30.10.17.
     6 //  Copyright © 2017 p≡p. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 
    11 #import "PEPSessionProtocol.h"
    12 
    13 @class PEPSession;
    14 
    15 @interface PEPIdentity : NSObject <NSMutableCopying>
    16 
    17 /**
    18  The network address of this identity
    19  */
    20 @property (nonatomic, nonnull) NSString *address;
    21 
    22 /**
    23  The (optional) user ID.
    24  */
    25 @property (nonatomic, nullable) NSString *userID;
    26 
    27 /**
    28  The (optional) user name.
    29  */
    30 @property (nonatomic, nullable) NSString *userName;
    31 
    32 /**
    33  The (optional) fingerprint.
    34  */
    35 @property (nonatomic, nullable) NSString *fingerPrint;
    36 
    37 /**
    38  The (optional) language that this identity uses.
    39  */
    40 @property (nonatomic, nullable) NSString *language;
    41 
    42 /**
    43  The comm type of this identity.
    44  */
    45 @property PEPCommType commType;
    46 
    47 /**
    48  Is this one of our own identities?
    49  */
    50 @property BOOL isOwn;
    51 
    52 /**
    53  Comm type contains the PEP_ct_confirmed flag?
    54  */
    55 @property (readonly) BOOL isConfirmed;
    56 
    57 - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    58                                  userID:(NSString * _Nullable)userID
    59                                userName:(NSString * _Nullable)userName
    60                                   isOwn:(BOOL)isOwn
    61                             fingerPrint:(NSString * _Nullable)fingerPrint
    62                                commType:(PEPCommType)commType
    63                                language:(NSString * _Nullable)language;
    64 
    65 - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    66                                  userID:(NSString * _Nullable)userID
    67                                userName:(NSString * _Nullable)userName
    68                                   isOwn:(BOOL)isOwn
    69                             fingerPrint:(NSString * _Nullable)fingerPrint;
    70 
    71 - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    72                                  userID:(NSString * _Nullable)userID
    73                                userName:(NSString * _Nullable)userName
    74                                   isOwn:(BOOL)isOwn;
    75 
    76 - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address;
    77 
    78 - (nonnull instancetype)initWithDictionary:(NSDictionary * _Nonnull)dictionary;
    79 
    80 /**
    81  Copy constructor.
    82  */
    83 - (nonnull instancetype)initWithIdentity:(PEPIdentity * _Nonnull)identity;
    84 
    85 /**
    86  This method should be removed once the adapter fully supports objects for identity
    87  and message types insead of dictionaries.
    88  */
    89 - (PEPDict * _Nonnull)dictionary;
    90 
    91 /**
    92  This method should be removed once the adapter fully supports objects for identity
    93  and message types insead of dictionaries.
    94  */
    95 - (PEPMutableDict * _Nonnull)mutableDictionary;
    96 
    97 /**
    98  Is the given identity a pEp user, from the engine's point of view?
    99  */
   100 - (NSNumber * _Nullable)isPEPUser:(PEPSession * _Nullable)session
   101                             error:(NSError * _Nullable * _Nullable)error;
   102 
   103 /**
   104  Puts all properties into a default/nil state.
   105  */
   106 - (void)reset;
   107 
   108 /**
   109  Enables key sync on this identity.
   110 
   111  Will invoke the needed methods on an own session.
   112 
   113  @param error The usual cocoa error handling.
   114  @return The usual cocoa error handling.
   115  */
   116 - (BOOL)enableKeySync:(NSError * _Nullable * _Nullable)error;
   117 
   118 /**
   119  Disables key sync on this identity.
   120 
   121  Will invoke the needed methods on an own session.
   122 
   123  @param error The usual cocoa error handling.
   124  @return The usual cocoa error handling.
   125  */
   126 - (BOOL)disableKeySync:(NSError * _Nullable * _Nullable)error;
   127 
   128 /**
   129  Queries whether this own identity has key sync enabled or not.
   130 
   131  Will invoke the needed methods on an own session.
   132 
   133  @param error The usual cocoa error handling.
   134  @return A NSNumber denoting whether this own identity can participate in key sync enabled or not,
   135          or nil on error.
   136          YES means that key sync is allowed for this identity, otherwise it's NO.
   137  */
   138 - (NSNumber * _Nullable)queryKeySyncEnabled:(NSError * _Nullable * _Nullable)error;
   139 
   140 @end