Unsolved Writing and Reading Obfuscated Folders?
-
Does anyone know how I'd go about — obfuscating a folder, for each sample map, containing the samples, as well as arbitrary data files I could read and write? The user wouldn't expand these files—HISE would read directly from them. (I'm assuming that by default, SampleMaps are not viewable by users.)
I've seen the .hxi format, as well as the encryption API, in the docs. I'm not sure how to put it all together, though (and if it's even possible).
Any help is greatly appreciated.
-
@clevername27 Why would you want to do that?
I mean numbers are numbers, so you could just move the notes to a different value based on some kind of look up table.
-
@d-healey Thank you, interesting idea. Will think on, and rephrase.
-
@clevername27 You can compress the samples to monoliths, which are encoded by default. You can then accompany these with a file (which is any extension, use something unknown so it doesn't suggest an app to open it with) which will contain a JSON object with your data. You can encode the the entire string with RSA and call FileSystem.decryptWithRSA().
If it's not encrypted, use File.loadAsObject().
Extension doesn't matter, HISE will attempt to read it the way you instruct it to.
Alternatively, you can store JSON on your server, github even if you don't care about it being public (github has stupidly high rate limits per file so no worries about access issues), pull it from there. If you don't want to open the repo publicly and want to use it internally (like you mentioned a couple a times here on the forum), you can generate an access token and access the file directly, i think it's
https://USERNAME:TOKEN@api.github.com/repos/USERNAME/REPO/contents/PATH_TO_FILE
I say use it internally because this link would be embedded in the plugin and it's a rather bad idea to share your token, unless you make a specific account with just a single repo ( I don't know if you can make the access token on github read-only; didn't go into that yet). You can also have a serverless access: create a custom function on AWS Lambda or Cloud functions which have generous free tiers and very low pay-as-you-go once you bust 2 million calls per month or something like that.
You'd just write a simple function in python, node, java, ruby, whatever, that fetches the JSON from your private repo on a POST call. The dashboard would get you the API endpoint for that specific function and you'd just call that with POST from your HISE plugin using the Server.API.
The files in your Github repo would be raw JSON. Look at the example in the server.callWithPost docs and follow that link to the actual file on the hise.audio website.
-
@aaronventure Thank you. Could you possibly show a code outline of how I'd do that — writing an event list to encoded file, and then decoding it? I'm little unclear. Cheers.