ORKKeychainWrapper Class Reference

Inherits from NSObject
Declared in ORKKeychainWrapper.h

The ORKKeychainWrapper class is an abstraction layer for the iOS keychain communication.

+ setObject:forKey:error:

Sets the given object in the keychain for the provided key.

+ (BOOL)setObject:(id<NSSecureCoding>)object forKey:(NSString *)key error:(NSError *_Nullable *)error

Parameters

object

The data to be stored in the keychain.

key

The key used to set the data in the keychain.

error

If failure occurred, an NSError object indicating the reason for the failure. The value of this parameter is nil if result does not indicate failure.

Return Value

A boolean with a value YES if the object was saved; otherwise `NO'.

Declared In

ORKKeychainWrapper.h

+ objectForKey:error:

Returns the object in the keychain for the provided key.

+ (nullable id<NSSecureCoding>)objectForKey:(nonnull NSString *)key error:(NSError *__autoreleasing _Nullable *)error

Parameters

key

The key used to set the data in the keychain.

error

If failure occurred, an NSError object indicating the reason for the failure. The value of this parameter is nil if result does not indicate failure.

Return Value

An object or nil if key is not valid.

Declared In

ORKKeychainWrapper.h

+ removeObjectForKey:error:

Removes the object in the keychain for the provided key.

+ (BOOL)removeObjectForKey:(NSString *)key error:(NSError *_Nullable *)error

Parameters

key

The key used to set the value in the keychain.

error

If failure occurred, an NSError object indicating the reason for the failure. The value of this parameter is nil if result does not indicate failure.

Return Value

A boolean with a value YES if the object was removed; otherwise `NO'.

Declared In

ORKKeychainWrapper.h

+ resetKeychainWithError:

Removes all values stored in the keychain for the app.

+ (BOOL)resetKeychainWithError:(NSError *_Nullable *)error

Parameters

error

If failure occurred, an NSError object indicating the reason for the failure. The value of this parameter is nil if result does not indicate failure.

Return Value

A boolean with a value YES if the keychain was reset; otherwise `NO'.

Declared In

ORKKeychainWrapper.h