]> git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/SecureObjectSync/SOSAccountTrust.m
Security-58286.1.32.tar.gz
[apple/security.git] / OSX / sec / SOSCircle / SecureObjectSync / SOSAccountTrust.m
1 //
2 // SOSAccountTrust.c
3 // Security
4 //
5 #import "Security/SecureObjectSync/SOSAccountPriv.h"
6 #import "Security/SecureObjectSync/SOSAccountTrust.h"
7
8 @implementation SOSAccountTrust
9
10 +(instancetype)trust
11 {
12 return [[SOSAccountTrust alloc]init];
13 }
14
15 -(id)init
16 {
17 self = [super init];
18 if(self)
19 {
20 self.retirees = [NSMutableSet set];
21 self.fullPeerInfo = NULL;
22 self.trustedCircle = NULL;
23 self.departureCode = kSOSDepartureReasonError;
24 self.expansion = [NSMutableDictionary dictionary];
25 }
26 return self;
27 }
28
29 -(id)initWithRetirees:(NSMutableSet*)r fpi:(SOSFullPeerInfoRef)fpi circle:(SOSCircleRef) trusted_circle
30 departureCode:(enum DepartureReason)code peerExpansion:(NSMutableDictionary*)e
31 {
32
33 self = [super init];
34 if(self)
35 {
36 self.retirees = r;
37 self.fullPeerInfo = fpi;
38 self.trustedCircle = trusted_circle;
39 self.departureCode = code;
40 self.expansion = e;
41 }
42 return self;
43 }
44
45 - (SOSPeerInfoRef) peerInfo {
46 return SOSFullPeerInfoGetPeerInfo(self.fullPeerInfo);
47 }
48
49 - (NSString*) peerID {
50 return (__bridge_transfer NSString*) CFRetainSafe(SOSPeerInfoGetPeerID(self.peerInfo));
51 }
52
53 @synthesize trustedCircle = trustedCircle;
54
55 - (void) setTrustedCircle:(SOSCircleRef) circle {
56 CFRetainAssign(self->trustedCircle, circle);
57 }
58
59 @synthesize retirees = retirees;
60
61 -(void) setRetirees:(NSSet *)newRetirees
62 {
63 self->retirees = newRetirees.mutableCopy;
64 }
65
66 @synthesize fullPeerInfo = fullPeerInfo;
67
68 - (void) setFullPeerInfo:(SOSFullPeerInfoRef) newIdentity {
69 CFRetainAssign(self->fullPeerInfo, newIdentity);
70 }
71
72 @synthesize expansion = expansion;
73
74 -(void)setExpansion:(NSDictionary*) newExpansion
75 {
76 self->expansion = newExpansion.mutableCopy;
77 }
78
79 @synthesize departureCode = departureCode;
80
81 -(void)setDepartureCode:(enum DepartureReason)newDepartureCode
82 {
83 self->departureCode = newDepartureCode;
84 }
85
86 @end
87