com.miracl.miracltrust

MiraclError

MiraclError<SUCCESS, FAIL> is an error response from the MIRACLTrust SDK. It provides a value of type FAIL and an optional exception.

data class MiraclError<SUCCESS, FAIL> : MiraclResult<SUCCESS, FAIL>

Constructors

MiraclError<SUCCESS, FAIL> is an error response from the MIRACLTrust SDK. It provides a value of type FAIL and an optional exception.

MiraclError(value: FAIL, exception: Exception? = null)

Properties

exception

val exception: Exception?

value

val value: FAIL

MiraclResult

MiraclResult is a class representing the MIRACLTrust SDK responses.

sealed class MiraclResult<SUCCESS, FAIL>

MiraclSuccess

MiraclSuccess<SUCCESS, FAIL> is a success response from the MIRACLTrust SDK. It provides a value of type SUCCESS.

data class MiraclSuccess<SUCCESS, FAIL> : MiraclResult<SUCCESS, FAIL>

Constructors

MiraclSuccess<SUCCESS, FAIL> is a success response from the MIRACLTrust SDK. It provides a value of type SUCCESS.

MiraclSuccess(value: SUCCESS)

Properties

value

val value: SUCCESS

MiraclTrust

Miracl Trust is the entry point of the Miracl Trust SDK. It is configured and connects with the MIRACLTrust Platform on its initialization.

class MiraclTrust

Initialization is done through configure(context,configuration). After initialization, the SDK can be accessed through getInstance().

Properties

users

var users: List<User>

The registered users, stored inside the user storage

Functions

authenticate

fun authenticate(user: User, accessId: String, pinProvider: PinProvider, resultHandler: ResultHandler<Unit, Error>): Unit

Authenticate a registered user.

Parameters

user - the user to authenticate.

accessId - provides an access id by url or camera and QR code.

pinProvider - a callback called from the SDK, when the user PIN is required.

resultHandler - a callback to handle the result of the authentication.

deleteUser

fun deleteUser(user: User): Unit

Delete a registered user.

Parameters

user - the user to be deleted.

register

@JvmOverloads fun register(userId: String, activationCode: ActivationCode, accessId: String, pinProvider: PinProvider, resultHandler: ResultHandler<User, Error>, deviceName: String= Build.MODEL):Unit

Provides end-user registration. Registers an end-user for a given MiraclTrust Customer to the MiraclTrust platform.

Parameters

userId - provides an unique user id (i.e. email).

activationCode - provides an activate code for verification.

accessId - provides an access id by url or camera and QR code.

pinProvider - a callback called from the SDK, when the user PIN is required.

resultHandler - a callback to handle the result of the registration.

deviceName - provides a device name. Defaults to the model of the device.

Companion Object Functions

configure

@JvmStatic fun configure(context: Context, configuration: Configuration): Unit

Initialize the MIRACLTrust SDK.

To be used once. Multiple uses could lead to unidentified behavior!

Parameters

context - application context, used for managing storage.

configuration - instance of Configuration, used to configure the SDK.

getInstance

@JvmStatic fun getInstance(): MiraclTrust

User

User is a Miracl Trust data class to represent an identity.s

data class User

Constructors

User is a Miracl Trust data class to represent an identity.

User(userId: String, pinLength: Int, isBlocked: Boolean, mpinId: ByteArray, token: ByteArray, dtas: String)

Parameters

userId - Identifier of the user. Could be email, username, etc.

isBlocked - provides information if the user is blocked or not.

mpinId - representing the user identity to the Miracl Trust Platform.

token - representing the identity of the user securely. It provides the user with authentication when valid.

dtas - required for server side validation

Properties

dtas

val dtas: String

required for server side validation

isBlocked

val isBlocked: Boolean

provides information if the user is blocked or not.

mpinId

val mpinId: ByteArray

representing the user identity to the Miracl Trust Platform.

pinLength

val pinLength: Int

token

val token: ByteArray

representing the identity of the user securely. It provides the user with authentication when valid.

userId

val userId: String

Identifier of the user. Could be email, username, etc.

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int