ZDCUserIdentity

@interface ZDCUserIdentity : NSObject <NSSecureCoding, NSCopying>

Encapsulates an identity that’s attached to the user.

For example, a user may attach their Facebook or LinkedIn identity. This is done to improve searchability, and to provide proof that a ZDC account is owned by a particular person (and not an imposter, or somebody else with a similar name).

  • Standard initializer

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDictionary:(nonnull NSDictionary *)dict;

    Swift

    init(dictionary dict: [AnyHashable : Any])
  • The identityID is the unique identifier for this identity, which encodes both the provider_name & provider_userID.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull identityID;

    Swift

    var identityID: String { get }
  • Name of the identity provider. (e.g. facebook, github, …)

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull provider;

    Swift

    var provider: String { get }
  • The userID within the context of the provider/connection.

    For example, if the provider is facebook, then the userID will be the unique facebookUserID.

    @important This is NOT the same as ZDCUser.uuid.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull userID;

    Swift

    var userID: String { get }
  • If the provider_name is auth0, this value stores the database connection being used. Otherwise the value is nil.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *connection;

    Swift

    var connection: String? { get }
  • Flag that indicates if the identity is Social. e.g: Facebook

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isSocial;

    Swift

    var isSocial: Bool { get }
  • The owner-preferred flag may be set by the owner of this identity.

    For example, Alice might link multiple identities to her account:

    • Facebook (for friends & family)
    • LinkedIn (for work colleagues)

    Alice might set her LinkedIn profile as her preferred identity. This means that, all else being equal, her LinkedIn name & avatar will be shown to other people.

    However, this can be overridden by other users. For example, Bob (Alice’s friend) may prefer to see Alice’s Facebook name & avatar. So Bob can set Alice’s ZDCUser.preferredIdentityID to override this value.

    In other words:

    • Alice’s LinkedIn ZDCUserIdentity.isOwnerPerferredIdentity is TRUE
    • But Bob has set Alice’s ZDCUser.preferredIdentityID to point at her Facebook ZDCUserIdentity
    • Thus on Bob’s system, we display Alice using her Facebook identity

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isOwnerPreferredIdentity;

    Swift

    var isOwnerPreferredIdentity: Bool { get }
  • User’s profile data, which comes from the identity provider.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSDictionary *_Nonnull profileData;

    Swift

    var profileData: [AnyHashable : Any] { get }
  • Returns the proper display name, taking into consideration many different things, including the provider & profileData.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull displayName;

    Swift

    var displayName: String { get }
  • Co-op users have a recovery connection created for them automatically.

    This protects users in the event they’re unable to login to their social identity. For example, say their only linked identity is Facebook. And then Facebook decides to kick them off the platform for thought crimes. This would leave them in a situation in which they have no way to login to their account.

    In such a situation, the Recovery connection can act as way to restore a user’s access to their account. ZeroDark will have policies and procedures in place for this situation.

    Note: Logging into a social account (or recovery account) doesn’t allow you to do jack squat unless you have your access key. Without the access key you can’t read any data.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isRecoveryAccount;

    Swift

    var isRecoveryAccount: Bool { get }