diff --git a/LICENSE.txt b/LICENSE.txt index a0b3bbd..c08edc1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Cryptlex LLP +Copyright (c) 2026 Cryptlex LLP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/cryptlex/lexactivator/lexactivator.py b/cryptlex/lexactivator/lexactivator.py index 866b513..88fa9c1 100644 --- a/cryptlex/lexactivator/lexactivator.py +++ b/cryptlex/lexactivator/lexactivator.py @@ -1441,19 +1441,18 @@ def AuthenticateUser(email, password): raise LexActivatorException(status) @staticmethod - def AuthenticateUserWithIdToken(idToken): + def AuthenticateUserWithIdToken(id_token): """Authenticates the user via OIDC Id token. Args: - idToken (str): The id token obtained from the OIDC provider. - + id_token (str): The id token obtained from the OIDC provider. Raises: LexActivatorException Returns: int: LA_OK """ - cstring_id_token = LexActivatorNative.get_ctype_string(idToken) + cstring_id_token = LexActivatorNative.get_ctype_string(id_token) status = LexActivatorNative.AuthenticateUserWithIdToken(cstring_id_token) if LexStatusCodes.LA_OK == status: return LexStatusCodes.LA_OK @@ -1740,14 +1739,14 @@ def IsTrialGenuine(): raise LexActivatorException(status) @staticmethod - def ActivateLocalTrial(trialLength): + def ActivateLocalTrial(trial_length): """Starts the local (unverified) trial. This function should be executed when your application starts first time on the user's computer, ideally on a button click. Args: - trialLength (int): trial length in days + trial_length (int): trial length in days Raises: LexActivatorException @@ -1755,7 +1754,7 @@ def ActivateLocalTrial(trialLength): Returns: int: LA_OK, LA_LOCAL_TRIAL_EXPIRED, LA_FAIL """ - status = LexActivatorNative.ActivateLocalTrial(trialLength) + status = LexActivatorNative.ActivateLocalTrial(trial_length) if LexStatusCodes.LA_OK == status: return LexStatusCodes.LA_OK elif LexStatusCodes.LA_TRIAL_EXPIRED == status: @@ -1789,13 +1788,13 @@ def IsLocalTrialGenuine(): raise LexActivatorException(status) @staticmethod - def ExtendLocalTrial(trialExtensionLength): + def ExtendLocalTrial(trial_extension_length): """Extends the local trial. This function is only meant for unverified trials. Args: - trialExtensionLength (int): number of days to extend the trial + trial_extension_length (int): number of days to extend the trial Raises: LexActivatorException @@ -1803,7 +1802,7 @@ def ExtendLocalTrial(trialExtensionLength): Returns: int: LA_OK, LA_FAIL """ - status = LexActivatorNative.ExtendLocalTrial(trialExtensionLength) + status = LexActivatorNative.ExtendLocalTrial(trial_extension_length) if LexStatusCodes.LA_OK == status: return LexStatusCodes.LA_OK elif LexStatusCodes.LA_FAIL == status: @@ -1861,6 +1860,35 @@ def ResetActivationMeterAttributeUses(name): if LexStatusCodes.LA_OK != status: raise LexActivatorException(status) + @staticmethod + def MigrateToSystemWideActivation(old_permission_flag): + """Migrates existing license data to system-wide storage. + + Call this function after SetProductData(). + + If you intend to use a custom data directory after migration, + set it first using SetDataDirectory(). + + Note: + The function does not support migration from custom data directories. + + Args: + old_permission_flag (int): permission flag used previously + + Raises: + LexActivatorException + + Returns: + int: LA_OK, LA_FAIL + """ + status = LexActivatorNative.MigrateToSystemWideActivation(old_permission_flag) + if LexStatusCodes.LA_OK == status: + return LexStatusCodes.LA_OK + elif LexStatusCodes.LA_FAIL == status: + return LexStatusCodes.LA_FAIL + else: + raise LexActivatorException(status) + @staticmethod def Reset(): """Resets the activation and trial data stored in the machine. diff --git a/cryptlex/lexactivator/lexactivator_native.py b/cryptlex/lexactivator/lexactivator_native.py index a53de5d..2697103 100644 --- a/cryptlex/lexactivator/lexactivator_native.py +++ b/cryptlex/lexactivator/lexactivator_native.py @@ -451,6 +451,10 @@ def byte_to_string(input): ResetActivationMeterAttributeUses.argtypes = [CSTRTYPE] ResetActivationMeterAttributeUses.restype = c_int +MigrateToSystemWideActivation = library.MigrateToSystemWideActivation +MigrateToSystemWideActivation.argtypes = [c_uint32] +MigrateToSystemWideActivation.restype = c_int + Reset = library.Reset Reset.argtypes = [] Reset.restype = c_int