]> git.saurik.com Git - apple/security.git/blob - keychain/behavior/SFBehavior.h
Security-59306.101.1.tar.gz
[apple/security.git] / keychain / behavior / SFBehavior.h
1 /*
2 * Copyright (c) 2017 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 #if __OBJC2__
25
26 #import <Foundation/Foundation.h>
27
28 typedef NS_ENUM(uint32_t, SFBehaviorRamping) {
29 SFBehaviorRampingDisabled = 0, /* must not be enabled */
30 SFBehaviorRampingEnabled = 1, /* unconditionally enabled */
31 SFBehaviorRampingPromoted = 2, /* should be promoted by application */
32 SFBehaviorRampingVisible = 3, /* allowed to enabled */
33 };
34
35 @interface SFBehavior : NSObject
36
37 + (SFBehavior *)behaviorFamily:(NSString *)family;
38 - (instancetype)init NS_UNAVAILABLE;
39
40 /*
41 * Ramping control controlled by CloudKit and configuration
42 *
43 * Return the current ramping state, can be called as often as clients want, state is cached
44 * and fetched in background (returning SFBehaviorRampingDisabled) until server changes the value.
45 *
46 * Ramping always go from Disable -> Visiable -> Promoted -> Enabled, can can skip over steps in-between.
47 *
48 * The feature can also go from { Visiable, Promoted, Enabled } -> Disabled if the feature is disabled
49 *
50 * Passing in force will for fetching the value from the server and bypass all caching, this will
51 * take its sweet time, so don't block UI on this operation, using force is not recommended.
52 */
53 - (SFBehaviorRamping)ramping:(NSString *)feature force:(bool)force;
54
55 /*
56 * This feature is assumed to be enabled unless disabled by configuration.
57 */
58 - (bool)featureEnabled:(NSString *)feature;
59 /*
60 * This feature is assumed to be disabled unless enabled by configuration.
61 */
62 - (bool)featureDisabled:(NSString *)feature;
63
64 /*
65 * Fetch configuration values that might be changed from server configuration
66 */
67 - (NSNumber *)configurationNumber:(NSString *)configuration defaultValue:(NSNumber *)defaultValue;
68 - (NSString *)configurationString:(NSString *)configuration defaultValue:(NSString *)defaultValue;
69
70 @end
71
72 #endif