|
| 1 | +/** |
| 2 | + * Copyright (c) 2024 Project CHIP Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +#import <Foundation/Foundation.h> |
| 18 | +#import <Matter/MTRBaseClusters.h> |
| 19 | +#import <Matter/MTRDefines.h> |
| 20 | + |
| 21 | +NS_ASSUME_NONNULL_BEGIN |
| 22 | + |
| 23 | +/** |
| 24 | + * An access grant, which can be represented as an entry in the Matter Access |
| 25 | + * Control cluster. |
| 26 | + */ |
| 27 | +MTR_NEWLY_AVAILABLE |
| 28 | +@interface MTRAccessGrant : NSObject <NSCopying> |
| 29 | + |
| 30 | +- (instancetype)init NS_UNAVAILABLE; |
| 31 | ++ (instancetype)new NS_UNAVAILABLE; |
| 32 | + |
| 33 | +/** |
| 34 | + * Grant access at the provided level to a specific node on the fabric. The |
| 35 | + * provided nodeID must be an operational node identifier. |
| 36 | + */ |
| 37 | ++ (nullable MTRAccessGrant *)accessGrantForNodeID:(NSNumber *)nodeID privilege:(MTRAccessControlEntryPrivilege)privilege; |
| 38 | + |
| 39 | +/** |
| 40 | + * Grant access to any node on the fabric that has a matching CASE Authenticated |
| 41 | + * Tag in its operational certificate. The provided caseAuthenticatedTag must |
| 42 | + * be a 32-bit unsigned integer with lower 16 bits not 0, per the Matter |
| 43 | + * specification. |
| 44 | + */ |
| 45 | ++ (nullable MTRAccessGrant *)accessGrantForCASEAuthenticatedTag:(NSNumber *)caseAuthenticatedTag privilege:(MTRAccessControlEntryPrivilege)privilege; |
| 46 | + |
| 47 | +/** |
| 48 | + * Grant access to any node on the fabric that is communicating with us via |
| 49 | + * group messages sent to the given group. The provided groupID must be a valid |
| 50 | + * group identifier in the range 1-65535. |
| 51 | + */ |
| 52 | ++ (nullable MTRAccessGrant *)accessGrantForGroupID:(NSNumber *)groupID privilege:(MTRAccessControlEntryPrivilege)privilege; |
| 53 | + |
| 54 | +/** |
| 55 | + * Grant access to any node on the fabric, as long as it's communicating with us |
| 56 | + * over a unicast authenticated channel. |
| 57 | + */ |
| 58 | ++ (MTRAccessGrant *)accessGrantForAllNodesWithPrivilege:(MTRAccessControlEntryPrivilege)privilege; |
| 59 | + |
| 60 | +/** |
| 61 | + * The matter access control subject ID that access has been granted for. Nil |
| 62 | + * when access has been granted for all subjects (e.g. via initForAllNodesWithPrivilege). |
| 63 | + */ |
| 64 | +@property (nonatomic, copy, readonly, nullable) NSNumber * subjectID; |
| 65 | + |
| 66 | +/** |
| 67 | + * The privilege that has been granted |
| 68 | + */ |
| 69 | +@property (nonatomic, assign, readonly) MTRAccessControlEntryPrivilege grantedPrivilege; |
| 70 | + |
| 71 | +/** |
| 72 | + * The type of authentication mode the access grant is |
| 73 | + * for. MTRAccessControlEntryAuthModeCASE for unicast messages and |
| 74 | + * MTRAccessControlEntryAuthModeGroup for groupcast ones. |
| 75 | + */ |
| 76 | +@property (nonatomic, assign, readonly) MTRAccessControlEntryAuthMode authenticationMode; |
| 77 | + |
| 78 | +@end |
| 79 | + |
| 80 | +NS_ASSUME_NONNULL_END |
0 commit comments