@dxos/halo
    Preparing search index...

    Interface ServiceApi

    The service shape backing Service. Named (rather than inline in the Context.Tag) so consumers referencing it — e.g. a capability typed Context.Service.Shape<typeof Identity.Service> — name it portably instead of expanding its structure and leaking the transitive Invitation types into their declaration emit (TS2883).

    interface ServiceApi {
        create: (
            options?: {
                data?: Record<string, unknown>;
                deviceLabel?: string;
                displayName?: string;
            },
        ) => Effect<
            {
                data?: { readonly [key: string]: any };
                did: IdentityDid;
                displayName?: string;
                identityKey?: string;
            },
            IdentityError,
        >;
        createApiToken: (
            options: ApiTokenOptions,
        ) => Effect<AccessToken, IdentityError>;
        createRecoveryCredential: (
            options?: RecoveryCredentialOptions,
        ) => Effect<{ recoveryCode?: string }, IdentityError>;
        credentials: Stream<
            readonly {
                id?: string;
                issuanceDate?: Date;
                recovery?: {
                    kind: "unknown"
                    | "passkey"
                    | "recovery-code"
                    | "oauth";
                    label?: string;
                    lookupKey?: string;
                    revoked: boolean;
                };
                type: string;
            }[],
        >;
        devices: Stream<
            readonly {
                current: boolean;
                key: string;
                kind?: | "unknown"
                | "browser"
                | "native"
                | "mobile"
                | "agent"
                | "agent-managed";
                label?: string;
                os?: string;
                platform?: string;
                presence?: "online"
                | "offline"
                | "removed";
            }[],
        >;
        getDevicesSnapshot: () => readonly {
            current: boolean;
            key: string;
            kind?: | "unknown"
            | "browser"
            | "native"
            | "mobile"
            | "agent"
            | "agent-managed";
            label?: string;
            os?: string;
            platform?: string;
            presence?: "online"
            | "offline"
            | "removed";
        }[];
        getEdgeIdentity: () => Option<EdgeIdentity>;
        getSnapshot: () => Option<
            {
                data?: { readonly [key: string]: any };
                did: IdentityDid;
                displayName?: string;
                identityKey?: string;
            },
        >;
        grantServiceAccess: (
            options: ServiceAccessOptions,
        ) => Effect<void, IdentityError>;
        identity: Stream<
            Option<
                {
                    data?: { readonly [key: string]: any };
                    did: IdentityDid;
                    displayName?: string;
                    identityKey?: string;
                },
            >,
        >;
        invitations: Stream<readonly Flow[]>;
        join: (code: string) => Effect<Flow, IdentityError>;
        personalSpaceId: Effect<Option<SpaceId>, IdentityError>;
        recover: (
            args: RecoverArgs,
        ) => Effect<
            {
                data?: { readonly [key: string]: any };
                did: IdentityDid;
                displayName?: string;
                identityKey?: string;
            },
            IdentityError,
        >;
        requestRecoveryChallenge: Effect<
            { challenge: string; controlFeedKey: string; deviceKey: string },
            IdentityError,
        >;
        revokeRecoveryCredential: (
            lookupKey: string,
        ) => Effect<void, IdentityError>;
        share: (options?: ShareOptions) => Effect<Flow, IdentityError>;
        subscribe: (
            callback: (
                identity: Option<
                    {
                        data?: { readonly [key: string]: any };
                        did: IdentityDid;
                        displayName?: string;
                        identityKey?: string;
                    },
                >,
            ) => void,
        ) => () => void;
        updateProfile: (
            profile: { data?: Record<string, unknown>; displayName?: string },
        ) => Effect<
            {
                data?: { readonly [key: string]: any };
                did: IdentityDid;
                displayName?: string;
                identityKey?: string;
            },
            IdentityError,
        >;
    }
    Index

    Properties

    create: (
        options?: {
            data?: Record<string, unknown>;
            deviceLabel?: string;
            displayName?: string;
        },
    ) => Effect<
        {
            data?: { readonly [key: string]: any };
            did: IdentityDid;
            displayName?: string;
            identityKey?: string;
        },
        IdentityError,
    >

    Create the local identity (and its first device).

    createApiToken: (options: ApiTokenOptions) => Effect<AccessToken, IdentityError>

    Mint an API token bound to this identity's account (Hub), for a CLI or service to act as it. Returns it as an unsaved AccessToken; the token secret is returned only once, so the caller stores it.

    createRecoveryCredential: (
        options?: RecoveryCredentialOptions,
    ) => Effect<{ recoveryCode?: string }, IdentityError>

    Write a recovery credential for this identity. Returns the generated recovery code when HALO generated the key; nothing when an external key (passkey) was registered.

    credentials: Stream<
        readonly {
            id?: string;
            issuanceDate?: Date;
            recovery?: {
                kind: "unknown"
                | "passkey"
                | "recovery-code"
                | "oauth";
                label?: string;
                lookupKey?: string;
                revoked: boolean;
            };
            type: string;
        }[],
    >

    HALO credentials of the local identity; emits the current set immediately.

    devices: Stream<
        readonly {
            current: boolean;
            key: string;
            kind?: | "unknown"
            | "browser"
            | "native"
            | "mobile"
            | "agent"
            | "agent-managed";
            label?: string;
            os?: string;
            platform?: string;
            presence?: "online"
            | "offline"
            | "removed";
        }[],
    >

    Devices belonging to the local identity; emits the current set immediately.

    getDevicesSnapshot: () => readonly {
        current: boolean;
        key: string;
        kind?: | "unknown"
        | "browser"
        | "native"
        | "mobile"
        | "agent"
        | "agent-managed";
        label?: string;
        os?: string;
        platform?: string;
        presence?: "online"
        | "offline"
        | "removed";
    }[]

    Synchronous snapshot of the local identity's devices, for imperative callers.

    getEdgeIdentity: () => Option<EdgeIdentity>

    The signed-in identity as an EDGE/Hub authentication principal (Option.none when no identity or local device exists). Synchronous because every consumer attaches it inside a React effect or an identity-change callback; the signing it defers is what is asynchronous.

    getSnapshot: () => Option<
        {
            data?: { readonly [key: string]: any };
            did: IdentityDid;
            displayName?: string;
            identityKey?: string;
        },
    >

    Synchronous snapshot of the local identity (Option.none when none exists). For imperative callers (non-React, non-Effect) that need the current value without subscribing.

    grantServiceAccess: (
        options: ServiceAccessOptions,
    ) => Effect<void, IdentityError>

    Grant this identity access to an EDGE/Hub service by writing a ServiceAccess credential (self-issued). Replaces hand-constructing the protobuf credential at the call site.

    identity: Stream<
        Option<
            {
                data?: { readonly [key: string]: any };
                did: IdentityDid;
                displayName?: string;
                identityKey?: string;
            },
        >,
    >

    The local identity (Option.none when none exists) as a stream that emits the current value immediately on subscription. Take the first element for a one-shot read; subscribe for updates.

    invitations: Stream<readonly Flow[]>

    Active (host-created) device-invitation flows; emits the current set immediately.

    join: (code: string) => Effect<Flow, IdentityError>

    Redeem a device-invitation code on a new device (guest side).

    personalSpaceId: Effect<Option<SpaceId>, IdentityError>

    Id of the identity's personal (HALO) space — where its credentials live. Option.none when no identity exists. Derived asynchronously from the identity key, hence a verb rather than a field on Info.

    recover: (
        args: RecoverArgs,
    ) => Effect<
        {
            data?: { readonly [key: string]: any };
            did: IdentityDid;
            displayName?: string;
            identityKey?: string;
        },
        IdentityError,
    >

    Re-admit this device to an existing identity via a recovery credential.

    requestRecoveryChallenge: Effect<
        { challenge: string; controlFeedKey: string; deviceKey: string },
        IdentityError,
    >

    Request the challenge a recovery key must sign to admit this device.

    revokeRecoveryCredential: (lookupKey: string) => Effect<void, IdentityError>

    Revoke a recovery credential by its hex-encoded lookup key.

    share: (options?: ShareOptions) => Effect<Flow, IdentityError>

    Initiate a device invitation (host side).

    subscribe: (
        callback: (
            identity: Option<
                {
                    data?: { readonly [key: string]: any };
                    did: IdentityDid;
                    displayName?: string;
                    identityKey?: string;
                },
            >,
        ) => void,
    ) => () => void

    Subscribe to local-identity changes (imperative). Invokes callback immediately with the current value, then on each change. Returns an unsubscribe function.

    updateProfile: (
        profile: { data?: Record<string, unknown>; displayName?: string },
    ) => Effect<
        {
            data?: { readonly [key: string]: any };
            did: IdentityDid;
            displayName?: string;
            identityKey?: string;
        },
        IdentityError,
    >

    Update the identity profile.