Get the fingerprint signature of your app's certificate and its package name.
Especially useful for adding yet another layer of security in your API calls.
If you are using cordova-cli, install with:
$ cordova plugin add cordova-plugin-signature-fingerprint
With a plain plugman, you should be able to install with something like:
$ plugman --platform <android> --project <directory> --plugin https://github.com/fontesoft/cordova-plugin-signature-fingerprint.git
Use TypeScript wrapper Signature Fingerprint: https://www.npmjs.com/package/@fontesoft/signature-fingerprint
- Android
- cordova.getSignatureFingerprint.getSignature
- cordova.getSignatureFingerprint.getPackageName
Return SHA1 Fingerprint of the app certificate
cordova.getSignatureFingerprint.getSignature(successCallback, [errorCallback]);
- successCallback: The callback that is passed fingerprint
- errorCallback: (Optional) The callback that executes if an error occurs.
// successCallback
var onSuccess = function(sha1) {
alert("SHA1: " + sha1);
}
// errorCallback
var onError = function(error) {
alert("ERROR: " + error);
}
cordova.getSignatureFingerprint.getSignature(onSuccess, onError);
Returns the package name of the app
cordova.getSignatureFingerprint.getPackageName(successCallback, [errorCallback]);
- successCallback: The callback that is passed fingerprint
- errorCallback: (Optional) The callback that executes if an error occurs.
// successCallback
var onSuccess = function(name) {
alert("Package Name: " + name);
}
// errorCallback
var onError = function(error) {
alert("ERROR: " + error);
}
cordova.getSignatureFingerprint.getPackageName(onSuccess, onError);
The Cordova Signature Fingerprint Plugin is open-sourced software licensed under the MIT license.