KeyValueStorage
class KeyValueStorage
This class handles the URL construction of the key-value storage API of the P-Service.
-
Undocumented
Declaration
Swift
weak var service: PrivacyService! -
Initialize the key-value storage backend.
Declaration
Swift
init(service: PrivacyService)Parameters
serviceThe P-Service object.
-
The entry point of the key-value storage API.
Declaration
Swift
var entryPoint: URL { get } -
Get the URL for a resource for a given key.
Declaration
Swift
func url(for key: EncryptedKey) -> URLParameters
keyThe key that identifies the resource.
Return Value
The URL of the resource.
-
The default URL session configuration, which is used in order to connect to the the key-value storage backend. This adds support for the Shalon URL protocol.
Declaration
Swift
func defaultSessionConfiguration() -> URLSessionConfiguration
-
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 (Swift.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?, Swift.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 (Swift.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
KeyValueStorage Class Reference