This class is a nicer frontend for the Someone recipe.

'Someone' is a collection of several person identities that belong the the same real person. Someone also collects all the profiles of those identities.

Reasons for not using the Someone recipe directly:

  • Because the whole identity management on the lower levels is pretty complicated. So it is much nicer for the users to have a nicer interface.

Constructors

Properties

idHash: SHA256IdHash<Someone>
onUpdate: OEvent<(() => void)> = ...

Methods

  • Add an identity to the someone object and save it.

    Parameters

    • identity: SHA256IdHash<Person>

    Returns Promise<void>

  • Retrieve all identities managed by this someone object except the main identity.

    Returns Promise<SHA256IdHash<Person>[]>

  • 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

    • identity: SHA256IdHash<Person>
    • myId: SHA256IdHash<Person>

      This needs to be my own main identity, because profiles with this owner will supersede the other profiles.

    Returns Promise<string>

  • Parameters

    • myId: SHA256IdHash<Person>

    Returns Promise<Map<SHA256IdHash<Person>, string>>

  • Returns whether this model has data loaded.

    If this returns false, then the 'hash', 'profileId' ... properties will throw when being accessed.

    Returns boolean

  • Get all identities managed by this someone object.

    Returns SHA256IdHash<Person>[]

  • Retrieve the main identity by looking it up in the main profile.

    Returns Promise<SHA256IdHash<Person>>

  • Checks whether this identity is managed by this someone object.

    Parameters

    • identity: SHA256IdHash<Person>

    Returns boolean

  • Get the profiles managed by this someone object.

    Note that this will return ProfileModel instances that have no data in them. You have to use loadLatestVersion on it in order to get the data.

    Parameters

    • Optionalidentity: SHA256IdHash<Person>

      Get the profiles only for this identity. If not specified, get all profiles for all identities managed by this someone object.

    Returns default[]

  • Remove an identity to the someone object

    Parameters

    • identity: SHA256IdHash<Person>

    Returns Promise<void>

  • Save the someone to disk and load the latest version.

    Why is there no pure save() function? The cause are crdts. The object that is eventually written to disk might differ from the current state of this instance. This happens when new data was received via chum since the last load. This means that we don't have a hash representing the current state.

    Returns Promise<void>

  • Sets the main identity by guessing which profile to use as mainProfile

    Parameters

    • identity: SHA256IdHash<Person>

    Returns Promise<void>

  • Set the main profile.

    Throws if the identity referenced by this profile is not managed by this someone object.

    Parameters

    Returns Promise<void>

  • Set the main profile only when the saved profile is not the main profile.

    Throws if the identity referenced by this profile is not managed by this someone object.

    Parameters

    Returns Promise<void>

  • Create a someone if it does not exist.

    If you specify descriptions and / or endpoints here and a someone version already exists without those endpoints and / or descriptions it will add them again.

    Parameters

    • someoneId: string
    • mainProfile: SHA256IdHash<Profile>

    Returns Promise<default>

    The latest version of the someone or an empty someone.