2 * Copyright (c) 2016 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef CKKSDeviceStateEntry_h
25 #define CKKSDeviceStateEntry_h
29 #include <securityd/SecDbItem.h>
30 #include <utilities/SecDb.h>
32 #import <CloudKit/CloudKit.h>
33 #import "keychain/ckks/CKKS.h"
34 #import "keychain/ckks/CKKSRecordHolder.h"
35 #import "keychain/ckks/CKKSSQLDatabaseObject.h"
37 NS_ASSUME_NONNULL_BEGIN
40 * This is the backing class for "device state" records: each device in an iCloud account copies
41 * some state about itself into each keychain view it wants to participate in.
43 * This shares some overlap with the CKKSZoneStateEntry, but differs in that:
44 * - This will be uploaded to CloudKit
45 * - We will have receive such records from other devices
48 @interface CKKSDeviceStateEntry
: CKKSCKRecordHolder
49 @property NSString
* device
;
51 @
property (nullable
) NSString
* osVersion
;
52 @
property (nullable
) NSDate
* lastUnlockTime
;
54 @
property (nullable
) NSString
* circlePeerID
;
55 @property SOSCCStatus circleStatus
;
56 @
property (nullable
) CKKSZoneKeyState
* keyState
;
58 @
property (nullable
) NSString
* currentTLKUUID
;
59 @
property (nullable
) NSString
* currentClassAUUID
;
60 @
property (nullable
) NSString
* currentClassCUUID
;
62 + (instancetype
)fromDatabase
:(NSString
*)device zoneID
:(CKRecordZoneID
*)zoneID error
:(NSError
* __autoreleasing
*)error
;
63 + (instancetype
)tryFromDatabase
:(NSString
*)device zoneID
:(CKRecordZoneID
*)zoneID error
:(NSError
* __autoreleasing
*)error
;
64 + (instancetype
)tryFromDatabaseFromCKRecordID
:(CKRecordID
*)recordID error
:(NSError
* __autoreleasing
*)error
;
65 + (NSArray
<CKKSDeviceStateEntry
*>*)allInZone
:(CKRecordZoneID
*)zoneID error
:(NSError
* __autoreleasing
*)error
;
67 - (instancetype
)init NS_UNAVAILABLE
;
68 - (instancetype
)initForDevice
:(NSString
* _Nullable
)device
69 osVersion
:(NSString
* _Nullable
)osVersion
70 lastUnlockTime
:(NSDate
* _Nullable
)lastUnlockTime
71 circlePeerID
:(NSString
* _Nullable
)circlePeerID
72 circleStatus
:(SOSCCStatus
)circleStatus
73 keyState
:(CKKSZoneKeyState
* _Nullable
)keyState
74 currentTLKUUID
:(NSString
* _Nullable
)currentTLKUUID
75 currentClassAUUID
:(NSString
* _Nullable
)currentClassAUUID
76 currentClassCUUID
:(NSString
* _Nullable
)currentClassCUUID
77 zoneID
:(CKRecordZoneID
*)zoneID
78 encodedCKRecord
:(NSData
* _Nullable
)encodedrecord
;
84 #endif /* CKKSDeviceStateEntry_h */