!!! warning This package is no longer supported. You can find identity packages available in other language at https://github.com/TankerHQ?q=identity
The Tanker Identity SDK is distributed as a Maven package.
If you are using Gradle for your project, you need to patch the build.gradle
file at the top project to add the Maven repository used by Tanker:
allprojects {
repositories {
// ...
maven {
url 'https://storage.googleapis.com/maven.tanker.io'
}
}
}
Then add the Identity library to the list of dependencies:
dependencies {
implementation 'io.tanker.identity:identity:1.0.0-beta-1'
}
Create a new Tanker identity. This identity is secret and must only be given to a user who has been authenticated by your application. This identity is used by the Tanker client SDK to open a Tanker session.
import io.tanker.identity.Identity;
String identity = Identity.createIdentity(appId, appSecret, userId);
Parameters | |
---|---|
appId: String | The app ID, you can access it from the Tanker dashboard |
appSecret: String | The app secret, secret that you have saved right after the creation of your app |
userId: String | The unique ID of a user in your application |
Returns | |
---|---|
String | An identity |
Create a Tanker provisional identity. It allows you to share a resource with a user who does not have an account in your application yet. It must be served to an authenticated user, and attached client-side to access the resource. You will need to verifiy the associated email.
String identity = Identity.createProvisionalIdentity(appId, "email", email);
Parameters | |
---|---|
appId: String | The app ID, you can access it from the Tanker dashboard |
email: String | The email associated with the provisional identity |
Returns | |
---|---|
String | A provisional identity |
Return the public identity from an identity or a provisional identity. This public identity can be used by the Tanker client SDK to share encrypted resources and add users to groups.
String publicIdentity = Identity.getPublicIdentity(identity);
Parameters | |
---|---|
identity: String | An identity or a provisional identity |
Returns | |
---|---|
String | A public identity |
Read more about Tanker and identities in the Tanker documentation