QuickCode is an alternative method of identity verification that lets you register a new device using a code generated on another device that has already been registered with an active User ID. To use this functionality, you need to first configure it in the MIRACL Trust Portal. Once it is enabled, the option to generate a QuickCode will be available on the authentication page and application. When an end user generates a QuickCode on their already registered device, they can then use it on their new device to register it. For detailed information about how to do it, see the User Guide.
# Configure QuickCode
For QuickCode to be available and visible on the authentication page and apps, you must enable it in the MIRACL Trust Portal. To do so:
- Go to your project in the MIRACL Trust Portal.
- Go to User Verification under Configuration.
- In the QuickCode section, check Enable QuickCode.
In this section, you can also select the Limit QuickCode Verified checkbox. If you do it, end users will not be able to generate a QuickCode from devices registered with a QuickCode.
If you use the MIRACL Trust PIN Pad or the MIRACL Trust Authenticator app, QuickCode is available by default, and if enabled, the options to generate a QuickCode and use it for registration are displayed on the authentication page.
However, if you use custom browser authentication or custom mobile application, you need to make some additional configurations.
# Custom QuickCode Generation
To generate a QuickCode, you need to call the generateQuickCode
method in the
JavaScript library (for custom browser authentication) and/or the mobile SDKs
(for custom mobile authentication).
mcl.register(
userId,
quickCode,
function (passPin) {
// Here you need to prompt the user for their PIN
// and then call the passPin argument with the value
passPin(pin);
},
function callback(err) {
if (err) {
// Handle any potential errors
}
},
);
miraclTrust.generateQuickCode(
user,
pinProvider,
result -> {
if (result instanceof MIRACLSuccess) {
QuickCode quickCode =
((MIRACLSuccess<QuickCode, AuthenticationException>) result).getValue();
} else {
MIRACLError<QuickCode, AuthenticationException> error =
(MIRACLError<QuickCode, AuthenticationException>) result;
// handle error
}
}
);
miraclTrust.generateQuickCode(
user,
pinProvider
) { result ->
when (result) {
is MIRACLSuccess -> {
val quickCode = result.value
}
is MIRACLError -> {
val error = result.value
// handle error
}
}
}
[[MIRACLTrust getInstance]
generateQuickCode:<#Already registered user#>
didRequestPinHandler:^(void (^ _Nonnull pinHandler)(NSString * _Nullable)) {
// Here the user provides their current authentication PIN.
pinHandler(<#Provide your user PIN here#>);
} completionHandler:^(QuickCode * _Nullable quickCode , NSError * _Nullable error) {
// Get the QuickCode object or handle the error appropriately.
}];
MIRACLTrust.getInstance().generateQuickCode(
for: <#Already registered user#>,
didRequestPinHandler: { pinHandler in
// Here the user provides their current User ID's PIN code.
pinHandler(<#Provide your user PIN here#>)
},
completionHandler: { quickCode, error in
// Get the QuickCode object or handle the error appropriately.
}
)
# Custom Registration with QuickCode
To register with QuickCode, you need to have quickCode
as activationToken
in
the JavaScript library (for custom browser authentication) and/or the mobile
SDKs (for custom mobile authentication).
mcl.register(
userId,
quickCode,
function (passPin) {
// Here you need to prompt the user for their PIN
// and then call the passPin argument with the value
passPin(pin);
},
function callback(err) {
if (err) {
// Handle any potential errors
}
},
);
miraclTrust.register(
USER_ID,
quickCode,
pinProvider,
result -> {
if (result instanceof MIRACLSuccess) {
User user = ((MIRACLSuccess<User, RegistrationException>) result).getValue();
} else {
MIRACLError<User, RegistrationException> error =
(MIRACLError<User, RegistrationException>) result;
// handle error
}
}
);
miraclTrust.register(
userId = USER_ID,
activationToken = quickCode,
pinProvider = pinProvider,
resultHandler = ResultHandler { result ->
when (result) {
is MIRACLSuccess -> {
val user = result.value
}
is MIRACLError -> {
val error = result.value
// handle error
}
}
}
)
[[MIRACLTrust getInstance] registerFor:<#Unique user identifier (any string, i.e. email)#>
activationToken:<#quickCode#>
pushNotificationsToken:<#Push notifications token#>
didRequestPinHandler:^(void (^ _Nonnull pinProcessor)(NSString *)) {
// Here the user creates a PIN code for their new User ID.
pinProcessor(<#Provide your PIN code here#>)
} completionHandler:^(User * _Nullable user, NSError * _Nullable error) {
// Get the user object or handle the error appropriately.
}];
MIRACLTrust.getInstance().register(
for: <#Unique user identifier (any string, i.e. email)#>,
activationToken: <#quickCode#>,
didRequestPinHandler: { pinProcessor in
// Here the user creates a PIN code for their new User ID.
pinProcessor(<#Provide your PIN code here#>)
},
completionHandler: { user, error in
// Get the user object or handle the error appropriately.
}
)