PrivMX DOCS
API Reference/PrivMX Endpoint Swift Extra/Core

PrivMXConnection

The PrivMXConnection protocol declares methods for managing connections to PrivMX Bridge with Swift types. This protocol defines the required methods for setting up, managing, and disconnecting a connection to PrivMX platform. It provides functionality for setting up the path to SSL certificates, managing connection lifecycle (connect/disconnect), and retrieving important connection details such as the connection ID. Additionally, it offers methods for connecting with public or private access.

Static Methods

setCertsPath(_:)

Sets path to .pem file with certificates needed for establishing connection. This certificates depends on your Bridge setup.

Params

path

String

Path to the .pem file

static func setCertsPath(
_ path: String
) throws -> Void

connect(as:to:on:)

Connects with provided credentials to PrivMX Bridge.

Params

userPrivKey

String

User’s Private Key in WIF format

solutionID

String

Unique Solution Identifier defined at PrivMX Bridge

bridgeUrl

String

static func connect(
as userPrivKey: String,
to solutionID: String,
on bridgeUrl: String
) throws -> any PrivMXConnection

Returns

any PrivMXConnection · new Connection object which can be used for initializing proper PrivMX Endpoint APIs

connectPublic(to:on:)

Connects with public access to PrivMX Bridge. It is used mainly for public access to InboxApi.

Params

solutionID

String

Unique Solution Identifier defined at PrivMX Bridge

bridgeUrl

String

static func connectPublic(
to solutionID: String,
on bridgeUrl: String
) throws -> any PrivMXConnection

Returns

any PrivMXConnection · new Connection object which can be used for initializing PrivMX InboxApi.

Methods

disconnect()

Disconnects current connection. Calling this function finished usage of PrivMXConnection object.

func disconnect(
) throws -> Void

getConnectionId()

Returns current Connection ID.

func getConnectionId(
) throws -> Int64

Returns

Int64 · Current Connection ID. Used for managing and identifying connections.

listContexts(basedOn:)

Lists Contexts to which the connected user has access.

Params

query

privmx.endpoint.core.PagingQuery

Object holding parameters of the query

func listContexts(
basedOn query: privmx.endpoint.core.PagingQuery
) throws -> privmx.ContextList

Returns

privmx.ContextList · Structure containing all Contexts user has access to.

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.