- Encrypted Mode allows you to hide any sensitive information by encrypting it. Read more at this blog post
- Code below based on logic from Rails Gem that has Encrypted Mode
window.intercomSettings = {
app_id: "a1b2c3d4",
email: “bob@intercom.io”,
favourite_color: “blue”,
pricing_plan: “gold”
};
window.intercomSettings = {
app_id: "a1b2c3d4",
};
window.intercomEncryptedPayload = ‘PcWsDRQCM/xB5gyhaBBuas81891+ahdanbLLlkhOoRsrShn76n7nnn089jfjS8R5yrIRD8N9Hnn4g89dqH+1izo’;
- These are listed below and each language / platform has its own file with some documentation within that file itself.
- Feel free to contribute others that are not listed 😀
- Below is some sample data that could help with any implementations
Starting from a text identity verification value of mysecret
$secret = "mysecret"; // $key = hex2bin(hash("sha256", $secret));
It should yield a key value
base64_encode($key) == "ZSx9xofZjJiJME7S5AjHS2EehqQMqlHEtD8d1ZE8XNA="
For the encryption portion it will take 3 inputs $plaintext
, $key
, $iv
and return a $ciphertext
and $tag
$ciphertext = doEncyption($plaintext, $key, $iv, $tag);
Using the following plaintext
$plaintext = "{\"user_id\":\"1\",\"user_hash\":\"20dd4a92e1bcda4403a0de48ef5e5d4b0544a7f2317270e58519af9bc29010be\"}"
With this initislisation vector (in real world example this should be randomised)
base64_encode($iv) == "q83vASNFZ4k=" // $iv = hex2bin("abcdef0123456789");
It should return $ciphertext
and $tag
of the following values
base64_encode($ciphertext) == "iv8ExqxYd4n9/PN4hIDfTMgWFzi/Z5ox+TehpT1sU2qR9RwRRJqEgHZy/ks4zFORDoPnBPYlDwR7Sm8/9U+7rSSzkTxunKWRUMjNcKdOAYaxJLZOMCpxycctbEnWsA=="
base64_encode($tag) == "tfzI3dkc+NYTMttuGCrszQ=="
The final output intercomEncryptedPayload
value should be as follows
intercomEncryptedPayload == "q83vASNFZ4mK/wTGrFh3if3883iEgN9MyBYXOL9nmjH5N6GlPWxTapH1HBFEmoSAdnL+SzjMU5EOg+cE9iUPBHtKbz/1T7utJLORPG6cpZFQyM1wp04BhrEktk4wKnHJxy1sSdawtfzI3dkc+NYTMttuGCrszQ=="
This code is a little outdated for nodeJS, after some experimentation this is what I have found works:
Our Encryption Package
Encrypting Intercom Settings
Frontend