Setup E3Kit Client
In this section we will show you how to install and setup E3Kit client for different platforms.
On the client side we will use the E3Kit to create and store user's private key on their device and publish user's corresponding public key in the Virgil Cloud.
Before you begin
The main thing you need to have before starting E3Kit client is your backend up and running. This is needed to provide a user with the JWT.
Use your package manager to download the E3Kit into your mobile or web project.
Virgil E3Kit is distributed via Carthage and CocoaPods.
Package is available for:
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
- watchOS 2.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate Virgil E3Kit into your Xcode project using CocoaPods, specify it in your Podfile:
target '<Your Target Name>' do use_frameworks! pod 'VirgilE3Kit', '~> 2.0.0' end
Then, run the following command:
$ pod install
To communitcate with Virgil Cloud, Virgil E3Kit must be provided with:
tokenCallback- a callback that Virgil E3Kit will call to fetch the Virgil JWT from your backend for the current user;
identity- your user's identity.
EThree initializer has plenty of optional parameters to customize it's behaviour. You can easily set them using
import VirgilE3Kit // create EThreeParams with mandatory parameters // such as identity and tokenCallback let params = try! EThreeParams(identity: "Alice", tokenCallback: tokenCallback) // OR // EThreeParams can also be initialized from config plist file // see the example of config file here: https://github.com/VirgilSecurity/virgil-e3kit-x/tree/0.8.0/Tests/Data/ExampleConfig let configUrl = Bundle.main.url(forResource: "EThreeConfig", withExtension: "plist")! let params = try! EThreeParams(identity: "Alice", tokenCallback: tokenCallback, configUrl: configUrl) // initialize E3Kit with the EThreeParams let ethree = try! EThree(params: params)
Initialize with post-quantum
Starting from version 0.8.0, all Virgil E3Kit frameworks support post-quantum cryptography (PQC) algorithms.
If you want to implement Post-Quantum Encryption in your application, use the following snippet to initialize E3Kit with PQC algorithms:
// add KeyPairType to the EThreeParams and // specify post-quantum algorithm type (E3Kit uses Round5 for // encryption and Falcon for signature) params.keyPairType = KeyPairType.CURVE25519_ROUND5_ED25519_FALCON
With E3Kit initialized with post-quantum algorithms, there are some limitations, learn more in this guide.
Initialize with Double Ratchet
If you want to enable Double Ratchet Encryption in your application, use the following snippet:
// customize EThreeParams to enable Double Ratchet params.enableRatchet = true
Note that enabling Double Ratchet won't affect any encryption methods other than those specified in this guide.
Learn how to manage your users with the E3Kit: