DITIdentity

@interface DITIdentity : NSObject

Used to identify a given peer in your network. In practice a peer may be a user, a device, or it might be some other entity in your system.

You can get up and running quickly by using a development identity and then change to using a production identity when you are preparing to deploying DittoObjC to production.

  • The type of the identity.

    Declaration

    Objective-C

    @property (nonatomic, readonly) enum DITIdentityType type;
  • The app name.

    Use this to ensure that connections between devices are only established if they share the same app name.

    Note that this is only set if the identity is a development identity.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull appName;
  • The site ID.

    Use this to identity different users or devices. Site IDs are persisted between sessions if using a development identity.

    Site IDs should be unique and not reused by different users or devices.

    Note that this is only set if the identity is a development identity.

    Declaration

    Objective-C

    @property (nonatomic, readonly) uint64_t siteID;
  • A base64 encoded DER representation of a private key, which is shared between devices for a single app.

    Note that this is only set if the identity is a shared key identity.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *sharedKey;
  • A base64 encoded string representation of a certificate bundle.

    Note that this is only set if the identity is a production identity.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *certificateConfig;
  • Creates a development identity with the default app name and a random site ID.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Return Value

    The default development identity.

  • Creates a development identity with the provided app name and provided site ID.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAppName:(nullable NSString *)appName
                                     siteID:(uint64_t)siteID;

    Return Value

    A development identity using either the provided app name or the default one, and the provided site ID.

  • Creates a shared key identity with the provided app name, site ID and private key.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAppName:(nonnull NSString *)appName
                                  sharedKey:(nonnull NSString *)sharedKey
                                     siteID:(uint64_t)siteID;

    Return Value

    A shared key identity

  • Creates a development identity with the provided site ID and the default app name.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSiteID:(uint64_t)siteID;

    Return Value

    A development identity using the default app name and the provided site ID.

  • Creates a development identity with the provided app name and a random site ID.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAppName:(nonnull NSString *)appName;

    Return Value

    A development identity using the provided app name and a random site ID.

  • Creates a production identity using the provided certificate config.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCertificateConfig:
        (nonnull NSString *)certificateConfig;

    Return Value

    A production identity using the provided certificate config.