PrivMX DOCS
API Reference/PrivMX Endpoint Swift/Kvdb

KvdbApi

‘KvdbApi’ is a class representing Endpoint’s API for Kvdbs and their messages.

Static Methods

create(connection:)

Creates an instance of ‘KvdbApi’.

Params

connection

inout Connection

instance of ‘Connection’

public static func create(
connection: inout Connection
) throws -> KvdbApi

Returns

KvdbApi · KvdbApi object.

Methods

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

Creates a new KVDB in given Context.

Params

contextId

std.string

ID of the Context to create the KVDB in

users

privmx.UserWithPubKeyVector

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

managers

privmx.UserWithPubKeyVector

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

publicMeta

privmx.endpoint.core.Buffer

public (unencrypted) metadata

privateMeta

privmx.endpoint.core.Buffer

private (encrypted) metadata

policies

privmx.endpoint.core.ContainerPolicy?

KVDB’s policies

public func createKvdb(
contextId: std.string,
users: privmx.UserWithPubKeyVector,
managers: privmx.UserWithPubKeyVector,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
policies: privmx.endpoint.core.ContainerPolicy? = nil
) throws -> std.string

Returns

std.string · Id of the created KVDB

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

Updates an existing KVDB.

Params

kvdbId

std.string

ID of the KVDB to update

users

privmx.UserWithPubKeyVector

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

managers

privmx.UserWithPubKeyVector

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

publicMeta

privmx.endpoint.core.Buffer

public (unencrypted) metadata

privateMeta

privmx.endpoint.core.Buffer

private (encrypted) metadata

version

Int64

current version of the updated KVDB

force

Bool

force update (without checking version)

forceGenerateNewKey

Bool

force to regenerate a key for the KVDB

policies

privmx.endpoint.core.ContainerPolicy?

KVDB’s policies

public func updateKvdb(
kvdbId: std.string,
users:privmx.UserWithPubKeyVector,
managers:privmx.UserWithPubKeyVector,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
version: Int64,
force:Bool,
forceGenerateNewKey:Bool,
policies:privmx.endpoint.core.ContainerPolicy? = nil
) throws -> Void

deleteKvdb(kvdbId:)

Deletes a KVDB by given KVDB ID.

Params

kvdbId

std.string

ID of the KVDB to delete

public func deleteKvdb(
kvdbId: std.string
) throws -> Void

hasEntry(kvdbId:key:)

Check whether the KVDB entry exists.

Params

kvdbId

std.string

KVDB ID of the KVDB entry to check

key

std.string

key of the KVDB entry to check

public func hasEntry(
kvdbId: std.string,
key: std.string
) throws -> Bool

Returns

Bool · ‘true’ if the KVDB has an entry with given key, ‘false’ otherwise

getKvdb(kvdbId:)

Gets a KVDB by given KVDB ID.

Params

kvdbId

std.string

ID of KVDB to get

public func getKvdb(
kvdbId:std.string
) throws -> privmx.endpoint.kvdb.Kvdb

Returns

privmx.endpoint.kvdb.Kvdb · struct containing info about the KVDB

listKvdbs(contextId:pagingQuery:)

Gets a list of Kvdbs in given Context.

Params

contextId

std.string

ID of the Context to get the Kvdbs from

pagingQuery

privmx.endpoint.core.PagingQuery

with list query parameters

public func listKvdbs(
contextId:std.string,
pagingQuery: privmx.endpoint.core.PagingQuery
) throws -> privmx.KvdbList

Returns

privmx.KvdbList · struct containing a list of Kvdbs

getEntry(kvdbId:key:)

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

Params

kvdbId

std.string

KVDB ID of the KVDB entry to get

key

std.string

key of the KVDB entry to get

public func getEntry(
kvdbId: std.string,
key: std.string
) throws -> privmx.endpoint.kvdb.KvdbEntry

Returns

privmx.endpoint.kvdb.KvdbEntry · struct containing the KVDB entry

listEntriesKeys(kvdbId:pagingQuery:)

Gets a list of KVDB entries keys from a KVDB.

Params

kvdbId

std.string

ID of the KVDB to list KVDB entries from

pagingQuery

privmx.endpoint.core.PagingQuery

with list query parameters

public func listEntriesKeys(
kvdbId: std.string,
pagingQuery: privmx.endpoint.core.PagingQuery
) throws -> privmx.StringList

Returns

privmx.StringList · struct containing a list of KVDB entries

listEntries(kvdbId:pagingQuery:)

Gets a list of KVDB entries from a KVDB.

Params

kvdbId

std.string

ID of the KVDB to list KVDB entries from

pagingQuery

privmx.endpoint.core.PagingQuery

with list query parameters

public func listEntries(
kvdbId: std.string,
pagingQuery: privmx.endpoint.core.PagingQuery
) throws -> privmx.KvdbEntryList

Returns

privmx.KvdbEntryList · struct containing a list of KVDB entries

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

Sets a KVDB entry in the given KVDB.

Params

kvdbId

std.string

ID of the KVDB to set the entry to

key

std.string

KVDB entry key

publicMeta

privmx.endpoint.core.Buffer

public KVDB entry metadata

privateMeta

privmx.endpoint.core.Buffer

private KVDB entry metadata

data

privmx.endpoint.core.Buffer

content of the KVDB entry

version

Int64

public func setEntry(
kvdbId: std.string,
key: std.string,
publicMeta: privmx.endpoint.core.Buffer,
privateMeta: privmx.endpoint.core.Buffer,
data: privmx.endpoint.core.Buffer,
version: Int64 = 0
) throws -> Void

Returns

`` · ID of the new KVDB entry

deleteEntry(kvdbId:key:)

Deletes a KVDB entry by given KVDB entry ID.

Params

kvdbId

std.string

KVDB ID of the KVDB entry to delete

key

std.string

key of the KVDB entry to delete

public func deleteEntry(
kvdbId: std.string,
key: std.string
) throws -> Void

deleteEntries(kvdbId:keys:)

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

Params

kvdbId

std.string

ID of the KVDB database to delete from

keys

privmx.StringVector

vector of the keys of the KVDB entries to delete

public func deleteEntries(
kvdbId: std.string,
keys: privmx.StringVector
) throws -> privmx.StringBoolMap

Returns

privmx.StringBoolMap · map with the statuses of deletion for every key

subscribeForKvdbEvents()

Subscribes for the KVDB module main events.

public func subscribeForKvdbEvents(
) throws -> Void

unsubscribeFromKvdbEvents()

Unsubscribes from the KVDB module main events.

public func unsubscribeFromKvdbEvents(
) throws -> Void

subscribeForEntryEvents(kvdbId:)

Subscribes for events in given KVDB.

Params

kvdbId

std.string

ID of the KVDB to subscribe

public func subscribeForEntryEvents(
kvdbId: std.string
) throws -> Void

unsubscribeFromEntryEvents(kvdbId:)

Unsubscribes from events in given KVDB.

Params

kvdbId

std.string

ID of the KVDB to unsubscribe

public func unsubscribeFromEntryEvents(
kvdbId: std.string
) throws -> Void

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.