SOSAccountTrust.m
1 // 2 // SOSAccountTrust.c 3 // Security 4 // 5 #import "keychain/SecureObjectSync/SOSAccountPriv.h" 6 #import "keychain/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 if ((self = [super init])) { 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 if ((self = [super init])) { 34 self.retirees = r; 35 self.fullPeerInfo = fpi; 36 self.trustedCircle = trusted_circle; 37 self.departureCode = code; 38 self.expansion = e; 39 } 40 return self; 41 } 42 - (void)dealloc { 43 if(self) { 44 CFReleaseNull(self->fullPeerInfo); 45 CFReleaseNull(self->peerInfo); 46 CFReleaseNull(self->trustedCircle); 47 CFReleaseNull(self->_cachedOctagonSigningKey); 48 CFReleaseNull(self->_cachedOctagonEncryptionKey); 49 } 50 } 51 52 - (SOSPeerInfoRef) peerInfo { 53 return SOSFullPeerInfoGetPeerInfo(self.fullPeerInfo); 54 } 55 56 - (NSString*) peerID { 57 return (__bridge_transfer NSString*) CFRetainSafe(SOSPeerInfoGetPeerID(self.peerInfo)); 58 } 59 60 @synthesize trustedCircle = trustedCircle; 61 62 - (void) setTrustedCircle:(SOSCircleRef) circle { 63 CFRetainAssign(self->trustedCircle, circle); 64 } 65 66 @synthesize retirees = retirees; 67 68 -(void) setRetirees:(NSSet *)newRetirees 69 { 70 self->retirees = newRetirees.mutableCopy; 71 } 72 73 @synthesize fullPeerInfo = fullPeerInfo; 74 75 - (void) setFullPeerInfo:(SOSFullPeerInfoRef) newIdentity { 76 CFRetainAssign(self->fullPeerInfo, newIdentity); 77 } 78 79 @synthesize expansion = expansion; 80 81 -(void)setExpansion:(NSDictionary*) newExpansion 82 { 83 self->expansion = newExpansion.mutableCopy; 84 } 85 86 @synthesize departureCode = departureCode; 87 88 -(void)setDepartureCode:(enum DepartureReason)newDepartureCode 89 { 90 self->departureCode = newDepartureCode; 91 } 92 93 @end 94