Connection
‘Connection’ represents and manages the current connection between the Endpoint and the Bridge server.
Swift wrapper for privmx.NativeConnectionWrapper, used to establish and manage secure connections with PrivMX platform.
Static Methods
setCertsPath(_:)
Sets the path to the .pem file containing the necessary certificates for the connection, which are dependent on your PrivMX Bridge setup. This method must be called before attempting to establish a connection to ensure the certificates are properly set.
Params
path
std.string
The path to the .pem file containing the certificates.
connect(userPrivKey:solutionId:bridgeUrl:verificationOptions:)
Connects to the PrivMX Bridge server.
Params
userPrivKey
std.string
user’s private key
solutionId
std.string
ID of the Solution
bridgeUrl
std.string
Bridge Server URL
verificationOptions
privmx.endpoint.core.PKIVerificationOptions
PrivMX Bridge server instance verification options using a PKI server
Returns
Connection ·
Connection object
connect(userPrivKey:solutionId:platformUrl:)
Creates a new connection instance to PrivMX platform using a private key.
The path to the certificates must be set beforehand using setCertsPath(). This connection is used to interact with secured operations such as Inboxes, Threads, and Stores.
Params
userPrivKey
std.string
The user’s private key in WIF format, required for authentication.
solutionId
std.string
The ID of the Solution that the connection targets.
platformUrl
std.string
The URL of PrivMX platform endpoint.
Returns
Connection ·
A Connection instance that can be used for further operations.
connectPublic(solutionId:bridgeUrl:verificationOptions:)
Connects to the PrivMX Bridge Server as a guest user.
The path to the certificates must be set beforehand using setCertsPath(). This type of connection is primarily used for public operations, such as inbound Inbox traffic, where authentication is not required.
Params
solutionId
std.string
ID of the Solution
bridgeUrl
std.string
Bridge Server URL
verificationOptions
privmx.endpoint.core.PKIVerificationOptions
PrivMX Bridge server instance verification options using a PKI server
Returns
Connection ·
Connection object
connectPublic(solutionId:platformUrl:)
Creates a new public connection to PrivMX platform.
The path to the certificates must be set beforehand using setCertsPath(). This type of connection is primarily used for public operations, such as inbound Inbox traffic, where authentication is not required.
Params
solutionId
std.string
The ID of the Solution that the connection targets.
platformUrl
std.string
The URL of PrivMX platform endpoint.
Returns
Connection ·
A public Connection instance that can be used for non-authenticated operations.
Methods
getConnectionId()
Gets the ID of the current connection.
Returns
Int64 ·
ID of the connection
disconnect()
Disconnects from the PrivMX Bridge server.
listContexts(query:)
Gets a list of Contexts available for the user. Contexts represent different environments or groups to which the user has access. This method returns a list of these Contexts.
Params
query
privmx.endpoint.core.PagingQuery
struct with list query parameters
Returns
privmx.ContextList ·
struct containing a list of Contexts
listContextUsers(contextId:query:)
Gets a list of users with their status and the last status change.
Params
contextId
std.string
ID of the Context
query
privmx.endpoint.core.PagingQuery
Returns
privmx.UserInfoList ·
List of users with their status and the last status change
setUserVerifier(_:)
Sets user’s custom verification callback. The feature allows the developer to set up a callback for user verification. A developer can implement an interface and pass the implementation to the function. Each time data is read from the container, a callback will be triggered, allowing the developer to validate the sender in an external service, e.g. Developer’s Application Server or PKI Server
Params
verifier
privmx.VerificationImplementation
an implementation of the verification that will be called for each request
subscribeFor(subscriptionQueries:)
Subscribe for the Context events on the given subscription query.
Params
subscriptionQueries
privmx.SubscriptionQueryVector
List of queries
Returns
privmx.SubscriptionIdVector ·
List of subscriptionIds in matching order to subscriptionQueries
unsubscribeFrom(subscriptionIds:)
Unsubscribe from events for the given subscriptionId.
Params
subscriptionIds
privmx.SubscriptionIdVector
List of subscriptionId
buildSubscriptionQuery(eventType:selectorType:selectorId:)
Generate subscription Query for the Context events.
Params
eventType
privmx.endpoint.core.EventType
type of event which you listen for
selectorType
privmx.endpoint.core.EventSelectorType
scope on which you listen for events
selectorId
std.string
ID of the selector
Returns
std.string ·
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.