KeyValueStorageBackend
protocol KeyValueStorageBackend
A protocol defining a key-value storage backend. It basically is similar to
the KeyValueStorage protocol but with encryped keys and encrypted values.
You can use this to implement a custom protocol for storing a secure key-value storage.
-
Store an encrypted value to the key-value storage backend for a given key.
Declaration
Swift
func store(value: EncryptedValue, for key: EncryptedKey, callback: @escaping (Error?) -> Void)Parameters
valueThe encrypted value that should be stored.
keyThe key that identifies the value.
callbackA closure that is called asynchronuously once the operation is finished.
errorAn optional error that might have occurred during storing.
-
Retrieve an encrypted value from the key-value backend for a given key.
Postcondition
(
value=nil) ⊻ (error=nil)Declaration
Swift
func retrieve(for key: EncryptedKey, callback: @escaping (EncryptedValue?, Error?) -> Void)Parameters
keyThe key that identifies the value.
callbackA closure that is called asynchronuously once the operation is finished.
valueThe value if no error occurred,
nilelse.errorAn optional error that might have occurred during storing.
-
Remove the encrypted value from the key-value backend for a given key.
Declaration
Swift
func remove(for key: EncryptedKey, callback: @escaping (Error?) -> Void)Parameters
keyThe key that identifies the value.
callbackA closure that is called asynchronuously once the operation is finished.
errorAn optional error that might have occurred during storing.
View on GitHub
KeyValueStorageBackend Protocol Reference