BioClient Javascript plugin
The BioClient Javascript plugin connects the web application to the BioCloient service, allows the processing of biometric commands and handling responses to the website. The plugin consists of these Javascript files:
alcazar-base.js- contains dependencies for the BioClient Javascript plugin.bioclient-plugin.jscontains the core plugin and is always required.bioclient-your-app.jscontains your custom implementation of BioClient.Web builder and response functions, and other helper functions.- Additional, client specific extensions might be required, depending on specific application extensions
Alcazar has provided four sample implementations for your custom implementation:
bioclient-sample.jscontains a bare-minimum sample implementation for builder and response methods. It can serve as template for application-specific implementations.bioclient-internal.jscontains a sample implementation for builder and response methods. This sample is suitable for an Alcazar internal demo application, and demonstrates the principles of builder and response methods.bioclient-store.jscontains a sample implementation for builder and response methods. This sample is suitable for the transact pages of Alcazar Biostore, and is a real-life example of how an application has implemented builder and response methods.bioclient-single.js, contains a sample implementation for builder and response methods. This sample is suitable for theAlcazar.Singlebiometric verification option of multi-factor authentication, and is a real-life example of how an application has implemented builder and response methods.
bioclient-plugin.js
bioclient-plugin.js contains the core plugin implementation, and bare-minimum builder and response methods.
BioClient events
BioClient events are used for management and error handling.
| Event | Remark |
|---|---|
| connecting | Invoked when the web page is connecting to the BioClient service. |
| connected | Invoked when the web page has successfully connected to the BioClient service. |
| disconnected | Invoked when the web page has disconnected from the BioClient service. |
| sending | Invoked when the web page is sending a transaction request to the BioClient service. |
| responded | Invoked when the web page has received a transaction response from the BioClient service. |
| error | Invoked when an error has occurred during sending or receiving. |
| failed | Invoked when the web page failed sending a transaction request to the BioClient service, with the BioClient object not in a ready state. |
const BioClientClass
The BioClientClass creates the main entry point to the BioClient Javascript plugin, which is implemented in the JQuery plugin style.
It is used to instantiate the bioClient object to interact with BioClient:
// On page load, define the bioClient object
const bioClient = BioClientClass.init(storeOptions);
See Biometrically enable your web application for how more details on how to use the BioClient Javascript plugin.
defaultOptions
Default options are provided for basic settings only, and will invariably be overridden by your custom implementation. The default options define empty shell builder and response methods, which should be overridden by your custom implementation.
BioClient command builders and response handlers
The builder and response method contained in the plugin are bare-minimum implementations and will invariably be overridden by your custom implementation.
BioClient command methods
Built-in command methods are provided for convenience, and are used to transact against BioClient. Command methods invoke the builder method to build a command for BioClient, send and process the command, and then invoke the response hendler for your application to process the response.
// Retrieve a person
retrieve_person() {
this._send_command(this.options.build_retrieve_person, this.options.retrieved_person);
};
bioclient-sample.js
bioclient-sample.js contains a bare-minimum sample implementation using the BioClient plugin
// Implementers will typically start with a sample implementation like this, and then modify it to their needs:
// * Amend the options (default values, event handlers, and build and response handlers)
// * Amend the event handlers
BioClient options override
The BioClient options override defines methods and events which implement the application-specific custom implementation for BioClient. It is used to override default options.
// Extend the built-in BioClient options
var options = $.extend(yourOptions, pageOptions);
See Biometrically enable your web application for how more details on how override default options with your custom ones.
Management and error events
- Built-in event handlers for buttons and links. These event handlers are set in
bc_addButtonEvents()
// Retrieve a person
$('button.retrieve-person').click(function () {
bioClient.retrieve_person();
})
Standard event handlers
Sample event handlers for BioClient events. These event handlers are set in bc_addToastrEvents(), and may not be suitable for your application.
// Listen to the 'sending' event
bioClient.addEventListener('sending', function (evt) {
var cmd = evt.detail.cmd;
toastr['success']("Sending '{0}' ...".format(cmd), 'BioClient service');
});