Woocommerce linked licensing system for your plugins
-
@d-healey @ustk oh that's odd.
@matt_sf said in Woocommerce linked licensing system for your plugins:
const text = '"text"';
Console.print(text.replace('""'));
Ok in this example I put the
"string"
inside the simple quotes'
so that was my mistake.But If I use a txtFile.txt containing
"Some text"
(with the double quotes like I get when writing theresponse.token
into a file) and use this code:const desktop = FileSystem.getFolder(FileSystem.Desktop); const textFile = desktop.getChildFile("txtFile.txt"); const test = "test"; Console.print(test.replace('""')); Console.print(textFile.loadAsString().replace('""'));
It doesn't work. The console output correctly
test
but outputs"Some text"
...HiseSnippet 741.3ocsU01aSCCD1tsdhVXHlD+.h5WVpznpEFCjlPrs9BpB1VEYLw2l7bbWslicThyXUH9yvuP9G.mSxVRGkxnRjOzz64tG6Ge9tKiizLdbrNBgqexrPNB+Hh2LkYZuoTgBMpOB+XxgzXCOxIC5fYgz3XtOBiq9NK.tdMT5yOd6ATIUw3EPHzoZAi+AQfvTfNdu2KjxgTe9IhfRQu8diXZUOsTm.5oJoCJjxtjdA+HpMrJDDdsA9BiNxyPM7XDt1AZ+YdS0eQkE+ohXw4Rt0nKxCVnL3gZouUwVTTuoBo+3aN2wHXUFWjEplkEdJ4Pgu3V7hrwSRc3Tvnb9.WYd4UcN408OIuEHIbIIUKSRaP7XQhPSgGqddHYjBtblPgzdYojEKpx2wjdZHBkoc.8R9vHv3VFt6zoyVNvOs1sQCH0Gab74wWZzgNuwYnPx8lA27AsufaRSgQtk.6mEYqcWOmpgesw5G3luJVhomMKraSSl+1v6lE6HjoL.kl12MATPtwZHpvHgx3ZQaGwCkV4tYyla1BXd2PxWWol5uermAPuvs0cYMIQwLBsxQqNRa3Gqba03qMp23aMbtqqISVnOahLRKkPdXQtsEyQKinqJI3bdzVNWQkI7aCDtgmurYs6WYCK6dsTfZ0HkvbbHO2d408n7BC3eeZTepgZq6xwf3B4QFgUN397qfl3rpv5j76cnM92JQglCsehjZluiwNlH2AjOlqL0VJphElYkGi7OzF0YosQ2WItAYrvvltXMVYAZDxT+OzX9vm0IClLgyLEBrFY3mW0IM+ks+i5DCzubHEZatFgIGkD3AyeYbX2UJtDVbBthsZIyti01lA73J+TieBO4N6Zsw4N6diST.kEoOik0EXGu8fTDPSpzI60gOw.1NcQocF.ORm1cPAvj1yXL6w+YPA7h477UfyKVANauBbd4JvYmUfyqVANudobreja+DiNHqc..FOHcDAFOPQgJqzpPzuvoOTjw
The other answer would be that I'm totally losing It (which wouldn't be impossible) :face_with_tears_of_joy:
-
@d-healey said in Woocommerce linked licensing system for your plugins:
I tested the code before I suggested it to you with your snippet and it worked for me.
I thought so, that's why I was surprised it didn't work here....
-
Try below snippet. By the way, why are you using replace? For removing spaces? If yes, you should use it like this:
textFile.loadAsString().replace(" ", "")
HiseSnippet 738.3ocsU0taSCCE0tqAQKTDShGfn7qToQUJLFHgPrs9ApB1VEYLw+l7bbWslicThyXUHdt30h2.353rkrQ2zTkVpTS84dOtmb84dyzTEkkkoRQ3VGtHggvO0IbgTOevbBWhlLDgelydjLMK00Bs6hDRVFKBgwq8IC.tUSTw0e93tDAQRYUPHzQJNk8EdLWWgNc6OyEhwjH1g73ZYu41SnJ4.kPkC5YMm.TBgdF4T19DSZMbP3GMJhqUogZhlkgvM2UEsHbt5GRa9Gwy3mHXlE8QgvFYgGqDQFEaPQClyEQSu74NCA6xzppvZ1pvKb1iGwuBupZ77h.tULpWOvMtK40ut7Bt+xCWSdMsxacmPZJOQWEwnsm3LQBGTyHvQPcYYyE032XmNsGnfbj5dwjyXiSgEWwweqffMbgu599Ns6zFNJxztQrryzpD2O3NlKXgK.mPbuSY5BMm5WCbnMSCYKUM6BsINvsbWLDKd9Lv9dZa7dvcu5+mPsSCj7L28JvAQmofLSR4RsuAuWJKQXDsm2FtddcM7uYVkauPQh1IKTCnm52cYDselkKoZtR5pj6qzrCj9ca+y1sZ+q1t2LzrYKMlo1lpDBnvrrvF2d5cQzWlGeBKcC2yIhb1UIBG6W2W4b69p51dp8ntVhJ4DIWePBSdatMTo+.902lLjnIFCXIFjWBKUyMR.OjcNzYasisbJO7gd6+yqBcLpnbAQe81Hyrix.PM3Z9UiiTlw0KpOa4Ao259J20clx0z4KWuMVhdgp1CsdKmT0wYzrYLptRrMcF+8G9wRnupx0PG0dDnw5BvStedbHL3lx.kHkLgwmhaXbT10Al0lJSHSFUr3uvUYv9l03xf8uLHJlPSUGSscGlYgOt.Azjr3UBsf2MAqc6iJ5X.dNA8BPwvH5ioTSo3kf1WNmWsBbd8JvYyUfyaVANasBbd6Jv4c2IGyaG2IWqhssI.vzQEiQv3QRB3xJbjn+Q023zw
-
@orange said in Woocommerce linked licensing system for your plugins:
For removing spaces?
No, we're removing quotation marks
""
-
@d-healey said in Woocommerce linked licensing system for your plugins:
No, we're removing quotation marks ""
Why? I think there is no need to do that?
-
@orange When the token is written to the text file it adds quotation marks. These need to be removed before being added to the header.
-
@d-healey Then substring can work here. This will extract the string between first and last chars.
exampleString.substring(1, exampleString.length-1);
-
@d-healey @orange so,
.substring
works but.replace
doesn't...
(no matter if I write.replace("", "")
or.replace('""', "")
the result is the same).By using this, I mananged to get it to work :
const info = desktop.getChildFile("info.txt"); // Function getTheToken info.writeObject(response); // Function verifyTheToken local text = info.loadAsObject(); local token = text.token; Server.setHttpHeader("Authorization: Bearer " + token);
Is there a preferred method between
.loadAsObject()
and.loadAsString
for these kind of things or is there no difference ? -
@matt_sf I use an encrypted object.
-
@matt_sf said in Woocommerce linked licensing system for your plugins:
Is there a preferred method between .loadAsObject() and .loadAsString for these kind of things or is there no difference ?
I think objects would be better choice. Writing and Rreading encrypted objects is more secure way for that purpose. You can encrypt the file with a combination of complex pin and machine ID. Also you can change the encrypted file extension from .json to .dat or whatever you like.
-
-
@orange I am trying to make a similar thing like you did for license activation but as I see it's very very complicated to make the same licensing application in HISE. Much more harder than I think!
As I also see you do analog modeling plugins too. It's very interesting that you do very very hard to implemet stuff directly in HISE :D For me, unbelievable and extraordinary, congrats dude!
-
This post is deleted! -
Hey, it's me again ! I have a question regarding security :
I'm into the process of "converting" my Kontakt instruments into VSTs and I'm using JWT Auth + the License manager plugin, but I just set up the license system so the customers who already purchased my Kontakt instruments don't have a serial number yet.
In order to offer the smoothest user experience, my first tought of managing this was to implement an 'Auth + Register' system in the VST plugin which does this (roughly) :
User enter Username & Password then use JWT to authenticate the user then :
if (User owns the product) { if (User already have a serial) { ServerCall.use License Manager endpoint to check the serial and authorize the plugin; } else if (User dont have a serial in his account) { plugin.function(generateSerial); ServerCall.use License Manager endpoint to create a serial number into User account and authorize the plugin; } } else { Dont unlock the plugin }
But I'm concerned by automatically creating a serial with the License manager endpoint. Wouldn't it be a major security breach to let a plugin use this endpoint ? Technically it writes something in my DB....
-
@matt_sf If it's an authorised request via jwt it shouldn't be anymore of a risk than doing the same thing through your website
-
@matt_sf said in Woocommerce linked licensing system for your plugins:
But I'm concerned by automatically creating a serial with the License manager endpoint. Wouldn't it be a major security breach to let a plugin use this endpoint? Technically it writes something in my DB....
I think you shouldn't use creating serial number endpoint, that could be a security hole like you said.
What you can do is: upload/create "unregistered" serials into your Woocommerce License Manager admin area. While uploading the serials, you need to mark them as "unregistered".
Then the user needs to enter the exact serial number to register it. This way would be more secure because if the entered serial is not in your "unregistered serials list", then the license activation can't be done. You can also use this system for the resellers too. You can give unregistered serials to the resellers to sell them, then the users will need to register the code into their account.
But giving a right to create a serial number is a different story and this might be a security issue.
-
@orange @d-healey thanks for your answers. My problem was to at least assign thoses licenses - if not send them - to existing customers (there are about 300-400 of them so doing it manually was not an option ).
But I just thought that it shouldn't be a problem to upload a bunch of unregistered licences and, instead of creating one via the plugin, just get one and activate it (I should have thought of that).
Thank you !
-
@orange too bad, it seems there's no way to 'GET' an existing unregistered license which then can be activated on the fly with the License Manager's API. In order for this to work, the user must have received his license beforehand.
I'll have to find another way... Thanks anyway ! -
-
@clumsybear You'd have to use the JUCE network class probably: https://docs.juce.com/master/group__juce__core-network.html