Getting early warning on grace period expiration

Hi all,

Since our users very much depend on our product for their own business, we want to apply a long grace period to the Cryptlex license server synchronization (say 50 days). This can be set in the license’s details, and when a license can’t be verified for that number of days I already intercept that by comparing to the LA_GRACE_PERIOD_OVER status code, and disable the application from then on (reverting to demo mode actually).

However, I’d also like to warn my users when the grace period is getting out of hand, like by showing a warning prompt from day 30 onwards. This way the inevitable disabling of their license won’t be such a shock once day 50 arrives.

Is this possible with the current LexActivator code? I can’t seem to find a Cryptlex API function to get the number of days since the last server check…

Or maybe I should use the SetLicenseCallback callback function, and in there check for presumably something like LA_E_SERVER being passed, and keep my own “Last server sync date” setting? But this solution seems a bit brittle to me.

Hi Carl,

You can use SetLicenseCallback function and if status code is LA_OK, LA_SUSPENDED or LA_EXPIRED that would imply server sync succeeded so you can reset your internal counter accordingly.

Hi Adnan,

I already suspected I’d have to use the callback function, but hoped something more robust would be available. I assume Cryptlex internally already keeps track of the last successful sync date (so as to know how far we’ve progressed into the grace period), and hoped that counter would be exported somewhere via an API. I could indeed use the callback function, but that would mean I’d have to keep track of a counter myself as well somewhere in my own app’s settings or such. And also handle e.g. timeouts on server connects vs. my app being closed prematurely, and possibly also other edge cases that you’ve probably already have well-tested code for on your side.

Ah well - see it as a feature request :slight_smile:

Talking about feature requests: when starting work on the callback, I noticed the callback function itself only receives the single status code. We’re using an object oriented design for the license handling code, and thus the callback function needs to know which of our own objects is responsible for the license handling. Often these callback mechanisms are set up so that you can pass an arbitrary void pointer or such when setting up the callback, and the callback in turn receives this void pointer again, which enables the caller to pass in object pointers, arbitrary data structures, etc. as context. In our case this would also have been very handy for this callback, although I think you’d have a hard time adding this on without losing backward compatibility with the code base of existing users…? Setting could be changed by just adding an optional void* defaulting to nullptr, but the callback function signature of course would have to change as well.

Hi,

We will add the function to get the server sync date in February release.

For callbacks you can create a map of license key and callback function to keep track of function callbacks. Changing function signature is not feasible.

1 Like

Ah, perfect - thanks for that!

For the system to fully work though, I’d have to compare it to either the future grace-period-over date or the grace period length (in days). And each individual license could (in theory) have it’s own grace period length, so I can’t hard-code that duration into my code. The only option is to then use license meta data to also store the grace period length there, and update that as well if we update a license’s grace period… It would probably not be a frequently recurring thing we’d need to do, but it’d be a nuisance.

It would thus really round things off nicely if there’d be a LexActivator function to get either the current license’s grace period (in days), or a function which returns the end-of-grace-period date (to make the diff). Pretty please? :slight_smile: Maybe something similar to GetLicenseExpiryDate, but then for the grace period, next to the upcoming ‘GetLicenseCheckDate’. Or maybe a function to get the number of days passed + days left in the grace period. I don’t know what other Cryptlex users would prefer here?

I already suspected you (understandably) wouldn’t want to change the callback’s signature - no problem. I’ve indeed already adapted my code to a similar scheme as what you suggested. This could maybe be something you’d like to add in an upcoming major version, though?

LexActivator already stores the end of grace period date, so we just need to expose it using an API function.

Having both of those dates (last server sync date + end grace period date) would be really helpful indeed!