@Emil Thanks for the reply, the code lines I added in my post are what I found for vanilla implementation of cryptography, but it fails

Posts made by beachb_sl
-
RE: Crypto for secured requests
-
Crypto for secured requests
Hi, I'm trying to automate some smart devices I own (through the Tuya Cloud interface) but I need to encrypt the POST request before I can get a token to work with the API.
Anyone knows if it's even possible to use crypt properly?
Ideally, this should be based on TypeScript which I dont think the hub supports (?)
For vanilla Javascript I need to create an SHA256 based string and it breaks on the following -
crypto.subtle.digest('SHA-256', msgBuffer);msgBuffer is just an encoded string which seems to be working -
var msgBuffer = new TextEncoder().encode(message);I think crypto is not supported as it's a heavy operation?
-
OMG How I love this! Lights, Volume and opinion/summary
I recently got myself the hub, twister button and simple flic2 button. I'm just starting but took a deep dive straight into all the SDK and just now I finally finished implementing pretty much all I ever wanted from buttons and it's just the beginning for me. I'm so excited about the possibilities!!
I have a very long story on my obssesion for smart stuff but I'll cut it short and say this -
My simple button - Double tap turns off my house lights between 10pm to 3am (I pull the right time through the internet), so outside those hours I can assign other activities to the button
My twister button - regular twist controls the volume of my Laptop, press and twist controls my bedroom light and hold button resets the laptop volume. For the volume control I check if my laptop is available, otherwise I can assign other tasks for the button
This wasn't as easy as it SHOULD have been unfortunately... this is really highly dev skills required but it's doable. I just wish it was much easier to achieve without the amount of code work and integrations I made