Getting Started
Initial Requirements
Before starting developing using PrivMX Endpoint Kotlin follow our quick start guide
To connect it to your environment, you need:
Bridge URL
- URL address of the instance of your PrivMX BridgeSolution ID
- ID of the Solution provided by PrivMX Bridge during its initialization processUser Private Key
- the private key from the user's public-private key pair
You also need to use your own application server to manage users (and their keys) and Contexts.
Adding Dependencies
- Add
mavenCentral()
repository to yoursettings.gradle.kts
:
- Add dependency to
build.gradle.kts
:
JVM
You have to pass path to PrivMX Endpoint native libraries directory by configuring
-Djava.library.path=<path-to-your-libraries-dir>
system property during run application.
You can download pre-compiled zipped native binaries for each supported JVM platform from GitHub Releases.
Android
Native Libraries
Before build your project you have to attach PrivMX Endpoint native libraries to Android build process by adding them
to jniLibs sourceSet directory (src/main/jniLibs
by default) for each supported ABI.
You can download pre-compiled zipped native binaries for each supported Android ABI from GitHub Releases.
Required Permissions
PrivMX Endpoint requires to add the following permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
Initial Assumptions
The initial assumptions for all the code examples below are as follows:
Connecting to PrivMX Bridge
To use any of the library's elements, you must first connect to PrivMX Bridge. Use the API keys mentioned earlier:
The active connection is kept by container
and can be accessed using container.getEndpoint(Long)
method.
Disconnecting from PrivMX Bridge
Verify Users
To verify whether users belong to the Context and the provided public key is valid, set a callback function that is triggered each time user interacts with a container. The verification process can be performed by an external service, such as your application server or PKI (Public Key Infrastructure) server.
Implement the UserVerifierInterface
and provide your own custom verification logic within its verify
method
and pass it to setUserVerifier
method.
If the verify
method does not confirm data then:
- listing/getting containers/items will return object with a non-zero statusCode
- modifying containers or items will throw an exception
By default, if no verifier is configured, the system operates as if a verifier is present and always returns successful verification (returns true).
Make sure the verify
method always returns a valid, non-null result and doesn't throw exceptions.
Closing PrivmxEndpointContainer
When you finish working with the container
, close it to end all connections, close the event loop, and release the resources being used.
You can also use a use
function in Kotlin.
Next Steps
With everything ready to go, now it's time to start using all of the platform's capabilities.
Learn how to use:
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 Kotlin v2.3