Skip to main content
reference

GenericInbox

Constructors

constructor

constructor(_inboxClient: InboxClient)

NameTypeDescription
_inboxClientInboxClient

Fields

inboxId

Gets ID of Inbox

get inboxId(): string

Methods

delete

Deletes Inbox

async delete()

TypeDescription
Promise<void>

info

Fetches info about Inbox.

async info()

TypeDescription
Promise<Inbox> information about Inbox

listEntries

Gets a list of entries from current Inbox.

async listEntries(pageIndex: number, options: ListOptions)

NameTypeDescription
pageIndexnumberindicates from which page the list should start
optionsListOptionsoptional `options` object

TypeDescription
Promise<PagingList<InboxEntry>> `PagingList<InboxEntry>

on

Registers an event listener for Inbox entry-related events.

on(eventType: T, callback: (payload: Extract<InboxEntryCreatedEvent, {type: T;}> | Extract<InboxEntryDeletedEvent, {type: T;}>)=>void)

NameTypeDescription
eventTypeTtype of event to listen for.
callback(payload: Extract<InboxEntryCreatedEvent, {type: T;}> | Extract<InboxEntryDeletedEvent, {type: T;}>)=>voidcallback function to execute when the event occurs

TypeDescription
SubscribeForChannel<"inboxEntries"> & { removeEventListener: ()=>void; } object containing the

publicView

Fetches inbox public meta.

async publicView()

TypeDescription
Promise<InboxPublicView>

sendData

Sends data and optional files to an Inbox.

async sendData(entry: InboxEntryPayload)

NameTypeDescription
entryInboxEntryPayloadInbox entry object

TypeDescription
Promise<void>

subscribeForEntryEvents

Subscribes to entry events on given Inbox: - `inboxNewEntry` - `inboxEntryDeleted`

async subscribeForEntryEvents()

TypeDescription
Promise<SubscribeForChannel<"inboxEntries">> <'inboxEntries'> `Promise<SubscribeForChannel<'inboxEntries'>>

unsubscribeFromEntryEvents

Unsubscribes and removes all registered callbacks from events related to entries in this Inbox.

async unsubscribeFromEntryEvents()

TypeDescription
Promise<void> a promise that resolves with void

update

Updates Inbox by overriding fields with new ones. When updating, Bridge will check version number. Updates of Inbox with different version number will be rejected. Version number is incremented after every update.

async update(updatedData: {
filesConfig: FilesConfig;
managers: UserWithPubKey[];
options: {
force: boolean;
forceGenerateNewKey: boolean;
};
privateMeta: Uint8Array;
publicMeta: Uint8Array;
users: UserWithPubKey[];
version: number;
})

NameTypeDescription
updatedData.filesConfigFilesConfigobject to override default file configuration. Provide undefined if you want to leave the default configuration.
updatedData.managersUserWithPubKey[]list of `UserWithPubKey` objects which indicates who will have access (and management rights) to the updated Inbox
updatedData.options{ force: boolean; forceGenerateNewKey: boolean; }
updatedData.privateMetaUint8Array(encrypted) private Inbox metadata
updatedData.publicMetaUint8Array(unencrypted) public Inbox metadata
updatedData.usersUserWithPubKey[]list of `UserWithPubKey` objects which indicates who will have access to the updated Inbox
updatedData.versionnumbercurrent version of the updated Inbox

TypeDescription
Promise<void> a promise that resolves with void