Once your server supports Tanker Identities, you can start using the Tanker Client SDK.

Adding the Client SDK

The Tanker Client SDK is currently available for JavaScript, Android, and iOS applications.

Installation using npm

The Tanker Client SDK is distributed as the following npm packages:

  • @tanker/client-browser for Web applications
  • @tanker/client-node for Node.js client applications

In the rest of this guide, we'll assume you're using the Tanker Client SDK to add end-to-end encryption to a Web application, thus using the @tanker/client-browser npm package.

In your project directory, run:

npm install @tanker/client-browser

Supported browsers

The SDK is continuously tested with several versions of Firefox, Chrome, Edge, Internet Explorer, and Safari. We use browser stack in addition to our own CI system.

Note that although all examples are written using latest ECMAScript standard, you can still use the Tanker SDK in ECMAScript 5 compatible code.

We provide Java bindings for Android through a Maven repository.

Requirements

  • Android Studio
  • Gradle
  • Android SDK minimal version: 21

Using the Tanker Client SDK in an Android Studio project

Patch the build.gradle file at the top project to add the maven repository used by Tanker:

allprojects {
  repositories {
    // ...
    maven {
      url 'https://maven.tanker.io'
    }
  }
}

Add the Tanker bindings to the list of dependencies in your application's build.gradle file:

dependencies {
    implementation 'io.tanker:tanker-bindings:2.0.0'
}

The Tanker Client SDK also requires your app to get internet permission:

<uses-permission android:name="android.permission.INTERNET"/>

Supported architectures

The Tanker Client SDK uses native code, and the binaries we provide are compatible with all the architectures officially supported by the latest Android NDK:

  • armeabi-v7a
  • arm64-v8a
  • x86
  • x86_64

Supported architectures

The Tanker Client SDK uses native code, and the binaries we provide are compatible with the following architectures:

  • For iOS devices: armv7, armv7s, armv8.
  • For the iOS simulator: x86, x86_64.

The SDK is compatible with the latest Xcode release (9.2 at the time of writing).

The easiest way to integrate the Tanker SDK into your application is to use CocoaPods.

Installation using CocoaPods

The Tanker Client SDK is available as a CocoaPods package.

To use it, add the following lines in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/TankerHQ/PodSpecs.git'

target 'MyApp' do
  use_frameworks!
  pod 'Tanker'
end

Manual installation

If you are not using CocoaPods, please contact Tanker staff.

Initializing the Client SDK

With your app ID, instantiate a Tanker object, which will remain tied to your app.

Using import

import { Tanker } from '@tanker/client-browser';

const config = { appId: 'your-app-id' };
const tanker = new Tanker(config);

Using require

If your codebase does not support import statements, you can use the require syntax:

const { Tanker } = require('@tanker/client-browser');

const config = { appId: 'your-app-id' };
const tanker = new Tanker(config);

Using the UMD file

If needed, you can alternatively use the self-contained UMD file from the @tanker/client-browser npm package (./umd/tanker-client-browser.min.js), or from unpkg.com, with the following syntax:

<script src=".../path/to/umd/tanker-client-browser.min.js"></script>
<script>
  const { Tanker } = window.Tanker;

  const config = { appId: 'your-app-id' };
  const tanker = new Tanker(config);
</script>
String writablePath = getApplicationContext().getFilesDir().getAbsolutePath();
TankerOptions options = new TankerOptions();
options.setAppId("your-app-id")
       .setWritablePath(writablePath);
Tanker tanker = new Tanker(options);

Note

The writablePath should be a writeable folder: this is where persistent data will be stored.

@import Tanker;

@interface MyClass : NSObject
@property TKRTanker* tanker;

@end

@implementation MyClass


- (instancetype)init
{
  if (self = [super init])
  {
    TKRTankerOptions* opts = [TKRTankerOptions options];
    opts.appID = @"your-app-id";
    opts.writablePath = getWritablePath();
    self.tanker = [TKRTanker tankerWithOptions:opts];
  }
  return self;
}

NSString* getWritablePath()
{
  NSArray *paths = NSSearchPathForDirectoriesInDomains(
    NSLibraryDirectory,
    NSUserDomainMask,
    YES
  );
  NSString *libraryDirectory = [paths objectAtIndex:0];
  return libraryDirectory;
}


@end

Note

We use NSSearchPathForDirectoriesInDomains to make sure we have a writeable folder that the Tanker Client SDK can use to store persistent data.


Next, we will share some information that will facilitate the integration of Tanker within your application.