User management
A user
in MobbID does not store any personal information, except the biometric information itself, and it is represented by a userId
.
Almost all non-biometric operations related to the user are manage with the MobbIDManagementAPI
class. This is a list of available actions:
- Create a user
- Confirm a user
- Delete a user
- Delete a specific biometric enrollment
- Synchronise a user
Create a user
The user creation process is two steps process, first the initial creation and then a final confirmation.
mobbIDManagementAPI.createUser(new CreateUserListener() {
@Override
public void createUserFinished(MobbIDAPICreateUserResult result, String userId, String token, MobbIDAPIError errorOccurred) {
// ...
}
});
You can also have your activity or component to implement the CreateUserListener interface instead of implement anonymously
[self.mobbIDManagementAPI createUser:self];
The class invoking the createUser:
method must conform to the CreateUserDelegate
protocol.
- (void) createUserFinished:(MobbIDAPICreateUserResult)result
forUser:(NSString *)userId
token:(NSString *)token
error:(NSError *)errorOccurred {
//...
}
The create user operation will return:
- result: OK or ERROR. OK meaning the creation has been successful.
- userId: The randomly generated
userId
(UUID) that will be used from now on to identify the user. - token: This token is the user's creation token and it must be used to confirm the user in the next step of the process.
- error:
null or nil
if no error happened. Specific information of the error it happened (It will include the code of the error and a detailed explanation).
Note: If you use this creation the SDK is assuming English as the user's language and Male as the gender.
Warning: Online vs Offline: When the SDK is working in online mode the token has a default validity up to 3 minutes while in offline mode it does not expire. The expiration time is configurable in the server's settings. Please find more in the server configuration section.
Create a user with a specific userId
It is possible to create the user with a specific userId.
mobbIDManagementAPI.createUser(new CreateUserListener() {
@Override
public void createUserFinished(MobbIDAPICreateUserResult result, String userId, String token, MobbIDAPIError errorOccurred) {
// ...
}
}, MobbIDAPISupportedLanguage.ENGLISH, MobbIDAPIGender.MALE, "myOwnUserId");
[self.mobbIDManagementAPI createUserWithUserId:@"myOwnUserId"
language:MobbIDAPISupportedLanguage_English
andGender:MobbIDAPIGender_Male
delegate:self];
mobbIdManagementApi.CreateUser(userId, language, gender, this);
The class invoking the CreateUser
method must implement the IXCreateUserDelegate
interface.
void UserCreationFinished (XMobbIDCreateUserResult result, string userId, string token, IXMobbIDAPIError error)
{
// ...
}
This could be useful if you have your users already defined in your system and you do not want to store the reference between the random UUID from MobbID and your own user identifier.
If you use this approach you will have to specify the language and the gender of the user as well.
- The language is used in the voice enrollment/verification to present the challenge in his/her selected language.
- The gender might be used to improve the performance of some biometric operations.
Confirm a user
To confirm a user you will need:
- Create the user first :)
- Use the token from the user's creation operation
mobbIDManagementAPI.confirmCreateUser(new ConfirmUserListener() {
@Override
public void confirmCreateUserFinished(MobbIDAPIConfirmUserResult result, String userId, MobbIDAPIError errorOccurred) {
// ...
}
}, userId, token);
[self.mobbIDManagementAPI confirmCreateUser:userId token:token delegate:self];
The class invoking the confirmCreateUser:token:delegate:
method must conform to the ConfirmUserDelegate
protocol.
- (void) confirmCreateUserFinished:(MobbIDAPIConfirmUserResult)result
forUser:(NSString *)userId
error:(NSError *)errorOccurred {
//...
}
mobbIdManagementApi.ConfirmCreateUser(userId, token, this);
The class invoking the ConfirmCreateUser
method must implement the IXConfirmUserDelegate
interface.
void ConfirmCreateUserFinished (XMobbIDConfirmUserResult result, string userId, IXMobbIDAPIError error)
{
// ...
}
Once the user has been confirmed it could be enrolled using one of the available biometric methods. How to enroll and verify a user
If you try to perform any biometric operation with an unconfirmed user you would get an ERROR in the operation.
Check user creation
This operation is used to check if a specific user has been created in the system.
Depending on the SDK (and the server) configuration the operations to create and confirm a user could be private and they won't be done from the Mobile SDK. This operation is used to check whether or not a user has been created properly or to check if he exists on the system.
mobbIDManagementAPI.checkCreateUser(new CheckCreateUserListener() {
@Override
public void checkCreateUserFinished(MobbIDAPICheckCreateUserResult result, String userId, MobbIDAPIError errorOccurred) {
//...
}
}, userId);
[self.mobbIDManagementAPI checkCreateUser:userId delegate:self];
The class invoking the checkCreateUser:delegate:
method must conform to the CheckCreateUserDelegate
protocol.
- (void)checkCreateUserFinished:(MobbIDAPICheckCreateUserResult)result
forUser:(NSString*)userId
error:(NSError *)errorOccurred {
// ...
}
mobbIdManagementApi.CheckCreateUser(userId, this);
The class invoking the CheckCreateUser
method must implement the IXCheckCreateUserDelegate
interface.
void CheckCreateUserFinished(XMobbIDCheckCreateUserResult result, string userId, IXMobbIDAPIError error)
{
// ...
}
Delete a user
To delete an existing user:
mobbIDManagementAPI.deleteUser(new DeleteUserListener() {
@Override
public void deleteUserFinished(MobbIDAPIDeleteUserResult result, String userId, MobbIDAPIError errorOccurred) {
// ...
}
}, userId);
[self.mobbIDManagementAPI deleteUser:userId delegate:self];
The class invoking the deleteUser:delegate:
method must conform to the DeleteUserDelegate
protocol.
- (void)deleteUserFinished:(MobbIDAPIDeleteUserDelegateResult)result
forUser:(NSString*)userId
error:(NSError *)errorOccurred {
// ...
}
mobbIdManagementApi.DeleteUser(userId, this);
The class invoking the DeleteUser
method must implement the IXDeleteUserDelegate
interface.
void DeleteUserFinished(XMobbIDDeleteUserResult result, string userId, IXMobbIDAPIError error)
{
// ...
}
Some considerations:
- You can always delete a user from the system, even if it's unconfirmed.
- The biometric data linked to the user will be remove as well when you delete the user
Remove a specific enrollment
You could use this operation if the you want to "unregister" a user from a specific biometric method but you want to maintain others.
mobbIDManagementAPI.deleteUserEnrollment(new DeleteUserEnrollmentListener() {
@Override
public void deleteUserEnrollmentFinished(MobbIDAPIDeleteUserEnrollmentDelegateResult result, String userId, MobbIDAPIError errorOccurred) {
//...
}
}, userId, MobbIDAPIBiometricMethod.METHOD_FACE);
Existing constants for the biometric method names in Android:
MobbIDAPIBiometricMethod.METHOD_FACE
MobbIDAPIBiometricMethod.METHOD_FINGERPRINT
MobbIDAPIBiometricMethod.METHOD_IRIS
MobbIDAPIBiometricMethod.METHOD_SIGNATURE
MobbIDAPIBiometricMethod.METHOD_VOICE
[self.mobbIDManagementAPI deleteUserEnrollment:userId
forMethod:kMobbIDAPI_BiometricMethod_Face
delegate:self];
The class invoking the deleteUserEnrollment:forMethod:delegate:
method must conform to the DeleteUserEnrollmentDelegate
protocol.
- (void)deleteUserEnrollmentFinished:(MobbIDAPIDeleteUserEnrollmentDelegateResult)result
forUser:(NSString*)userId
error:(NSError *)errorOccurred;
// ...
}
Existing constants for the biometric method names in iOS:
kMobbIDAPI_BiometricMethod_Face
kMobbIDAPI_BiometricMethod_Fingerprint
kMobbIDAPI_BiometricMethod_Iris
kMobbIDAPI_BiometricMethod_Signature
kMobbIDAPI_BiometricMethod_Voice
mobbIdManagementApi.DeleteUserEnrollment(userId, method, this);
The class invoking the DeleteUser
method must implement the IXDeleteUserEnrollmentDelegate
interface.
void DeleteUserEnrollmentFinished(XMobbIDDeleteUserEnrollmentResult result, string userId, IXMobbIDAPIError error)
{
// ...
}
Existing enum type for the biometric methods in Xamarin:
XMobbIDBiometricMethod.Face
XMobbIDBiometricMethod.Iris
XMobbIDBiometricMethod.Signature
XMobbIDBiometricMethod.Voice
XMobbIDBiometricMethod.Fingerprint
XMobbIDBiometricMethod.VoiceFace
If the user if not registered in the method you are trying to delete you will get a specific error.
Retrieve user information
This operation is used to retrieve the current status of a user in the system. It will return the information in three categories:
- Granted methods. A list of the biometric methods the user could be enrolled in.
- Authenticated methods. A list of biometric methods the user is currently authenticated in.
- TODO: Explain "session time"
- Enrolled methods. A list of the biometric methods the user is enrolled in. Each enrolled method is represented by another list of strings:
- First element will be the method itself.
- Second element will be time when the user enrolled on this method. It is the number of milliseconds since January 1, 1970, 00:00:00 GMT
- Third element will be empty for all methods except for the voice (where it will represent the type of enrollment).
The biometric methods will be returned as strings. You can use the pre-defined constants in the SDK to compare them:
Existing constants for the biometric method names in iOS:
kMobbIDAPI_BiometricMethod_Face
kMobbIDAPI_BiometricMethod_Fingerprint
kMobbIDAPI_BiometricMethod_Iris
kMobbIDAPI_BiometricMethod_Signature
kMobbIDAPI_BiometricMethod_Voice
kMobbIDAPI_BiometricMethod_FaceVoice
Existing constants for the biometric method names in Android:
MobbIDAPIBiometricMethod.METHOD_FACE
MobbIDAPIBiometricMethod.METHOD_FINGERPRINT
MobbIDAPIBiometricMethod.METHOD_IRIS
MobbIDAPIBiometricMethod.METHOD_SIGNATURE
MobbIDAPIBiometricMethod.METHOD_VOICE
MobbIDAPIBiometricMethod.METHOD_VOICE_FACE
mobbIDManagementAPI.retrieveUserInfo(new RetrieveUserInfoListener() {
@Override
public void retrieveUserInfoFinished(MobbIDAPIRetrieveUserInfoResult result,
String userId,
List<String[]> enrolledMethodsList,
List<String> authenticatedMethodsList,
List<String> grantedMethodsList,
MobbIDAPIError errorOccurred) {
//...
}
}, userId);
[self.mobbIDManagementAPI retrieveUserInfo:userId
delegate:self];
The class invoking the retrieveUserInformationFinished:forUser:enrolledMethods:authenticatedMethods:grantedMethods:error:
method must conform to the RetrieveUserInformationDelegate
protocol.
- (void)retrieveUserInformationFinished:(MobbIDAPIRetrieveUserInformationResult)result
forUser:(NSString*)userId
enrolledMethods:(NSArray*)enrolledMethods
authenticatedMethods:(NSArray*)authenticatedMethods
grantedMethods:(NSArray*)grantedMethods
error:(NSError *)errorOccurred;
// ...
}
mobbIdManagementApi.RetrieveUserInfo(userId, this);
The class invoking the DeleteUser
method must implement the IXDeleteUserEnrollmentDelegate
interface.
void RetrieveUserInformationFinished(XMobbIDRetrieveUserInformationResult result, string userId, IList<string[]> enrolledMethods, IList<string> authenticatedMethods, IList<string> grantedMethods, IXMobbIDAPIError error)
{
// ...
}
User synchronization
This feature allows your system to synchronize users from a server. This could be useful for systems in which users are enrolled in online mode and they are needed to be verified in offline mode, possibly in one or more devices.
This operation takes as input the binary data containing the user information. This info is available
in the API endpoint downloadUser
.
Your application will be in charge of the data download process. Needless to mention the user must be created and enrolled
in online mode previously ;)
The synchronization modules manages the creation of users in offline mode, thus once you get the binary data for a user you will be able to start the synchronization by using this code:
// coming soon
NSData *data = /* this is the downloaded binary data representing the user biometric template */;
NSData *securityKey = [[@"replace_it_for_smt_related_to_the_user" dataUsingEncoding:NSUTF8StringEncoding] subdataWithRange:NSMakeRange(0, 32)];
// FACE SYNC
MobbIDFaceSynchronization *faceSync = [[MobbIDFaceSynchronization alloc] init];
[faceSync synchronizeUser:data
securityKey:securityKey
successBlock:^(MobbIDUser *user) {
// sync succeeded
}
failureBlock:^(NSError *error) {
// sync failed
}];
// VOICE SYNC
MobbIDVoiceSynchronization *voiceSync = [[MobbIDVoiceSynchronization alloc] init];
[voiceSync synchronizeUser:data
securityKey:securityKey
successBlock:^(MobbIDUser *user) {
// sync succeeded
}
failureBlock:^(NSError *error) {
// sync failed
}];
// SIGNATURE SYNC
MobbIDSignatureSynchronization *singSync = [[MobbIDSignatureSynchronization alloc] init];
[singSync synchronizeUser:data
securityKey:securityKey
successBlock:^(MobbIDUser *user) {
// sync succeeded
}
failureBlock:^(NSError *error) {
// sync failed
}];
mobbIdManagementApi.SynchronizeUser(binaryData, securityKey, this);
The class invoking the SynchronizeUser
method must implement the IXSynchronizeUserDelegate
interface.
void SynchronizationFinished(XMobbIDSyncronizeUserResult result, IXMobbIDSyncUser syncUser, IXMobbIDAPIError error)
{
// ...
}