This class manages people - to be precise: their identities including your own.

Identity is important for defining which data belongs to whom, with whom to share data ... This class is one of the few central building blocks that makes the one ecosystem tick.

It uses three concepts to manage identities:

  • Person: A person is the identity used throughout the application. Connections, messages access rights are all tied to a person. The SHA256Hash of the person object is what is usually used to refer to a person, so if we speak of person-id we usually mean the SHA256Hash. Another alias for a person / person-id is 'Identity'.
  • Profile: A profile describes a person and ways how to contact that person. Multiple profiles for the same person are supported, because we think that you don't want to share the same profile about yourself with all persons you know. Perhaps you want to share a 'good boy' profile (nice profile image) with your family, but a bad-ass profile with your friends.
  • Someone: A real life persons might want to create multiple identities. Use cases are: - Anonymous identities (throw away identities or for dating ...) - Work Identity / Private Identity to be able to separate work from private life better compared having one identity but a work and private profile. 'Someone' is a collection of Identities that belongs to a single person. For other persons you usually only know a single identity, so the someone object of this person just refers to profiles of a single identity. But for your own you will have lots of Identities. Someone is only a local mechanism to group multiple identities of the same person. It has no meaning beyond the own ONE ecosystem.

Q: How are Person / Profile and Someone related? A: Someone refers to multiple profiles, a profile refers to an identity.

Q: What are the responsibilities of this model? A:

  1. Manage all those identities
    • Create new identities
    • Get a list of identities / own identities
  2. Manage the profiles describe those identities.
    • create / update / delete profiles
    • share profiles with others / get sharing state
    • obtain profiles

Other important information:

  • Each profile has an owner. It is a namespacing mechanism. Only the owner should write the profile. This should be enforces in the future.
  • The 'default' profile where personId and owner are the same has a special meaning: It is the profile that is automatically updated with ne sign keys etc, and this is also the profile that is shared by default with other people.

Hierarchy (view full)

Constructors

  • Constructor

    Parameters

    • commserverUrl: string

      when creating the default oneInstanceEndpoint this url is used

    • createEveryoneGroup: boolean = false

      If true then init() should create an everyone group and add listeners for new 'Person' objects and add them if they are not in the everyone group. (default: false)

    Returns default

Properties

afterMainIdSwitch: OEvent<((oldIdentity: SHA256IdHash<Person>, newIdentity: SHA256IdHash<Person>) => void)> = ...
beforeMainIdSwitch: OEvent<((oldIdentity: SHA256IdHash<Person>, newIdentity: SHA256IdHash<Person>) => void)> = ...
onMeIdentitiesChange: OEvent<(() => void)> = ...
onNewOneInstanceEndpoint: OEvent<((endpoint: OneInstanceEndpoint, isMe: boolean) => void)> = ...
onProfileUpdate: OEvent<((profile: Profile, isMe: boolean) => void)> = ...
onUpdated: OEvent<(() => void)> = ...
state: StateMachine<"Uninitialised" | "Initialised", "shutdown" | "init">
EVERYONE_GROUP_NAME: "everyone" = 'everyone'

Accessors

Methods

  • Add a profile to a someone object already managing this persons identity.

    If no such someone object exists a new one is created.

    Parameters

    Returns Promise<void>

  • Change the main identity by setting a new mainProfile.

    Parameters

    • newIdentity: SHA256IdHash<Person>

    Returns Promise<void>

  • Create a new identity for myself with a complete set of keys and a 'default' profile.

    This will:

    • Create a new person (random email or the specified one)
    • Create complete keypairs for person
    • Create a new instance owned by the new person (random instance name or the specified one)
    • Create complete keypairs for instance
    • Create a 'default' profile for the new identity owned by itself
    • Certify profile with "TrustKeys" certificate issued by your main identity
    • Certify profile with "AffirmationCertificate" certificate issued by the new identity

    Parameters

    • Optionalemail: string
    • OptionalinstanceName: string

    Returns Promise<default>

  • Create a new group.

    If it already exist this will return the existing group instead.

    Parameters

    • Optionalname: string

      If specified use this name, otherwise create a group with a random id.

    Returns Promise<default>

    the created group or the existing one if it already existed.

  • Create a new profile for someone.

    Parameters

    • personId: SHA256IdHash<Person>

      The Person for which to create the personId

    • OptionalprofileId: string

      The profile id. Defaults to a random string.

    • OptionalensureSomeoneId: SHA256IdHash<Someone>

      if specified, ensure that this someone object is the found object.

    Returns Promise<default>

  • Create a new identity for someone with a 'default' profile.

    This will:

    • Create a new person (random email or the specified one)
    • Create an empty 'default' profile for the new identity owned by your main identity

    Parameters

    • someoneId: SHA256IdHash<Someone>
    • Optionalemail: string

    Returns Promise<default>

  • Create someone with a completely new identity.

    Parameters

    • Optionalemail: string

    Returns Promise<SHA256IdHash<Someone>>

  • Get the profile name from one of the default profiles.

    It will first try to find the profile that we edited (I am owner). Then it will try to find the profile that the person itself edited (He is owner) Then it will look for a default profile from any owner.

    Parameters

    • personId: SHA256IdHash<Person>

    Returns Promise<string>

  • Return the main ProfileModel of the SomeoneModel identified by the personId.

    Parameters

    • personId: SHA256IdHash<Person>

    Returns Promise<default>

  • Get the profile name from the main profile.

    Parameters

    • personId: SHA256IdHash<Person>

    Returns Promise<string>

  • Return the SomeoneModel identified by the person Id or undefined otherwise.

    Parameters

    • personId: SHA256IdHash<Person>

    Returns Promise<undefined | default>

  • Init the module.

    This will initialize the data structures for 'me': someone, profile and a OneInstanceEndpoint for the current instance. As main identity the owner of the main one instance is used. This might change in the future!

    Returns Promise<void>

  • Get the someone that represents me, but don't load the data, yet.

    In order to use the returned model you have to call one of its load functions first.

    Returns default

  • Get my own main identity (at the moment from the main profile).

    Returns Promise<SHA256IdHash<Person>>

  • Get all other persons you know, but don't grab the data, yet.

    In order to use the returned models you have to call one of its load functions first.

    Returns default[]

  • Sets a new profile for myself.

    If the profile has a different identity, than the old one the main identity will change!

    Parameters

    Returns Promise<void>

  • Parameters

    • object: SHA256Hash
    • group: SHA256IdHash<Group>

    Returns Promise<void>

  • Parameters

    • id: SHA256IdHash
    • group: SHA256IdHash<Group>

    Returns Promise<void>