diff --git a/src/main.cpp b/src/main.cpp index 891f22e..bc16289 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,9 @@ -// The codes that are displayed are not consistent with the GOOGLE Authenticator -// app.... I guess that TOTP library has an issue... +// to get the code from Google Authenticator you need to decode base32 and +// convert that to hex: +/* +echo -n "F4ZVI6KKNF4SW5DG" |base32 -d | xxd -ps +2f3354794a69792b7466 +*/ // I connected SCL to D22 and SDA to D21 @@ -23,10 +27,10 @@ WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP); -uint8_t hmacKey[] = {0x62, 0x27, 0x2F, 0x33, 0x54, 0x79, 0x4A, - 0x69, 0x79, 0x2B, 0x74, 0x66, 0x27}; +uint8_t hmacKey[] = {0x2F, 0x33, 0x54, 0x79, 0x4A, + 0x69, 0x79, 0x2B, 0x74, 0x66}; -TOTP totp = TOTP(hmacKey, 12); +TOTP totp = TOTP(hmacKey, 10); char code[7]; unsigned long lastMsg = 0;