ekool
Well-known member
Well I'm 100% certain there is nothing in the addon that would ever write any value to that option other than a 32-byte string. So if it's being erased somehow, it's something outside the addon.
Just to make sure there's not some random debugging code left in there, I grepped every occurrence ofbaAnalyticsKey
in the code, and it's all as expected.
Bash:twin1:/home/sites/sexytime.site/web/src/addons/DigitalPoint/Analytics # grep -R baAnalyticsKey * Setup.php: if (function_exists('sodium_crypto_secretbox') && strlen(\XF::options()->baAnalyticsKey) != SODIUM_CRYPTO_SECRETBOX_KEYBYTES) Setup.php: \XF::repository('XF:Option')->updateOption('baAnalyticsKey', \XF::generateRandomString(SODIUM_CRYPTO_SECRETBOX_KEYBYTES)); Util/Crypt.php: return \XF::options()->baAnalyticsKey; XF/Admin/Controller/Tools.php: \XF::repository('XF:Option')->updateOption('baAnalyticsKey', \XF::generateRandomString(SODIUM_CRYPTO_SECRETBOX_KEYBYTES));
In theSetup.php
file, during installation it checks if Sodium is installed and that the option is not 32 bytes, and if Sodium is installed and the option isn't a 32-byte string, it writes a 32-byte string.
In theUtil/Crypt.php
file, it reads the option for using it to encrypt something (what's causing your problem since there's no string there).
TheXF/Admin/Controller/Tools.php
file will write a 32-byte string to the option when you ask it to generate a new string.
...and that's it. It's really not a lot of convoluted usage of the option that could get mixed up somewhere.
There is nothing in the addon that would ever erase the option value (the only 2 uses of updateOption() is when it clearly is writing a randomly generated 32-byte string when it's supposed to... during install or on request to reset it).
That being said, it's not a "read-only" database record or option (that's not a thing in XenForo). So anything with write access to your MySQL database could in theory change that value... so that could be any process doing anything with MySQL or some other addon (not sure what it would be, just saying it's a possibility).
What if that value has never been filled? How can I re-generate the value? Where is the button to redo that?
This is what I see in the Admin CP... but I don't see anything about re-generating a secret key.