OathStorage
public protocol OathStorage : Sendable
Protocol for OATH-specific storage operations. Extends the base storage capabilities with OATH-specific functionality.
Implementations of this protocol must be thread-safe and handle concurrent access properly.
-
storeOathCredential(_:Asynchronous) Store an OATH credential.
Throws
OathStorageError.storageFailureif the credential cannot be stored.Throws
OathStorageError.duplicateCredentialif a credential with the same ID already exists.Declaration
Swift
func storeOathCredential(_ credential: OathCredential) async throwsParameters
credentialThe OATH credential to be stored.
-
retrieveOathCredential(credentialId:Asynchronous) Retrieve an OATH credential by its ID.
Throws
OathStorageError.storageFailureif the credential cannot be retrieved.Declaration
Swift
func retrieveOathCredential(credentialId: String) async throws -> OathCredential?Parameters
credentialIdThe ID of the credential to retrieve.
Return Value
The OATH credential, or nil if not found.
-
getAllOathCredentials()AsynchronousGet all OATH credentials.
Throws
OathStorageError.storageFailureif the credentials cannot be retrieved.Declaration
Swift
func getAllOathCredentials() async throws -> [OathCredential]Return Value
A list of all OATH credentials.
-
removeOathCredential(credentialId:Asynchronous) Remove an OATH credential by its ID.
Throws
OathStorageError.storageFailureif the credential cannot be removed.Declaration
Swift
func removeOathCredential(credentialId: String) async throws -> BoolParameters
credentialIdThe ID of the credential to remove.
Return Value
true if the credential was successfully removed, false if it didn’t exist.
-
getCredentialByIssuerAndAccount(issuer:AsynchronousaccountName: ) Retrieve an OATH credential by issuer and account name. Used for duplicate detection during credential registration.
Throws
OathStorageError.storageFailureif the credential cannot be retrieved.Declaration
Swift
func getCredentialByIssuerAndAccount(issuer: String, accountName: String) async throws -> OathCredential?Parameters
issuerThe issuer of the credential.
accountNameThe account name of the credential.
Return Value
The OATH credential if found, nil otherwise.
-
clearOathCredentials()AsynchronousClear all OATH credentials from the storage.
Throws
OathStorageError.storageFailureif the credentials cannot be cleared.Declaration
Swift
func clearOathCredentials() async throws
View on GitHub