OnlineUnlockStatus - persistent isUnlocked status


I have implemented an unlocking mechanism based on the tutorial:

However, I am now trying to work out a way to record that the plugin has been unlocked. I suspect it is a matter of save the generated key somewhere on the local filesystem and then using this to check authorisation using OnlineUnlockStatus::applyKeyFile (I imagine to be completely rigorous this file should be encrypted/secured somehow).

Does anyone have a different recommendation? Thanks

I have exactly the same wrinkle.
And also wonder where is the best place to store such file for VST on Windows and for VST/AU on OSX.
I am affraid if I choose some folder in Library (osx) or program files (windows) then there could be some issues with permissions.

How did you finally solve that? Have you got any recomendation in that case?

I think the prittiest solution would be to store that data somehow inside of plugin file vst3 or component. But I’ve heard it’s risky, headlong and dwarfs implementation.

For the record, you cannot store the keyfile data inside the plug-in bundle itself. Even if the filesystem allowed you to write to that location, it would break the digital signing required in more and more environments.

You can use JUCE’s File::getSpecialLocation method to get the location of a user-writable folder. The SpecialLocationType list includes the user’s default documents folder, the user’s userMusicDirectory (on Mac, ~/Music), and userApplicationDataDirectory. These are all possibilities for where to stash the keyfile (well, specifically, in a /company name/product name subfolder within those locations). On macOS, with sandboxing further restricting the list of feasible locations, I believe ~/Music is the current best practice.