Connection
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:)
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.
bridgeUrl
std.string
The URL of PrivMX platform endpoint.
verificationOptions
privmx.endpoint.core.PKIVerificationOptions
Returns
Connection
·
A Connection
instance that can be used for further operations.
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:)
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.
bridgeUrl
std.string
The URL of PrivMX platform endpoint.
verificationOptions
privmx.endpoint.core.PKIVerificationOptions
Options used to verify if Bridge on given url is the one you expect.
Returns
Connection
·
A public Connection
instance that can be used for non-authenticated operations.
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()
Retrieves the unique ID of the connection. Each connection instance has a unique identifier that can be used to track and manage multiple connections.
Returns
Int64
·
The unique ID of the current connection as an Int64
.
disconnect()
Disconnects the current connection to PrivMX platform.
Once disconnected, the Connection
instance, along with any associated API instances like StoreApi
or ThreadApi
, becomes unusable. It is important to call this method when the connection is no longer needed to free up resources.
listContexts(query:)
Lists all Contexts available to the currently connected 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
A PagingQuery
object that specifies the filtering and pagination options for the query.
Returns
privmx.ContextList
·
A ContextList
structure containing the total number of Contexts and a list of the retrieved Contexts.
getContextUsers(contextId:)
Retrieves a list of Users from a particular Context.
Params
contextId
std.string
Id of the Context.
Returns
privmx.UserInfoVector
·
a list of UserInfo objects.
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
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.
PrivMX Endpoint Swift v2.3