ArcGIS Runtime SDK for iOS: AGSKeychainItem.h Source File
ArcGIS Runtime SDK for iOS  100.15
AGSKeychainItem.h
Go to the documentation of this file.
1 /*
2  COPYRIGHT 2022 ESRI
3 
4  All rights reserved under the copyright laws of the United States
5  and applicable international laws, treaties, and conventions.
6 
7  This material is licensed for use under the Esri Master License
8  Agreement (MLA), and is bound by the terms of that agreement.
9  You may redistribute and use this code without modification,
10  provided you adhere to the terms of the MLA and include this
11  copyright notice.
12 
13  See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english
14 
15  For additional information, contact:
16  Environmental Systems Research Institute, Inc.
17  Attn: Contracts and Legal Services Department
18  380 New York Street
19  Redlands, California, 92373
20  USA
21 
22  email: contracts@esri.com
23  */
24  //Required for Globals API doc
26 
27 #import <Foundation/Foundation.h>
28 
29 
30 
35 typedef NS_ENUM(NSInteger, AGSKeychainItemAccessible) {
38  AGSKeychainItemAccessibleAlways API_DEPRECATED("Use an accessibility level that provides some user protection, such as AGSKeychainItemAccessibleAfterFirstUnlock", macos(10.9, 10.14), ios(4.0, 12.0)),
40  AGSKeychainItemAccessibleAlwaysThisDeviceOnly API_DEPRECATED("Use an accessibility level that provides some user protection, such as AGSKeychainItemAccessibleAfterFirstUnlockThisDeviceOnly", macos(10.9, 10.14), ios(4.0, 12.0)),
43 };
44 
54 @interface AGSKeychainItem : NSObject
55 
56 #pragma mark -
57 #pragma mark initializers
58 
59 
60 
67 -(instancetype)initWithIdentifier:(NSString*)identifier accessGroup:(nullable NSString*)accessGroup acrossDevices:(BOOL)acrossDevices;
68 
75 +(instancetype)keychainItemWithIdentifier:(NSString*)identifier accessGroup:(nullable NSString*)accessGroup acrossDevices:(BOOL)acrossDevices;
76 
84 -(instancetype)initWithIdentifier:(NSString*)identifier accessGroup:(nullable NSString*)accessGroup acrossDevices:(BOOL)acrossDevices accessible:(AGSKeychainItemAccessible)accessible;
85 
93 +(instancetype)keychainItemWithIdentifier:(NSString*)identifier accessGroup:(nullable NSString*)accessGroup acrossDevices:(BOOL)acrossDevices accessible:(AGSKeychainItemAccessible)accessible;
94 
95 #pragma mark -
96 #pragma mark properties
97 
102 @property (nonatomic, copy, readonly) NSString *identifier;
103 
108 @property (nullable, nonatomic, copy, readonly) NSString *accessGroup;
109 
114 @property (nonatomic, assign, readonly) BOOL sharedAcrossDevices;
115 
116 #pragma mark -
117 #pragma mark methods
118 
124 -(void)writeObjectToKeychain:(id<NSCoding>)object completion:(nullable void(^)(NSError * __nullable error))completion;
125 
129 -(nullable id<NSCoding>)readObjectFromKeychain;
130 
135 -(void)removeObjectFromKeychainWithCompletion:(nullable void(^)(NSError * __nullable error))completion;
136 
137 @end
138 
139 
AGSKeychainItemAccessible
Definition: AGSKeychainItem.h:35
@ AGSKeychainItemAccessibleWhenUnlockedThisDeviceOnly
Definition: AGSKeychainItem.h:42
@ AGSKeychainItemAccessibleAfterFirstUnlockThisDeviceOnly
Definition: AGSKeychainItem.h:37
@ AGSKeychainItemAccessibleAfterFirstUnlock
Definition: AGSKeychainItem.h:36
@ AGSKeychainItemAccessibleWhenPasscodeSetThisDeviceOnly
Definition: AGSKeychainItem.h:39
@ API_DEPRECATED
Definition: AGSKeychainItem.h:38
@ AGSKeychainItemAccessibleWhenUnlocked
Definition: AGSKeychainItem.h:41
A convenience class to store and retrieve objects in the keychain.
Definition: AGSKeychainItem.h:55
NSString * identifier
Definition: AGSKeychainItem.h:102
nullable id< NSCoding > readObjectFromKeychain()
NSString * accessGroup
Definition: AGSKeychainItem.h:108
BOOL sharedAcrossDevices
Definition: AGSKeychainItem.h:114