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