2 // CKDSecuritydAccount+CKDSecuritydAccount_m.m
7 #import "Foundation/Foundation.h"
8 #import "CKDSecuritydAccount.h"
10 #include <Security/SecureObjectSync/SOSCloudCircleInternal.h>
11 #include <Security/SecItemPriv.h>
13 @implementation CKDSecuritydAccount
15 + (instancetype) securitydAccount
17 return [[CKDSecuritydAccount alloc] init];
20 - (NSSet*) keysChanged: (NSDictionary<NSString*, NSObject*>*)keyValues error: (NSError**) error
22 CFErrorRef cf_error = NULL;
23 NSArray* handled = (__bridge_transfer NSArray*) _SecKeychainSyncUpdateMessage((__bridge CFDictionaryRef)keyValues, &cf_error);
24 NSError *updateError = (__bridge_transfer NSError*)cf_error;
28 return [NSSet setWithArray:handled];
31 - (bool) ensurePeerRegistration: (NSError**) error
33 CFErrorRef localError = NULL;
34 bool result = SOSCCProcessEnsurePeerRegistration(error ? &localError : NULL);
36 if (error && localError) {
37 *error = (__bridge_transfer NSError*) localError;
43 - (NSSet<NSString*>*) syncWithPeers: (NSSet<NSString*>*) peerIDs backups: (NSSet<NSString*>*) backupPeerIDs error: (NSError**) error
45 CFErrorRef localError = NULL;
46 CFSetRef handledPeers = SOSCCProcessSyncWithPeers((__bridge CFSetRef) peerIDs, (__bridge CFSetRef) backupPeerIDs, &localError);
48 if (error && localError) {
49 *error = (__bridge_transfer NSError*) localError;
52 return (__bridge_transfer NSSet<NSString*>*) handledPeers;
55 - (SyncWithAllPeersReason) syncWithAllPeers: (NSError**) error
57 CFErrorRef localError = NULL;
58 SyncWithAllPeersReason result = SOSCCProcessSyncWithAllPeers(error ? &localError : NULL);
60 if (error && localError) {
61 *error = (__bridge_transfer NSError*) localError;