]> git.saurik.com Git - apple/security.git/blob - OSX/sec/securityd/SOSCloudCircleServer.h
Security-57337.50.23.tar.gz
[apple/security.git] / OSX / sec / securityd / SOSCloudCircleServer.h
1 /*
2 * Copyright (c) 2012-2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25 #ifndef _SECURITY_SOSCLOUDCIRCLESERVER_H_
26 #define _SECURITY_SOSCLOUDCIRCLESERVER_H_
27
28 #include <Security/SecureObjectSync/SOSCloudCircle.h>
29 #include <Security/SecureObjectSync/SOSAccount.h>
30
31
32 __BEGIN_DECLS
33
34 //
35 // MARK: Server versions of our SPI
36 //
37 bool SOSCCTryUserCredentials_Server(CFStringRef user_label, CFDataRef user_password, CFErrorRef *error);
38 bool SOSCCSetUserCredentials_Server(CFStringRef user_label, CFDataRef user_password, CFErrorRef *error);
39 bool SOSCCSetUserCredentialsAndDSID_Server(CFStringRef user_label, CFDataRef user_password, CFStringRef dsid, CFErrorRef *error);
40
41 bool SOSCCCanAuthenticate_Server(CFErrorRef *error);
42 bool SOSCCPurgeUserCredentials_Server(CFErrorRef *error);
43
44 SOSCCStatus SOSCCThisDeviceIsInCircle_Server(CFErrorRef *error);
45 bool SOSCCRequestToJoinCircle_Server(CFErrorRef* error);
46 bool SOSCCRequestToJoinCircleAfterRestore_Server(CFErrorRef* error);
47 CFStringRef SOSCCCopyDeviceID_Server(CFErrorRef *error);
48 bool SOSCCSetDeviceID_Server(CFStringRef IDS, CFErrorRef *error);
49 HandleIDSMessageReason SOSCCHandleIDSMessage_Server(CFDictionaryRef messageDict, CFErrorRef* error);
50
51 bool SOSCCIDSServiceRegistrationTest_Server(CFStringRef message, CFErrorRef *error);
52 bool SOSCCIDSPingTest_Server(CFStringRef message, CFErrorRef *error);
53 bool SOSCCIDSDeviceIDIsAvailableTest_Server(CFErrorRef *error);
54
55 bool SOSCCRemoveThisDeviceFromCircle_Server(CFErrorRef* error);
56 bool SOSCCRemovePeersFromCircle_Server(CFArrayRef peers, CFErrorRef* error);
57 bool SOSCCLoggedOutOfAccount_Server(CFErrorRef *error);
58 bool SOSCCBailFromCircle_Server(uint64_t limit_in_seconds, CFErrorRef* error);
59 bool SOSCCRequestEnsureFreshParameters_Server(CFErrorRef* error);
60
61
62 bool SOSCCApplyToARing_Server(CFStringRef ringName, CFErrorRef *error);
63 bool SOSCCWithdrawlFromARing_Server(CFStringRef ringName, CFErrorRef *error);
64 SOSRingStatus SOSCCRingStatus_Server(CFStringRef ringName, CFErrorRef *error);
65 CFStringRef SOSCCGetAllTheRings_Server(CFErrorRef *error);
66 bool SOSCCEnableRing_Server(CFStringRef ringName, CFErrorRef *error);
67
68
69 CFArrayRef SOSCCCopyGenerationPeerInfo_Server(CFErrorRef* error);
70 CFArrayRef SOSCCCopyApplicantPeerInfo_Server(CFErrorRef* error);
71 CFArrayRef SOSCCCopyValidPeerPeerInfo_Server(CFErrorRef* error);
72 bool SOSCCValidateUserPublic_Server(CFErrorRef* error);
73
74 CFArrayRef SOSCCCopyNotValidPeerPeerInfo_Server(CFErrorRef* error);
75 CFArrayRef SOSCCCopyRetirementPeerInfo_Server(CFErrorRef* error);
76 CFArrayRef SOSCCCopyViewUnawarePeerInfo_Server(CFErrorRef* error);
77 bool SOSCCRejectApplicants_Server(CFArrayRef applicants, CFErrorRef* error);
78 bool SOSCCAcceptApplicants_Server(CFArrayRef applicants, CFErrorRef* error);
79
80 SOSPeerInfoRef SOSCCCopyMyPeerInfo_Server(CFErrorRef* error);
81 CFArrayRef SOSCCCopyEngineState_Server(CFErrorRef* error);
82
83 CFArrayRef SOSCCCopyPeerPeerInfo_Server(CFErrorRef* error);
84 CFArrayRef SOSCCCopyConcurringPeerPeerInfo_Server(CFErrorRef* error);
85 bool SOSCCCheckPeerAvailability_Server(CFErrorRef *error);
86 bool SOSCCAccountSetToNew_Server(CFErrorRef *error);
87 bool SOSCCResetToOffering_Server(CFErrorRef* error);
88 bool SOSCCResetToEmpty_Server(CFErrorRef* error);
89
90 SOSViewResultCode SOSCCView_Server(CFStringRef view, SOSViewActionCode action, CFErrorRef *error);
91 bool SOSCCViewSet_Server(CFSetRef enabledView, CFSetRef disabledViews);
92
93 SOSSecurityPropertyResultCode SOSCCSecurityProperty_Server(CFStringRef property, SOSSecurityPropertyActionCode action, CFErrorRef *error);
94
95 CFStringRef SOSCCCopyIncompatibilityInfo_Server(CFErrorRef* error);
96 enum DepartureReason SOSCCGetLastDepartureReason_Server(CFErrorRef* error);
97 bool SOSCCSetLastDepartureReason_Server(enum DepartureReason reason, CFErrorRef *error);
98 bool SOSCCSetHSA2AutoAcceptInfo_Server(CFDataRef pubKey, CFErrorRef *error);
99
100 bool SOSCCProcessEnsurePeerRegistration_Server(CFErrorRef* error);
101 SyncWithAllPeersReason SOSCCProcessSyncWithAllPeers_Server(CFErrorRef* error);
102
103 SOSPeerInfoRef SOSCCSetNewPublicBackupKey_Server(CFDataRef newPublicBackup, CFErrorRef *error);
104 bool SOSCCRegisterSingleRecoverySecret_Server(CFDataRef backupSlice, bool setupV0Only, CFErrorRef *error);
105
106 bool SOSCCWaitForInitialSync_Server(CFErrorRef*);
107 CFArrayRef SOSCCCopyYetToSyncViewsList_Server(CFErrorRef*);
108
109 bool SOSWrapToBackupSliceKeyBagForView_Server(CFStringRef viewName, CFDataRef input, CFDataRef* output, CFDataRef* bskbEncoded, CFErrorRef* error);
110
111 SOSBackupSliceKeyBagRef SOSBackupSliceKeyBagForView(CFStringRef viewName, CFErrorRef* error);
112 CF_RETURNS_RETAINED CFDataRef SOSWrapToBackupSliceKeyBag(SOSBackupSliceKeyBagRef bskb, CFDataRef input, CFErrorRef* error);
113
114 //
115 // MARK: Internal kicks.
116 //
117 CF_RETURNS_RETAINED CFArrayRef SOSCCHandleUpdateMessage(CFDictionaryRef updates);
118 void sync_the_last_data_to_kvs(SOSAccountRef account, bool waitForeverForSynchronization);
119
120
121 // Expected to be called when the data source changes.
122 void SOSCCSyncWithAllPeers(void);
123 void SOSCCAddSyncablePeerBlock(CFStringRef ds_name, SOSAccountSyncablePeersBlock changeBlock);
124 dispatch_queue_t SOSCCGetAccountQueue(void);
125
126 //
127 // MARK: Internal access to local account for tests.
128 //
129 typedef SOSDataSourceFactoryRef (^SOSCCAccountDataSourceFactoryBlock)();
130
131 SOSAccountRef SOSKeychainAccountGetSharedAccount(void);
132 bool SOSKeychainAccountSetFactoryForAccount(SOSCCAccountDataSourceFactoryBlock factory);
133
134 //
135 // MARK: Internal SPIs for testing
136 //
137 CFStringRef CopyOSVersion(void);
138 CFDataRef SOSCCCopyAccountState_Server(CFErrorRef* error);
139 CFDataRef SOSCCCopyEngineData_Server(CFErrorRef* error);
140 bool SOSCCDeleteEngineState_Server(CFErrorRef* error);
141 bool SOSCCDeleteAccountState_Server(CFErrorRef* error);
142
143
144 //
145 // MARK: Testing operations, dangerous to call in normal operation.
146 //
147 bool SOSKeychainSaveAccountDataAndPurge(CFErrorRef *error);
148
149 //
150 // MARK: Constants for where we store persistent information in the keychain
151 //
152
153 extern CFStringRef kSOSInternalAccessGroup;
154
155 extern CFStringRef kSOSAccountLabel;
156 extern CFStringRef kSOSPeerDataLabel;
157
158 CFDataRef SOSItemCopy(CFStringRef label, CFErrorRef* error);
159 bool SOSItemUpdateOrAdd(CFStringRef label, CFStringRef accessibility, CFDataRef data, CFErrorRef *error);
160
161 bool SOSCCSetEscrowRecord_Server(CFStringRef escrow_label, uint64_t tries, CFErrorRef *error);
162 CFDictionaryRef SOSCCCopyEscrowRecord_Server(CFErrorRef *error);
163
164
165 __END_DECLS
166
167 #endif