PrivMX DOCS
API Reference/PrivMX Endpoint Web/Kvdbs

KvdbApi

Class representing instance of KVDB API

Methods

createKvdb

Creates a new KVDB in given Context.

Params

contextId

string

ID of the Context to create the KVDB in

users

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access to the created KVDB

managers

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access (and management rights) to the created KVDB

publicMeta

Uint8Array

public (unencrypted) metadata

privateMeta

Uint8Array

private (encrypted) metadata

policies

ContainerPolicy

KVDB's policies

createKvdb(contextId, users, managers, publicMeta, privateMeta, policies)

Returns

Promise<string> · ID of the created KVDB

updateKvdb

Updates an existing KVDB.

Params

kvdbId

string

ID of the KVDB to update

users

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access to the created KVDB

managers

UserWithPubKey[]

array of UserWithPubKey structs which indicates who will have access (and management rights) to the created KVDB

publicMeta

Uint8Array

public (unencrypted) metadata

privateMeta

Uint8Array

private (encrypted) metadata

version

number

current version of the updated KVDB

force

boolean

force update (without checking version)

forceGenerateNewKey

boolean

force to regenerate a key for the KVDB

policies

ContainerPolicy

KVDB's policies

updateKvdb(kvdbId, users, managers, publicMeta, privateMeta, version, force, forceGenerateNewKey, policies)

deleteKvdb

Deletes a KVDB by given KVDB ID.

Params

kvdbId

string

ID of the KVDB to delete

deleteKvdb(kvdbId)

getKvdb

Gets a KVDB by given KVDB ID.

Params

kvdbId

string

ID of KVDB to get

getKvdb(kvdbId)

Returns

Promise<Kvdb> · containing info about the KVDB

listKvdbs

Gets a list of Kvdbs in given Context.

Params

contextId

string

ID of the Context to get the Kvdbs from

pagingQuery

PagingQuery

with list query parameters

listKvdbs(contextId, pagingQuery)

Returns

Promise<PagingList<Kvdb>> · containing a list of Kvdbs

getEntry

Gets a KVDB entry by given KVDB entry key and KVDB ID.

Params

kvdbId

string

KVDB ID of the KVDB entry to get

key

string

key of the KVDB entry to get

getEntry(kvdbId, key)

Returns

Promise<KvdbEntry> · containing the KVDB entry

hasEntry

Check whether the KVDB entry exists.

Params

kvdbId

string

KVDB ID of the KVDB entry to check

key

string

key of the KVDB entry to check

hasEntry(kvdbId, key)

Returns

Promise<boolean> · 'true' if the KVDB has an entry with given key, 'false' otherwise

listEntriesKeys

Gets a list of KVDB entries keys from a KVDB.

Params

kvdbId

string

ID of the KVDB to list KVDB entries from

pagingQuery

PagingQuery

with list query parameters

listEntriesKeys(kvdbId, pagingQuery)

Returns

Promise<PagingList<string>> · containing a list of KVDB entries

listEntries

Gets a list of KVDB entries from a KVDB.

Params

kvdbId

string

ID of the KVDB to list KVDB entries from

pagingQuery

PagingQuery

with list query parameters

listEntries(kvdbId, pagingQuery)

Returns

Promise<PagingList<KvdbEntry>> · containing a list of KVDB entries

setEntry

Sets a KVDB entry in the given KVDB.

Params

kvdbId

string

ID of the KVDB to set the entry to

key

string

KVDB entry key

publicMeta

Uint8Array

public KVDB entry metadata

privateMeta

Uint8Array

private KVDB entry metadata

data

Uint8Array

content of the KVDB entry

version

number

KVDB entry version (when updating the entry)

setEntry(kvdbId, key, publicMeta, privateMeta, data, version)

deleteEntry

Deletes a KVDB entry by given KVDB entry ID.

Params

kvdbId

string

KVDB ID of the KVDB entry to delete

key

string

key of the KVDB entry to delete

deleteEntry(kvdbId, key)

deleteEntries

Deletes KVDB entries by given KVDB IDs and the list of entry keys.

Params

kvdbId

string

ID of the KVDB database to delete from

keys

string[]

keys of the KVDB entries to delete

deleteEntries(kvdbId, keys)

Returns

Promise<DeleteEntriesResult> · map with the statuses of deletion for every key

subscribeFor

Subscribe for the KVDB events on the given subscription query.

Params

subscriptionQueries

string[]

list of queries

subscribeFor(subscriptionQueries)

Returns

Promise<string[]> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

string[]

list of subscriptionId

unsubscribeFrom(subscriptionIds)

buildSubscriptionQuery

Generate subscription Query for the KVDB events.

Params

eventType

KvdbEventType

type of event which you listen for

selectorType

KvdbEventSelectorType

scope on which you listen for events

selectorId

string

ID of the selector

buildSubscriptionQuery(eventType, selectorType, selectorId)

Returns

Promise<string> · undefined undefined

buildSubscriptionQueryForSelectedEntry

Generate subscription Query for the KVDB events for single KvdbEntry.

Params

eventType

KvdbEventType

type of event which you listen for

kvdbId

string

ID of the KVDB

kvdbEntryKey

string

Key of Kvdb Entry

buildSubscriptionQueryForSelectedEntry(eventType, kvdbId, kvdbEntryKey)

Returns

Promise<string> · undefined undefined

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.