KeyValueStorage

class KeyValueStorage

This class handles the URL construction of the key-value storage API of the P-Service.

  • 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.