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