Skip to main content
reference

Connection

Swift wrapper for privmx.NativeConnectionWrapper, used to establish and manage secure connections with PrivMX platform.

Static Methods​

connect(as:toπŸ”›)​

Establishes an authorized connection to PrivMX Bridge. This method initiates a secured connection to PrivMX Bridge using the user’s private key. The connection allows for the execution of secured operations within a specified Solution.

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

NameTypeDescription
userPrivKeyStringThe user’s private key used for authentication (WIF format).
solutionIDStringThe unique identifier of the Solution to connect to.
bridgeUrlStringThe URL of PrivMX Bridge to connect to.

TypeDescription
any PrivMXConnection A new `PrivMXConnection` instance representing the established connection.

connectPublic(toπŸ”›)​

Establishes a public connection to PrivMX Bridge. This method initiates a public connection to PrivMX Bridge, which is typically used for operations that do not require authentication, such as handling inbound traffic to an Inbox.

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

NameTypeDescription
solutionIDStringThe unique identifier of the Solution to connect to.
bridgeUrlStringThe URL of PrivMX Bridge to connect to.

TypeDescription
any PrivMXConnection A new `PrivMXConnection` instance representing the public connection.

setCertsPath(_:)​

Sets the path to the `.pem` file containing certificates required for establishing a connection. This method configures the path to a `.pem` file with certificates necessary to authenticate the connection. The required certificates depend on the specific setup of PrivMX Bridge.

public static func setCertsPath(
_ path: String
) throws

NameTypeDescription
pathStringThe path to the `.pem` file containing the required certificates.

Methods​

listContexts(basedOn:)​

Lists all available Contexts for the authorized user in the current Solution. This method retrieves a list of Contexts available to the user, filtered according to the provided query.

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

NameTypeDescription
queryprivmx.endpoint.core.PagingQueryA `PagingQuery` object to filter the list of Contexts.

TypeDescription
privmx.ContextList A `privmx.endpoint.core.ContextList` instance containing the list of Contexts.