Date Lock locks the code to a period of time. There are three ways to lock your code to a period of time:
startDate
)endDate
)startDate
and endDate
)This is a good transformation to enforce license agreements. Countermeasures can be specified (optionally) to be executed when the code is executed in an invalid period of time.
Consider combining this transformation with obfuscation transformations to harden the resulting code making it more resilient to automated de-obfuscator tools and harder to understand by a human. You may also find useful to combine this transformation with other locks:
// @jscrambler define dateLock {startDate: 2017/01/01, endDate: 2020/12/31, countermeasures: {deleteCookies: 1, redirect: https://www.example.com}} as dl1
// @jscrambler enable dl1
Name | Required | Default Value | Description |
---|---|---|---|
startDate | Yes | N/A | The code won't run in a date that is previous to the startDate . |
endDate | Yes | N/A | The code won't run in a date after the endDate . |
countermeasures | Yes | {"deleteCookies": false,"breakApplication": true,"realTimeNotifications": false,"dataExfiltrationPrevention": false,"selfDestruct": false} | List of available countermeasures |
Name | Description |
---|---|
customCallback | Name of the function to be called as a countermeasure. |
deleteCookies | Deletes all the cookies accessible via JavaScript. |
redirect | Redirects the user to a specific URL. |
breakApplication | Breaks the application's functionality. |
realTimeNotifications | Sends a notification when a violation occurs. |
dataExfiltrationPrevention | Prevents a malicious actor from carrying out an unauthorized data transfer by blocking network requests. |
selfDestruct | Attempts to damage the state and behavior of the application and/or the environment that is running the application. |
Browser | Compatible Versions | Tested Versions | Notes |
---|---|---|---|
Chrome | 80+ | 80+ | |
Firefox | 90+ | 90+ | |
Internet Explorer | 9+ | 8+ | |
Microsoft Edge | 116+ | 116+ | |
Safari | 13.1+ | 13.1+ |
Example:
{
"keys": {
"accessKey": "XXXXXX",
"secretKey": "YYYYYY"
},
"applicationId": "ZZZZZZ",
"params": [
{
"name": "dateLock",
"options": {
"startDate": "2016-06-01",
"endDate": "2016-06-01",
"countermeasures": {
"customCallback": null,
"deleteCookies": false,
"redirect": null,
"breakApplication": true,
"realTimeNotifications": false,
"dataExfiltrationPrevention": false,
"selfDestruct": false
}
}
}
]
}