Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
48 changes: 38 additions & 10 deletions cryptlex/lexactivator/lexactivator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1740,22 +1739,22 @@ 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

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:
Expand Down Expand Up @@ -1789,21 +1788,21 @@ 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

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:
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions cryptlex/lexactivator/lexactivator_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -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