In oder to further simplify API potential improvement would be to have just one class that joins all the functionality. We even don't need to create instance of the class
Code example could be:
OktaSecureStorageManager.save(data: "Token Data", accountId: "jdoe", groupId: "com.mycompany.sharedkeychain")let token = OktaSecureStorageManager.storedData()
@jmelberg-okta , @hansreichenbach-okta , thank you for your comments!
So short action plan could be the following:
Rename OktaSecureStorageManager to OktaSecureStorage as class in fact doesn’t manage anything. It is just facade that simplifies work with the keychain
Get rid of class hierarchies and simplify usage of the library
Get rid of stateful nature of the class and move required query data to parameters. Make it more like a functional programming approach
Implement OktaSecureStorage as a singleton for easy access and DI
Get rid of superfluous function - saveWithPasscodePin as it was not requested by product management
Current API just mimics interfaces and ideas from Okta private repo - ios-utils
Developer has to create storage manager instance of particular type via factory method. Then use lightweight object for working with keychain
Example:
let storageManager = OktaSecureStorageManager.secureStorageManager(type: .plainText, accountId: "jdoe", groupId: "com.mycompany.sharedkeychain") storageManager.save(data: "Token Data")
let token = storageManager.storedData()
In oder to further simplify API potential improvement would be to have just one class that joins all the functionality. We even don't need to create instance of the class Code example could be:
OktaSecureStorageManager.save(data: "Token Data", accountId: "jdoe", groupId: "com.mycompany.sharedkeychain")
let token = OktaSecureStorageManager.storedData()