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
service
The 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) -> URL
Parameters
key
The 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
value
The encrypted value that should be stored.
key
The key that identifies the value.
callback
A closure that is called asynchronuously once the operation is finished.
error
An 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
key
The key that identifies the value.
callback
A closure that is called asynchronuously once the operation is finished.
value
The value if no error occurred,
nil
else.error
An 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
key
The key that identifies the value.
callback
A closure that is called asynchronuously once the operation is finished.
error
An optional error that might have occurred during storing.