import type { DocHandle, Repo } from '@automerge/automerge-repo';
import { type Store } from '@xstate/store';
import type { PrivateAppIdentity, PrivatePrivyAppIdentity } from './connect/types.js';
import type { DocumentContent } from './entity/types.js';
import type { InboxSenderAuthPolicy } from './inboxes/types.js';
import type { Invitation, Updates } from './messages/index.js';
import type { SpaceEvent, SpaceState } from './space-events/index.js';
export type InboxMessageStorageEntry = {
    id: string;
    plaintext: string;
    ciphertext: string;
    signature: {
        hex: string;
        recovery: number;
    } | null;
    createdAt: string;
    authorAccountAddress: string | null;
};
export type SpaceInboxStorageEntry = {
    inboxId: string;
    isPublic: boolean;
    authPolicy: InboxSenderAuthPolicy;
    encryptionPublicKey: string;
    secretKey: string;
    lastMessageClock: string;
    messages: InboxMessageStorageEntry[];
    seenMessageIds: Set<string>;
};
export type AccountInboxStorageEntry = {
    inboxId: string;
    isPublic: boolean;
    authPolicy: InboxSenderAuthPolicy;
    encryptionPublicKey: string;
    lastMessageClock: string;
    messages: InboxMessageStorageEntry[];
    seenMessageIds: Set<string>;
};
export type SpaceStorageEntry = {
    id: string;
    name: string;
    events: SpaceEvent[];
    state: SpaceState | undefined;
    keys: {
        id: string;
        key: string;
    }[];
    automergeDocHandle: DocHandle<DocumentContent>;
    inboxes: SpaceInboxStorageEntry[];
};
interface StoreContext {
    spaces: SpaceStorageEntry[];
    spacesLoadingIsPending: boolean;
    updatesInFlight: string[];
    invitations: Invitation[];
    repo: Repo | null;
    identities: {
        [accountAddress: string]: {
            encryptionPublicKey: string;
            signaturePublicKey: string;
            accountProof: string;
            keyProof: string;
            appId: string | null;
        }[];
    };
    authenticated: boolean;
    identity: PrivateAppIdentity | null;
    privyIdentity: PrivatePrivyAppIdentity | null;
    lastUpdateClock: {
        [spaceId: string]: number;
    };
    accountInboxes: AccountInboxStorageEntry[];
}
type StoreEvent = {
    type: 'setInvitations';
    invitations: Invitation[];
} | {
    type: 'reset';
} | {
    type: 'addUpdateInFlight';
    updateId: string;
} | {
    type: 'removeUpdateInFlight';
    updateId: string;
} | {
    type: 'setSpacesList';
    spaces: {
        id: string;
        name: string;
    }[];
} | {
    type: 'applyEvent';
    spaceId: string;
    event: SpaceEvent;
    state: SpaceState;
} | {
    type: 'updateConfirmed';
    spaceId: string;
    clock: number;
} | {
    type: 'applyUpdate';
    spaceId: string;
    firstUpdateClock: number;
    lastUpdateClock: number;
} | {
    type: 'addVerifiedIdentity';
    accountAddress: string;
    encryptionPublicKey: string;
    signaturePublicKey: string;
    accountProof: string;
    keyProof: string;
    appId: string | null;
} | {
    type: 'setSpaceInbox';
    spaceId: string;
    inbox: SpaceInboxStorageEntry;
} | {
    type: 'setSpaceInboxMessages';
    spaceId: string;
    inboxId: string;
    messages: InboxMessageStorageEntry[];
    lastMessageClock: string;
} | {
    type: 'setAccountInbox';
    inbox: AccountInboxStorageEntry;
} | {
    type: 'setAccountInboxMessages';
    inboxId: string;
    messages: InboxMessageStorageEntry[];
    lastMessageClock: string;
} | {
    type: 'setSpace';
    spaceId: string;
    name: string;
    updates?: Updates;
    events: SpaceEvent[];
    inboxes?: SpaceInboxStorageEntry[];
    spaceState: SpaceState;
    keys: {
        id: string;
        key: string;
    }[];
} | {
    type: 'setAuth';
    identity: PrivateAppIdentity;
} | {
    type: 'setPrivyAuth';
    identity: PrivatePrivyAppIdentity;
} | {
    type: 'resetAuth';
} | {
    type: 'setRepo';
    repo: Repo;
};
type GenericEventObject = {
    type: string;
};
export declare const store: Store<StoreContext, StoreEvent, GenericEventObject>;
export {};
//# sourceMappingURL=store.d.ts.map