cryptlex / lexactivator-js

LexActivator API wrapper for Node.js (licensing library)
https://cryptlex.com
MIT License
14 stars 5 forks source link

Add example for offline activation #22

Closed robertsLando closed 2 years ago

robertsLando commented 2 years ago

I have checked docs here about offline activation: https://docs.cryptlex.com/node-locked-licenses/offline-activations

BTW I dunno If I have correctly understood the flow needed to activate an offline license.

1) On my frontend Users enters the license key in a form, and ask an OFFLINE ACTIVATION 2) My Backend calls:

LexActivator.SetLicenseKey(key)
LexActivator.GenerateOfflineActivationRequest('./activationRequest.txt')

This will create a ./activationRequest.txt file (?) that I should download on frontend side

3) User/Admin goes to cryptlex dashobard, go to activations page of the license and click the OFFLINE ACTIVATION button. You will be asked to paste the content of ./activationRequest.txt file, set the validity and then press ACTIVATE to activate it. This will download a file that we could call offlineLicense.txt

4) On my frontend now I should allow users to upload this file that I will store on backend and then call

LexActivator.ActivateLicenseOffline('path/to/offlineLicense.txt');

Am I correct?

Wondering if for GenerateOfflineActivationRequest could simply return a Buffer or the string content of the activation request and ActivateLicenseOffline could get a Buffer or a string as argument instead of a path to a file. IMO this would be easier to handle since I could store this in a var in the first case and on a database when I need to store the activation file

adnan-kamili commented 2 years ago

Yes, your understanding is correct.

You don't need to store the offline activation response, it's only needed once at the time of activation.

robertsLando commented 2 years ago

@adnan-kamili ok thanks. I suggest to update docs to make those steps more clear :) Will try to implement this on my application in next days

adnan-kamili commented 2 years ago

Yes, we will be adding more examples soon.