Custom directive based on cordova to authenticate users by using the fingerprint or face id (iPhone X) saved on the device. It can be used only on mobiles. If you want to use this add n-fingerprint custom directive to any component.
This directive is intended to be added to any component. Once added any click event on the component will trigger the following function :-
- A message box asking user to verify his identity using fingerprint or face id.
- Once user verifies his identity using the fingerprint sensor on the mobile a success string is returned.
-
Drag and drop any component and then add the following key-value pairs using the "New property : Attribute" section of the HTML page. Note :- If the value field is missing then leave it empty. If an input needs to be added to the value field, click the slide-toggle button; this makes the value field editable.
- Add the directive as an attribute.
- key : n-fingerprint
- Leave the value field empty
- Click the ADD button
- Provide the options that the directive will use.
- key : [fingerprintOptions]
- value :
{clientId: 'string', clientSecret: 'string'}
- Click the ADD button
- Input the action that occurs if the directive successfully completed its functionality.
- key : (onsuccess)
- value :
success($event)
- Click the ADD button
- Then is TS file add the following function
success($event){console.log($event)}
- Input the action that occurs if the directive failed to complete its functionality.
- key : (onerror)
- value :
error($event)
- Click the ADD button
- Then is TS file add the following function
error($event){console.log($event)}
- Add the directive as an attribute.
-
The
console.log($event)
line inside the values of the (onsuccess) and (onerror) keys can be changed as per the developers requirement.Note :-
console.log($event)
displays the output (which is $event) of the directive for both success and error on a console which can be accessed by google chrome or safari.
- Devices: Android, iOS
- Browsers: None
- Dependencies version:
- Angular CLI version: 6.0.0 +
- Cordova version: 7.1.0 +