Config

public struct Config: Codable

Configuration for the E3DB Client

  • The name for this client

    Declaration

    Swift

    public let clientName: String
  • The client identifier

    Declaration

    Swift

    public let clientId: UUID
  • The API key identifier

    Declaration

    Swift

    public let apiKeyId: String
  • The API secret for making authenticated calls

    Declaration

    Swift

    public let apiSecret: String
  • The client’s public encryption key

    Declaration

    Swift

    public let publicKey: String
  • The client’s secret encryption key

    Declaration

    Swift

    public let privateKey: String
  • The base URL for the E3DB service

    Declaration

    Swift

    public let baseApiUrl: URL
  • The client’s public signing key

    Declaration

    Swift

    public let publicSigKey: String
  • The client’s secret signing key

    Declaration

    Swift

    public let privateSigKey: String
  • Initializer to customize the configuration of the client. Typically, library users will use the Client.register(token:clientName:apiUrl:completion:) method which will supply an initialized Config object. Use this initializer if you register with the other registration method, Client.register(token:clientName:publicKey:apiUrl:completion:). Pass this object to the Client(config:) initializer to create a new Client.

    Declaration

    Swift

    public init(
        clientName: String,
        clientId: UUID,
        apiKeyId: String,
        apiSecret: String,
        publicKey: String,
        privateKey: String,
        baseApiUrl: URL,
        publicSigKey: String,
        privateSigKey: String
    )

    Parameters

    clientName

    The name for this client

    clientId

    The client identifier

    apiKeyId

    The API key identifier

    apiSecret

    The API secret for making authenticated calls

    publicKey

    The client’s public key

    privateKey

    The client’s secret key

    baseApiUrl

    The base URL for the E3DB service

  • Securely load a profile using the device’s Secure Enclave if available.

    Important

    Accessing this Keychain data will require the user to confirm their presence via biometrics (e.g. Touch ID or Face ID) or passcode entry. If no passcode is set on the device, this method will fail. Data may be lost when the user removes an entry (fingerprint, face, or passcode) from the device.

    See also

    init(loadProfile:keychainAccess:) for loading Config objects from the Keychain without the Secure Enclave.

    See also

    save(profile:enclaveAccess:) for storing the Config object using the Secure Enclave.

    Declaration

    Swift

    public init?(loadProfile: String? = nil, userPrompt: String? = nil, enclaveAccess: ConfigAccessControl.SecureEnclave = .biometricAny)

    Parameters

    loadProfile

    Name of the profile that was previously saved. Uses internal default if unspecified.

    userPrompt

    A message used to inform the user about unlocking the profile. Uses internal default if unspecified.

    enclaveAccess

    The Secure Enclave access control level used to protect the configuration when saved. Uses .biometricAny if unspecified.

    Return Value

    A fully initialized Config object if successful, nil otherwise.

  • Securely load a profile from the device’s Keychain.

    See also

    init(loadProfile:userPrompt:enclaveAccess:) for loading Config objects from the Keychain using the Secure Enclave.

    See also

    save(profile:keychainAccess:) for storing the Config object in the Keychain.

    Declaration

    Swift

    public init?(loadProfile: String? = nil, keychainAccess: ConfigAccessControl.Keychain)

    Parameters

    loadProfile

    Name of the profile that was previously saved. Uses internal default if unspecified.

    keychainAccess

    The Keychain access control level used to protect the configuration when saved.

    Return Value

    A fully initialized Config object if successful, nil otherwise.

  • Securely store a profile using the device’s Secure Enclave if available.

    Important

    Accessing this Keychain data will require the user to confirm their presence via biometrics (e.g. Touch ID or Face ID) or passcode entry. If no passcode is set on the device, this method will fail. Data may be lost when the user removes an entry (fingerprint, face, or passcode) from the device.

    See also

    save(profile:keychainAccess:) for storing the Config object.

    See also

    init(loadProfile:userPrompt:enclaveAccess:) for loading Config objects from the Keychain using the Secure Enclave.

    Declaration

    Swift

    public func save(profile: String? = nil, enclaveAccess: ConfigAccessControl.SecureEnclave = .biometricAny) -> Bool

    Parameters

    profile

    Identifier for the profile for loading later. Uses internal default if unspecified.

    enclaveAccess

    The Secure Enclave access control level used to protect the configuration. Uses .biometricAny if unspecified.

    Return Value

    A boolean value indicating whether the config object was successfully saved.

  • Securely store a profile in the device Keychain.

    See also

    save(profile:enclaveAccess:) for storing the Config object using the Secure Enclave.

    See also

    init(loadProfile:keychainAccess:) for loading Config objects from the device Keychain.

    Declaration

    Swift

    public func save(profile: String? = nil, keychainAccess: ConfigAccessControl.Keychain) -> Bool

    Parameters

    profile

    Identifier for the profile for loading later. Uses internal default if unspecified.

    keychainAccess

    The Keychain access control level to protect the configuration.

    Return Value

    A boolean value indicating whether the config object was successfully saved.