DBSDKKeychain

@interface DBSDKKeychain : NSObject

Keychain class for storing OAuth tokens.

  • Stores a key / value pair in the keychain.

    Declaration

    Objective-C

    + (BOOL)storeValueWithKey:(nonnull NSString *)key
                        value:(nonnull NSString *)value;

    Swift

    class func storeValue(withKey key: String, value: String) -> Bool
  • Retrieves a value from the corresponding key from the keychain.

    Declaration

    Objective-C

    + (nullable NSString *)retrieveTokenWithKey:(nonnull NSString *)key;

    Swift

    class func retrieveToken(withKey key: String) -> String?
  • Retrieves all token uids from the keychain.

    Declaration

    Objective-C

    + (nonnull NSArray<NSString *> *)retrieveAllTokenIds;

    Swift

    class func retrieveAllTokenIds() -> [String]
  • Deletes a key / value pair in the keychain.

    Declaration

    Objective-C

    + (BOOL)deleteTokenWithKey:(nonnull NSString *)key;

    Swift

    class func deleteToken(withKey key: String) -> Bool
  • Deletes all key / value pairs in the keychain.

    Declaration

    Objective-C

    + (BOOL)clearAllTokens;

    Swift

    class func clearAllTokens() -> Bool
  • Checks if performing a v1 token migration is necessary, and if so, performs it.

    Declaration

    Objective-C

    + (BOOL)checkAndPerformV1TokenMigration:
                (nonnull DBTokenMigrationResponseBlock)responseBlock
                                      queue:(nullable NSOperationQueue *)queue
                                     appKey:(nonnull NSString *)appKey
                                  appSecret:(nonnull NSString *)appSecret;

    Swift

    class func checkAndPerformV1TokenMigration(_ responseBlock: @escaping DBTokenMigrationResponseBlock, queue: OperationQueue?, appKey: String, appSecret: String) -> Bool