Awesome
Virgil KeyKnox Objective-C/Swift SDK
Introduction | SDK Features | Install and configure SDK | Docs | Support
Introduction
<a href="https://developer.virgilsecurity.com/docs"><img width="230px" src="https://cdn.virgilsecurity.com/assets/images/github/logos/virgil-logo-red.png" align="left" hspace="10" vspace="6"></a>Virgil Security provides an SDK which allows you to communicate with Virgil Keyknox Service. Virgil Keyknox Service allows users to store their sensitive data (such as Private Key) encrypted (with end-to-end encryption) for using and sharing it between different devices.
SDK Features
- use Virgil Crypto library
- use Virgil SDK
- upload encrypted sensitive data to Virgil Keyknox Service
- download the data from Virgil Keyknox Service
- update and synchronize the data
Install and configure SDK
Installation
Virgil Keyknox SDK is provided as a set of frameworks. These frameworks are distributed via Carthage and CocoaPods. Also in this guide, you find one more package called VirgilCrypto (Virgil Crypto Library) that is used by the SDK to perform cryptographic operations.
Frameworks are available for:
- iOS 9.0+
- macOS 10.11+
- tvOS 9.0+
- watchOS 2.0+
COCOAPODS
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate Virgil Keyknox into your Xcode project using CocoaPods, specify it in your Podfile:
target '<Your Target Name>' do
use_frameworks!
pod 'VirgilSDKKeyknox', '~> 0.4.2'
end
Then, run the following command:
$ pod install
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate Virgil Keyknox into your Xcode project using Carthage, create an empty file with name Cartfile in your project's root folder and add following lines to your Cartfile
github "VirgilSecurity/virgil-keyknox-x" ~> 0.4.2
Linking against prebuilt binaries
To link prebuilt frameworks to your app, run following command:
$ carthage update
This will build each dependency or download a pre-compiled framework from github Releases.
Building for iOS/tvOS/watchOS
On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, add following frameworks from the Carthage/Build folder inside your project's folder:
- VirgilSDKKeyknox
- VirgilSDK
- VirgilCryptoAPI
- VirgilCrypto
- VirgilCryptoFoundation
- VSCCommon
- VSCFoundation
On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase.” Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:
/usr/local/bin/carthage copy-frameworks
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
$(SRCROOT)/Carthage/Build/iOS/VirgilSDKKeyknox.framework
$(SRCROOT)/Carthage/Build/iOS/VirgilSDK.framework
$(SRCROOT)/Carthage/Build/iOS/VirgilCryptoAPI.framework
$(SRCROOT)/Carthage/Build/iOS/VirgilCrypto.framework
$(SRCROOT)/Carthage/Build/iOS/VirgilCryptoFoundation.framework
$(SRCROOT)/Carthage/Build/iOS/VSCCommon.framework
$(SRCROOT)/Carthage/Build/iOS/VSCFoundation.framework
Building for macOS
On your application target's “General” settings tab, in the “Embedded Binaries” section, drag and drop following frameworks from the Carthage/Build folder on disk:
- VirgilSDKKeyknox
- VirgilSDK
- VirgilCryptoAPI
- VirgilCrypto
- VirgilCryptoFoundation
- VSCCommon
- VSCFoundation
Additionally, you'll need to copy debug symbols for debugging and crash reporting on macOS.
On your application target’s “Build Phases” settings tab, click the “+” icon and choose “New Copy Files Phase”. Click the “Destination” drop-down menu and select “Products Directory”. For each framework, drag and drop corresponding dSYM file.
Configure SDK
To begin using Virgil Keyknox SDK you'll need to initialize SyncKeyStorage
class. This class is responsible for synchronization between Keychain and Keyknox Cloud.
In order to initialize SyncKeyStorage
class you'll need the following values:
accessTokenProvider
public keys
of all devices/users that should have access to dataprivate key
of current device/useridentity
of the user (the device can have different users)
import VirgilSDK
import VirgilSDKKeyknox
// Setup Access Token provider to provide access token for Virgil services
// Check https://github.com/VirgilSecurity/virgil-sdk-x
let accessTokenProvider = ""
// Download public keys of users that should have access to data from Virgil Cards service
// Check https://github.com/VirgilSecurity/virgil-sdk-x
let publicKeys = []
// Load private key from Keychain
let privateKey = ""
let syncKeyStorage = SyncKeyStorage(identity: "Alice",
accessTokenProvider: accessTokenProvider,
publicKeys: publicKeys, privateKey: privateKey)
Docs
Virgil Security has a powerful set of APIs, and the documentation below can get you started today.
License
This library is released under the 3-clause BSD License.
Support
Our developer support team is here to help you. Find out more information on our Help Center.
You can find us on Twitter or send us email support@VirgilSecurity.com.
Also, get extra help from our support team on Slack.