Unlocker write/load key file - basics
-
Hey guys,
I could use a hand understanding the basics of using the Unlocker write/load key functions.
I'm trying to put together a super basic script to use the unlocker to write a file, and then decrypt the info from the file and display in a label.
Here's what I'm currently trying:Engine.createLicenseUnlocker(); var myKeyFile; myKeyFile = FileSystem.getFolder(FileSystem.Desktop).getParentDirectory().getChildFile("data.dat"); const var WriteFile = Content.getComponent("WriteFile"); const var KeyLabel = Content.getComponent("KeyLabel"); KeyLabel.set("text",""); //remove text from label //write key function inline function writeMyKey() { local mySecretData = "this is my data"; myKeyFile.writeKeyFile(mySecretData); KeyLabel.set("text",myKeyFile.loadKeyFile()); } //write the key inline function onWriteFileControl(component, value) { if(value) { writeMyKey(); } }; Content.getComponent("WriteFile").setControlCallback(onWriteFileControl);
I'm getting an error at myKeyFile.writeKeyFile(mySecretData); saying "function not found"... so I'm obviously not using it correctly.
HiseSnippet 1048.3ocsV09aaSDF+bS8DNvPLI1WQV4StRkzTXafzzDgllhpVaWfrM3aSWreRxob9tv4KsyBMI9Si+j3y7kwyyY6X20zwTDKpJoOud+te94EOxnigrLsg4E777k.y6y7GmqryGLmKTrSOl4ce+e0HrP3PUrIeoERBeJjyNJeIOKCRXdds9IxUufcYtO+8ObDWxUwPsJF6kZQLblHUXq0Np+SER4I7D34hzFd+f9mFqUCzR8JDVs76wVxiWvmAWvI21wm4cmgIBq1L1xsPFya2izI4imquRU3+KEYhIRfDNjMFSTg5SzxDBwjV1f4BYxnpqeFCyxnZxnUAY7k9mKRDq0WSJegyPXcDM4CuctN7ZcM3cXS30qA71.j7Z.ocKfz87GGaDKs0VH77o9mprfYJGo8lPovW1N+dK+AZzCksaJeAbhAEVGQzi50a+P7q8db61CUyDJnarAPveF9TSkAuPI0wK.SD4vkbSXZNVCbhPBn75+O7IgzOiyyrPZ2Yf0w2lnFJOFxVX0K2irNhaP3brv.wHWkG4T5n.JfnNIbKuK9UG5PwBhLaHczthwxiq5JQApSWpUnPTm0d7NQhv7L9DPdqAV4fKtJgtY.ZxBu11Y+NnkvvCNv.o5KgPRY3TiNMTRd1t8AGbkqUYAjGNckJ1Jzp1BkDIz0xgNWNmHsn8Z+GsCPpkKQFcLfbt8X7Vi.rictHKD+KMOjHhNHhBVyzcc4nTHpYnHxCwOaB70QK07jpf2itquoF514N3eCTqUqoUh7LZYTbEysORuxUf61HlFUJDfRAMurOtc.dPuAOu+ymaDtKOlAbobB1+GcSDPPuA.uPagmoJHU7JE9tllNci1JSljJu2fYZ1j48EXjZU5DvzjDHGwF1qOEv+1mBzbHUbA2zvQs5Tkv9rkf51FcwJITZhQIpPWst4Eed47hiVYsZESjPCKVyjLGnaNol8hSoBopTgYEOokfwJnKg2wvk3LghQQA9k8y3P40OGwK5GzA+50G5eI6mWifj9hry0oXl3l7pKbcxCJR9cKStqJ2k619UE8MRcenQp+yE8uRjXmiHz6eP44fX1bBudeEJMYV0Fmf6fKw9YJBDqoM0xdKokZmbqgX2b5LtWPmrRxsWeYAsgrz.V6bsIzzTXUlvl2bC5+aaP9Pg387GIrwy2LF2YCXDqO9Xfwx8t20e3zo3dgZ.tq+I+1GmkrreQuxJTyNmaMBrzw+hUoiwG4w.d5JEHodWucntrB4djLw.iAUhS3s3mRiGRxdkFOrxHKkGazuJtn2j1r+INMHlTtWpIv+bRN7vpFRe+dc6wRwWx3Uwwz0+qw9fMGy2rEw7saQLOXKh4gaQLOZKh461hX992aLz628iqr5zh1ATwngtAiddCUbrxxUEx9WHbRKL.
-
@Dan-Korneff The
writeKeyFile
function is a method of the Unlocker object (which you're not assigning to a variable). The key file location is static (it's always a file in the app data folder) so you don't need to bother about that, just give it the key file data.To fetch the user data from a unlocked
Unlocker
object you can just useul.getUserEmail()
etc.