-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathMTRDeviceAttestationDelegate.h
126 lines (107 loc) · 5.49 KB
/
MTRDeviceAttestationDelegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**
*
* Copyright (c) 2020-2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
#import <Matter/MTRCertificates.h>
#import <Matter/MTRDefines.h>
NS_ASSUME_NONNULL_BEGIN
@class MTRDeviceController;
MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
@interface MTRDeviceAttestationDeviceInfo : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
* The vendor ID from the Device Attestation Certificate. May be nil only if attestation was unsuccessful.
*/
@property (nonatomic, readonly, nullable) NSNumber * vendorID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
/**
* The product ID from the Device Attestation Certificate. May be nil only if attestation was unsuccessful.
*/
@property (nonatomic, readonly, nullable) NSNumber * productID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
/**
* The vendor ID value from the device's Basic Information cluster that was used
* for device attestation. If attestation succeeds, this must match the vendor
* ID from the certification declaration.
*/
@property (nonatomic, readonly) NSNumber * basicInformationVendorID MTR_AVAILABLE(ios(16.6), macos(13.5), watchos(9.6), tvos(16.6));
/**
* The product ID value from the device's Basic Information cluster that was
* used for device attestation. If attestation succeeds, this must match one of
* the product IDs from the certification declaration.
*/
@property (nonatomic, readonly) NSNumber * basicInformationProductID MTR_AVAILABLE(ios(16.6), macos(13.5), watchos(9.6), tvos(16.6));
@property (nonatomic, readonly) MTRCertificateDERBytes dacCertificate;
@property (nonatomic, readonly) MTRCertificateDERBytes dacPAICertificate;
@property (nonatomic, readonly, nullable) NSData * certificateDeclaration;
@end
/**
* The protocol definition for the MTRDeviceAttestationDelegate.
*/
@protocol MTRDeviceAttestationDelegate <NSObject>
@optional
/**
* Only one of the following delegate callbacks should be implemented.
*
* If -deviceAttestationFailedForController:opaqueDeviceHandle:error: is implemented, then it will
* be called when device attestation fails, and the client can decide to continue or stop the
* commissioning.
*
* If -deviceAttestationCompletedForController:opaqueDeviceHandle:attestationDeviceInfo:error: is
* implemented, then it will always be called when device attestation completes.
*/
/**
* Notify the delegate when device attestation completed with device info for additional verification. If
* this callback is implemented, continueCommissioningDevice on MTRDeviceController is expected
* to be called if commisioning should continue.
*
* This allows the delegate to stop commissioning after examining the device info (DAC, PAI, CD).
*
* @param controller Controller corresponding to the commissioning process
* @param opaqueDeviceHandle Handle of device being commissioned
* @param attestationDeviceInfo Attestation information for the device
* @param error NSError representing the error code on attestation failure. Nil if success.
*/
- (void)deviceAttestationCompletedForController:(MTRDeviceController *)controller
opaqueDeviceHandle:(void *)opaqueDeviceHandle
attestationDeviceInfo:(MTRDeviceAttestationDeviceInfo *)attestationDeviceInfo
error:(NSError * _Nullable)error
MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
/**
* Notify the delegate when device attestation fails. If this callback is implemented,
* continueCommissioningDevice on MTRDeviceController is expected to be called if commisioning
* should continue.
*
* @param controller Controller corresponding to the commissioning process
* @param opaqueDeviceHandle Handle of device being commissioned
* @param error NSError representing the error code for the failure
*/
- (void)deviceAttestationFailedForController:(MTRDeviceController *)controller
opaqueDeviceHandle:(void *)opaqueDeviceHandle
error:(NSError * _Nonnull)error
MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
- (void)deviceAttestation:(MTRDeviceController *)controller
completedForDevice:(void *)device
attestationDeviceInfo:(MTRDeviceAttestationDeviceInfo *)attestationDeviceInfo
error:(NSError * _Nullable)error
MTR_DEPRECATED("Please implement deviceAttestationCompletedForController:opaqueDeviceHandle:attestationDeviceInfo:error:",
ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4));
- (void)deviceAttestation:(MTRDeviceController *)controller
failedForDevice:(void *)device
error:(NSError * _Nonnull)error
MTR_DEPRECATED("Please implement deviceAttestationFailedForController:opaqueDeviceHandle:error:", ios(16.1, 16.4),
macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4));
@end
NS_ASSUME_NONNULL_END