The System Utilities section provides common supporting functions used across the application.
It includes utilities for logging, alerts, and other shared system-level operations that do not belong to a specific functional domain.
These utilities help standardize behavior, improve observability, and simplify cross-cutting concerns within the system.
logD (Android, Windows, iOS) #
Logs the input text to a log file at the debug log level.
/**
*
* @param {string} text - The text to be logged.
* @return {void}
*/
function logD (text);logE (Android, Windows, iOS) #
Logs the input text to a log file at the error log level.
/**
*
* @param {string} text - The text to be logged.
* @return {void}
*/
function logE (text);setLogLevel (Android, Windows, iOS) #
Sets the level of wizard logger. Log level:
- 3- debug
- 6- error (default)
Note: The API allows to log events that happen in the wizard into the application log for possible debugging or auditing. The HTML wizard logs are created on daily basis in the following local (device storage) folder: \Android\data\com.anasoft.signatus.app\files\LogJS\{DATE}.log
/**
* @param {int} level - The log level to be set.
* @return {void}
*/
function setLoglevel (level);sendLog (Android, Windows, iOS) #
Collects all Signatus application log files available on the device (stored in the Log folder), packages them into a ZIP file, and uploads the archive using a selected upload channel configured in the application settings. This allows users to easily send log files from the device through an action triggered in the wizard when troubleshooting is required.
Note: When using an MDM solution, logs can be collected automatically without requiring user interaction.
/**
* @param {Object} arg- Parameter JSON object.
* @returns {void}
*/
function sendLog(arg);Parameter description :
| Name | Required | Format | Description |
|---|---|---|---|
| channel | true | string | Name of the upload channel to use for uploading . – LOG : By default log is send to the license server |
| call | true | string | Callback function name |
| filename | false | string | Log filename. Default is “Log_” |
| data | false | JSON Object | additional data for the uploader in JSON format |
| docType | false | string | If “*” logcat is included to log zip file. Default value. Otherwise only application log is send |
| upload | false | boolean | – true (default value) : file is prepared for upload and uploader is called immediately – false : file is only prepared for upload, the uploader can be started later using the ‘upload’ function |
Example :
const arg = {
"channel" : "LOG",
"call" : "onSendLog"
};
sendLog(arg);
/**
* callback function for sendLog function
* @param res - result in string format
*/
function onSendLog(res) {
const result = JSON.parse(res);
}Result example :
{
"parameter": {
"status": "OK",
"message": "",
"data": true
}
}logAudit (Android) #
Adds a line to the audit log.
/**
*
* @param {string} text - The descriptive text for the audit log.
* @param {number} code - A numerical code representing the audit event.
* @param {string} message - Additional details or context about the audit event.
* @return {void}
*/
function logAudit (text, code, message);getAuditLog (Android) #
Exports the audit log to the file defined by the specified file path and returns true if successful. The log will contain actions since the launch of the wizard.
/**
* @param {Object} arg- Parameter JSON object.
* @returns {boolean} - Returns true if the audit log were successfully exported, false otherwise.
*/
function getAuditLog(arg);Parameters description :
| Name | Required | Format | Description |
|---|---|---|---|
| savePath | true | string | Path to the target file within the workspace |
Example :
const arg = {
"savePath": "/signed/audit.log"
}
const isSucess = getAuditLog(arg);alert (Android, Windows, iOS) #
Displays a short toast notification at the bottom of the screen showing the specified text for 1 second.
/**
* @param {string} message - The text content to be displayed in the alert.
* @returns {void}
*/
function alert(message);Example :
alert("Hello world");alertD (Android, Windows, iOS) #
Works the same way as alert, but the toast message is displayed only when the log level is set to debug.
/**
* @param {string} message - The text content to be displayed in the alert.
* @returns {void}
*/
function alertD(message);Example :
alertD("Hello world");convertJSONtoXML (Android) #
Converts a JSON value to XML format. This can be used when data needs to be transformed from JSON and sent to an external system that requires XML.
/**
* @param {Object} json- Parameter JSON.
* @returns {string} XML string
*/
function convertJSONtoXML (json);Example :
const arg = {
"country": "SK",
"city": "Bratislava"
};
const xml = convertJSONtoXML(arg);Result example :
<country>SK</country><city>Bratislava</city>convertXMLtoJSON (Android) #
Converts an XML value to JSON format
/**
* @param {string} xml - Parameter XML.
* @returns {string} JSON string
*/
function convertXMLtoJSON(json);Example :
const arg = "<country>SK</country><city>Bratislava</city>"
const json= convertXMLtoJSON(arg);Result example :
{"country":"SK","city":"Bratislava"}getMD5 (Android) #
Returns hash value used as a checksum to verify data integrity. See https://en.wikipedia.org/wiki/MD5
/**
* @param {Object} arg- Parameter JSON object.
* @returns {string} - Returns MD5 hash value.
*/
function getMD5(arg);Parameters description :
| Name | Required | Format | Description |
|---|---|---|---|
| md5 | true | string | Text to hash |
Example :
const arg = {
"md5": "hash test"
};
const value= getMD5(arg);
// value = b6ecdcfccf524b9b81cf0240ddb1f300zip (Android, Windows, iOS) #
Creates a ZIP package from the files in the specified folder, optionally encrypting the ZIP with the provided password.
/**
* @param {Object} arg- Parameter JSON object.
* @returns {boolean} - Returns true if the compression is successful, false otherwise.
*/
function zip(arg);Parameters description :
| Name | Required | Format | Description |
|---|---|---|---|
| folder | true | string | Path to the source directory within the workspace to be compressed |
| file | true | string | Path to the destination zip file within the workspace |
| password | false | string | Password to protect zip file |
Example :
const arg = {
"folder": "/signed",
"file" : "/final/final.zip"
};
const isSucess = zip(arg);
unZip (Android, Windows, iOS) #
Unzips the file using the standard ZIP compression into the supplied path.
/**
* @param {Object} arg- Parameter JSON object.
* @returns {boolean} - Returns true if the decompression is successful, false otherwise.
*/
function unZip(arg);Parameters description :
| Name | Required | Format | Description |
|---|---|---|---|
| folder | true | string | Path to the destination directory within the workspace where zip file si decompressed |
| file | true | string | Path to the zip file within the workspace |
| password | false | string | Password if zip file is protected |
Example :
const arg = {
"folder": "/unpack",
"file" : "/final/final.zip"
};
const isSucess = unZip(arg);
gzip (Android) #
Compresses a given file using the GZIP compression.
/**
* @param {Object} arg- Parameter JSON object.
* @returns {boolean} - Returns true if the compression is successful, false otherwise.
*/
function gzip(arg);Parameters description :
| Name | Required | Format | Description |
|---|---|---|---|
| name | true | string | Path to the destination gz file within the workspace |
| file | true | string | Path to the source file within the workspace |
Example :
const arg = {
"name": "/final/gzip.gz",
"file" : "/pdf/Test1.pdf"
};
const isSucess = gzip(arg);
unGzip (Android) #
Decompresses a file using the GZIP compression.
/**
* @param {Object} arg- Parameter JSON object.
* @returns {boolean} - Returns true if the decompression is successful, false otherwise.
*/
function unGzip(arg);Parameters description :
| Name | Required | Format | Description |
|---|---|---|---|
| name | true | string | Path to the gz file within the workspace to decompress |
| file | true | string | Path to the destination file within the workspace |
Example :
const arg = {
"name": "/final/gzip.gz",
"file" : "/unpack/Test1.pdf"
};
const isSucess = unGzip(arg);
