DittoIdentity

public enum DittoIdentity

The various identity configurations that you can use when initializing a Ditto instance.

  • development: (Deprecated - use offlinePlayground instead) Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be used for development.
  • offlinePlayground: Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be used for development.
  • online: (Deprecated - use onlineWithAuthentication instead) Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication server. User permissions are centrally managed.
  • onlineWithAuthentication: Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication server. User permissions are centrally managed.
  • onlinePlayground: Test a Ditto Cloud app without authentication (“Playground mode”). This mode offers no security and must only be used for development.
  • sharedKey: A mode where any device is trusted provided they know the secret key. This is a simplistic authentication model normally only suitable for private apps where users and devices are both trusted.
  • manual: A manually-provided certificate identity. This accepts a base64-encoded bundle.
  • Deprecated. Please use offlinePlayground instead.

    Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be used for development. In this mode, any string can be used as the name of the app.

    @param appID the name of the app. If you are developing multiple apps, use distinct names to ensure they do not attempt to connect and sync with each other. @param siteID the site ID of the peer. @param persistenceDirectory the directory that will be used to persist Ditto data.

    Declaration

    Swift

    case development(appID: String? = nil, siteID: UInt64? = nil, persistenceDirectory: URL? = nil)
  • Develop peer-to-peer apps with no cloud connection. This mode offers no security and must only be used for development. In this mode, any string can be used as the name of the app.

    @param appID the name of the app. If you are developing multiple apps, use distinct names to ensure they do not attempt to connect and sync with each other. @param siteID the site ID of the peer. @param persistenceDirectory the directory that will be used to persist Ditto data.

    Declaration

    Swift

    case offlinePlayground(appID: String? = nil, siteID: UInt64? = nil, persistenceDirectory: URL? = nil)
  • Deprecated. Please use onlineWithAuthentication instead.

    Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication server. User permissions are centrally managed. Sync will not work until a successful login has occurred.

    The only required configuration is the application’s UUID, which can be found on the Ditto portal where the app is registered.

    By default cloud sync is enabled. This means the SDK will sync to a Big Peer in Ditto’s cloud when an internet connection is available. This is controlled by the enableCloudSync parameter. If true (default), a suitable wss:// URL will be added to the TransportConfig. To prevent cloud sync, or to specify your own URL later, pass false.

    Authentication requests are handled by Ditto’s cloud by default, configured in the portal at https://portal.ditto.live.

    To use a different or on-premises authentication service, pass a custom HTTPS base URL as the customAuthUrl parameter.

    @param appID a UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live. @param authenticationDelegate a handler for when Ditto requires (re)authentication. @param enableDittoCloudSync if true, auto-configure sync with Ditto Cloud. @param customAuthUrl if specified, use a custom authentication service instead of Ditto Cloud. @param persistenceDirectory the directory that will be used to persist Ditto data.

    Declaration

    Swift

    case online(appID: String,
                authenticationDelegate: DittoAuthenticationDelegate,
                enableDittoCloudSync: Bool = true,
                customAuthURL: URL? = nil,
                persistenceDirectory: URL? = nil)
  • Run Ditto in secure production mode, logging on to Ditto Cloud or on on-premises authentication server. User permissions are centrally managed. Sync will not work until a successful login has occurred.

    The only required configuration is the application’s UUID, which can be found on the Ditto portal where the app is registered.

    By default cloud sync is enabled. This means the SDK will sync to a Big Peer in Ditto’s cloud when an internet connection is available. This is controlled by the enableCloudSync parameter. If true (default), a suitable wss:// URL will be added to the TransportConfig. To prevent cloud sync, or to specify your own URL later, pass false.

    Authentication requests are handled by Ditto’s cloud by default, configured in the portal at https://portal.ditto.live.

    To use a different or on-premises authentication service, pass a custom HTTPS base URL as the customAuthUrl parameter.

    @param appID a UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live. @param authenticationDelegate a handler for when Ditto requires (re)authentication. @param enableDittoCloudSync if true, auto-configure sync with Ditto Cloud. @param customAuthUrl if specified, use a custom authentication service instead of Ditto Cloud. @param persistenceDirectory the directory that will be used to persist Ditto data.

    Declaration

    Swift

    case onlineWithAuthentication(appID: String,
                                  authenticationDelegate: DittoAuthenticationDelegate,
                                  enableDittoCloudSync: Bool = true,
                                  customAuthURL: URL? = nil,
                                  persistenceDirectory: URL? = nil)
  • Test a Ditto Cloud app without authentication (“Playground mode”). This mode offers no security and must only be used for development.

    @param appID a UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live @param enableDittoCloudSync if true, auto-configure sync with Ditto Cloud. @param persistenceDirectory the directory that will be used to persist Ditto data.

    Declaration

    Swift

    case onlinePlayground(appID: String, enableDittoCloudSync: Bool = true, persistenceDirectory: URL? = nil)
  • A mode where any device is trusted provided they know the secret key. This is a simplistic authentication model normally only suitable for private apps where users and devices are both trusted. In this mode, any string may be used as the app id.

    @param appID a UUID identifying this app registration on the Ditto portal, which can be found at https://portal.ditto.live @param sharedKey a base64-encoded DER private key. Refer to Ditto documentation for details about generating shared keys. @param siteID the site ID of the peer. @param persistenceDirectory the directory that will be used to persist Ditto data.

    Declaration

    Swift

    case sharedKey(appID: String, sharedKey: String, siteID: UInt64? = nil, persistenceDirectory: URL? = nil)
  • A manually-provided certificate identity. This accepts a base64-encoded bundle.

    @param certificateConfig a base64 encoded string representation of a certificate bundle.

    Declaration

    Swift

    case manual(certificateConfig: String)