TuyaAPI / cloud

🌨 🎁 A NodeJS wrapper for Tuya's cloud API. Documentation: https://tuyaapi.github.io/cloud/.
MIT License
32 stars 15 forks source link

Documentation on how to obtain Key and Secret, secret 2 and certSign is unclear #5

Closed zyrorl closed 5 years ago

zyrorl commented 5 years ago

Hi there,

I've managed to follow as much as i can from the documentation but all i can seem to figure out is that somehow the docs provided by https://github.com/nalajcie/tuya-sign-hacking turns into a keys.json with something like:

93:21:9F:C2:73:E2:20:0F:4A:DE:E5:F7:19:1D:C6:56:BA:2A:2D:7B:2F:F5:D2:4C:D5:5C:4B:61:55:00:1E:40_vay9g59g9g99qf3rtqptmc3emhkanwkx_aq7xvqcyqcnegvew793pqjmhv77rneqc

into:

{
   "key" : "no idea how to get this value",
   "secret": "also no idea on how to get this value",
   "secret2": "vay9g59g9g99qf3rtqptmc3emhkanwkx",
  "certSign": "93:21:9F:C2:73:E2:20:0F:4A:DE:E5:F7:19:1D:C6:56:BA:2A:2D:7B:2F:F5:D2:4C:D5:5C:4B:61:55:00:1E:40"
}

Can you please clarify the steps required to compose this entire file? It's not very obvious, and I really would love to get this working somehow as the smart lock i use does not have any IFTTT support within the Tuya app and I'd like to trigger all kinds of work flows based on events that take place based on unlock events etc.

codetheweb commented 5 years ago

I replied to your email.

hrzepinski commented 4 years ago

Hello, can you share this information here so anyone interested could use it? I tried to use ket/secret I obtained from the official Tuya Cloud API, but I'm getting SING_VALIDATE_FALED.

codetheweb commented 4 years ago

I didn't work on this part of the library; someone else did. You might want to try asking @nalajcie.

nalajcie commented 4 years ago

Hi, the keys were not written in plain text in documentation on purpose - to avoid potential legal problems from Tuya (but nevertheless, they are all described in README.

As it's almost a year since the publication and it seems that nobody cares - let me just put the correct configuration for TuyaSmart application:

{
    "key": "3fjrekuxank9eaej3gcx",
    "secret": "aq7xvqcyqcnegvew793pqjmhv77rneqc",
    "secret2": "vay9g59g9g99qf3rtqptmc3emhkanwkx",
    "certSign": "93:21:9F:C2:73:E2:20:0F:4A:DE:E5:F7:19:1D:C6:56:BA:2A:2D:7B:2F:F5:D2:4C:D5:5C:4B:61:55:00:1E:40"
}
pergolafabio commented 1 year ago

Hi

does anyone also have the secret2 and certsig for the "smart life" app ?

pergolafabio commented 1 year ago

I tried these: "secret2": "vay9g59g9g99qf3rtqptmc3emhkanwkx", "certSign": "93:21:9F:C2:73:E2:20:0F:4A:DE:E5:F7:19:1D:C6:56:BA:2A:2D:7B:2F:F5:D2:4C:D5:5C:4B:61:55:00:1E:40"

and for key/secret i putted in mine (same keys i use for HA), but always got username/password issues Maybe is because of the country? How can i define country ?

thnx

pergolafabio commented 1 year ago

hey @nalajcie or @codetheweb , i also tried script below, but receive "SING VALIDATE FAILED"

for key/secret, i used my own set offcourse, secret2 and certsign are the same as above, using tuya app

just tested below:

const apiKeys = require('./keys.json');
const Cloud = require('@tuyapi/cloud');
const is = require('is');
const api = new Cloud({key: apiKeys.key, secret: apiKeys.secret,secret2: apiKeys.secret2, certSign: apiKeys.certSign, apiEtVersion: '0.0.1', region: 'EU'});
const apiResult = api.login({email: 'xxx@gmail.com', password: 'xxx'});

What could be wrong? maybe the secret2 has been changed?

pergolafabio commented 1 year ago

ok, i know why i had username/password wrong, seems i had an '@' in my password, it doesnt like that now when using the script i get "APP_NEED_UPGRADE" , seems the keys dont work anymore?

pergolafabio commented 1 year ago

got it working, was using the login method instead of the loginEx

pergolafabio commented 1 year ago

hey @codetheweb , maybe usefull to update the readme, after googling i also found the keys for smartlife app

For Tuya:

{
  "key": "3fjrekuxank9eaej3gcx",
  "secret": "aq7xvqcyqcnegvew793pqjmhv77rneqc",
  "secret2": "vay9g59g9g99qf3rtqptmc3emhkanwkx",
  "certSign": "93:21:9F:C2:73:E2:20:0F:4A:DE:E5:F7:19:1D:C6:56:BA:2A:2D:7B:2F:F5:D2:4C:D5:5C:4B:61:55:00:1E:40" 
}

For Smartlife:

{
  "key": "ekmnwp9f5pnh3trdtpgy",
  "secret": "r3me7ghmxjevrvnpemwmhw3fxtacphyg",
  "secret2": "jfg5rs5kkmrj5mxahugvucrsvw43t48x",
  "certSign": "0F:C3:61:99:9C:C0:C3:5B:A8:AC:A5:7D:AA:55:93:A2:0C:F5:57:27:70:2E:A8:5A:D7:B3:22:89:49:F8:88:FE" 
}
szupi-ipuzs commented 1 year ago

Just to let you know, I've found the codes for BirdLover app:

{
  "key": "gmusrthh3sygeyv3sr38",
  "secret": " x4y4ds9nysv4d3agjyqwmvnptwhgtcwu ",
  "secret2": "pku4cchspfmskfgtaacqcvkfdscx7u7t",
  "certSign": "A"
}