Some of the endpoints can be accessed by using license_key. One example is /activate/{license_key}. Sometimes, the license keys can have unsupported characters and therefore you won’t be able to use the REST API with those licenses.
To overcome this issue, we added support for specifying hashed licenses to the endpoints instead of the normal license key. The API calls with hashed license keys will look like this:
https://dlm.test/wp-json/dlm/v1/licenses/activate/hashed-d013a2a84b354cd6b6bd3f15df625495b226a83716080dcdcfa6be73c7d84ff5/
This eliminates the character issue if your licenses contain weird characters.
How to hash the license correctly
To generate a hash of specific license you need to hash the license key using sha256 algorithm by specifying your SECRET key and then appending hashed- in front of the hash.
The following is PHP example, but this is doable in ANY language.
Important: Complex License hashes require Digital License Manager 1.6.0+
$hashedKey = hash_hmac('sha256', $value, SECRET_KEY_HERE);
Once the hsing is done you need to append hashed- prefix in front so the system will be able to identify that you are sending hashed license.
$hashedKey = sprintf('hashed-%s', $hashedKey);
Where can i find the secret key
By default the secret key is located into wp-content/uploads/dlm-files/secret.txt.
It can also be defined in wp-config.php in DLM_PLUGIN_SECRET constant depending on your Security Settings.
Which endpoints are supported
Simply put, all endpoints that accept {license_key} in the URL: