Skip to main content
reference

Inboxes

Class representing instance of Inboxes API

Methods

createInbox

Creates a new Inbox.

createInbox(contextId, users, managers, publicMeta, privateMeta, filesConfig)

NameTypeDescription
contextIdstringID of the Context of the new Inbox
usersUserWithPubKey[]vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersUserWithPubKey[]vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetaUint8Arraypublic (unencrypted) metadata
privateMetaUint8Arrayprivate (encrypted) metadata
filesConfigFilesConfig | undefinedstruct to override default file configuration

TypeDescription
Promise<string> ID of the created Inbox

updateInbox

Updates an existing Inbox.

updateInbox(inboxId, users, managers, publicMeta, privateMeta, filesConfig, version, force, forceGenerateNewKey)

NameTypeDescription
inboxIdstringID of the Inbox to update
usersUserWithPubKey[]vector of UserWithPubKey structs which indicates who will have access to the created Inbox
managersUserWithPubKey[]vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Inbox
publicMetaUint8Arraypublic (unencrypted) metadata
privateMetaUint8Arrayprivate (encrypted) metadata
filesConfigFilesConfig | undefinedstruct to override default files configuration
versionnumbercurrent version of the updated Inbox
forcebooleanforce update (without checking version)
forceGenerateNewKeybooleanforce to regenerate a key for the Inbox

getInbox

Gets a single Inbox by given Inbox ID.

getInbox(inboxId)

NameTypeDescription
inboxIdstringID of the Inbox to get

TypeDescription
Promise<Inbox> struct containing information about the Inbox

listInboxes

Gets s list of Inboxes in given Context.

listInboxes(contextId, pagingQuery)

NameTypeDescription
contextIdstringID of the Context to get Inboxes from
pagingQueryPagingQuerystruct with list query parameters

TypeDescription
Promise<PagingList<Inbox>> struct containing list of Inboxes

getInboxPublicView

Gets public data of given Inbox. You do not have to be logged in to call this function.

getInboxPublicView(inboxId)

NameTypeDescription
inboxIdstringID of the Inbox to get

TypeDescription
Promise<InboxPublicView> struct containing public accessible information about the Inbox

deleteInbox

Deletes an Inbox by given Inbox ID.

deleteInbox(inboxId)

NameTypeDescription
inboxIdstringID of the Inbox to delete

prepareEntry

Prepares a request to send data to an Inbox. You do not have to be logged in to call this function.

prepareEntry(inboxId, data, inboxFileHandles, userPrivKey)

NameTypeDescription
inboxIdstringID of the Inbox to which the request applies
dataUint8Arrayentry data to send
inboxFileHandlesnumber[]optional list of file handles that will be sent with the request
userPrivKeystring | undefinedoptional sender's private key which can be used later to encrypt data for that sender

TypeDescription
Promise<number> Inbox handle

sendEntry

Sends data to an Inbox. You do not have to be logged in to call this function.

sendEntry(inboxHandle)

NameTypeDescription
inboxHandlenumberID of the Inbox to which the request applies

readEntry

Gets an entry from an Inbox.

readEntry(inboxEntryId)

NameTypeDescription
inboxEntryIdstringID of an entry to read from the Inbox

TypeDescription
Promise<InboxEntry> struct containing data of the selected entry stored in the Inbox

listEntries

Gets list of entries in given Inbox.

listEntries(inboxId, pagingQuery)

NameTypeDescription
inboxIdstringID of the Inbox
pagingQueryPagingQuerystruct with list query parameters

TypeDescription
Promise<PagingList<InboxEntry>> struct containing list of entries

deleteEntry

Delete an entry from an Inbox.

deleteEntry(inboxEntryId)

NameTypeDescription
inboxEntryIdstringID of an entry to delete from the Inbox

createFileHandle

Creates a file handle to send a file to an Inbox. You do not have to be logged in to call this function.

createFileHandle(publicMeta, privateMeta, fileSize)

NameTypeDescription
publicMetaUint8Arraypublic file metadata
privateMetaUint8Arrayprivate file metadata
fileSizenumbersize of the file to send

TypeDescription
Promise<number> file handle

writeToFile

Sends a file's data chunk to an Inbox. (note: To send the entire file - divide it into pieces of the desired size and call the function for each fragment.) You do not have to be logged in to call this function.

writeToFile(inboxHandle, inboxFileHandle, dataChunk)

NameTypeDescription
inboxHandlenumberID of the Inbox to which the request applies
inboxFileHandlenumberhandle to the file where the uploaded chunk belongs
dataChunkUint8Array- file chunk to send

openFile

Opens a file to read.

openFile(fileId)

NameTypeDescription
fileIdstringID of the file to read

TypeDescription
Promise<number> handle to read file data

readFromFile

Reads file data.

readFromFile(fileHandle, length)

NameTypeDescription
fileHandlenumberhandle to the file
lengthnumbersize of data to read

TypeDescription
Promise<Uint8Array> buffer with file data chunk

seekInFile

Moves file's read cursor.

seekInFile(fileHandle, position)

NameTypeDescription
fileHandlenumberhandle to the file
positionnumbersets new cursor position

closeFile

Closes a file by given handle.

closeFile(fileHandle)

NameTypeDescription
fileHandlenumberhandle to the file

subscribeForInboxEvents

Subscribes for the Inbox module main events.

subscribeForInboxEvents()

unsubscribeFromInboxEvents

Unsubscribes from the Inbox module main events.

unsubscribeFromInboxEvents()

subscribeForEntryEvents

Subscribes for events in given Inbox.

subscribeForEntryEvents(inboxId)

NameTypeDescription
inboxIdstringID of the Inbox to subscribe

unsubscribeFromEntryEvents

Unsubscribes from events in given Inbox.

unsubscribeFromEntryEvents(inboxId)

NameTypeDescription
inboxIdstringID of the Inbox to unsubscribe