Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions watch-faces/complication/totp_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#endif

typedef struct {
unsigned char labels[2];
unsigned char labels[3];
hmac_alg algorithm;
uint32_t period;
size_t encoded_key_length;
Expand All @@ -65,8 +65,8 @@ typedef struct {
// Enter your TOTP key data below

static totp_t credentials[] = {
CREDENTIAL(2F, "JBSWY3DPEHPK3PXP", SHA1, 30),
CREDENTIAL(AC, "JBSWY3DPEHPK3PXP", SHA1, 30),
CREDENTIAL(2FA, "JBSWY3DPEHPK3PXP", SHA1, 30),
CREDENTIAL(ABC, "JBSWY3DPEHPK3PXP", SHA1, 30),
};

// END OF KEY DATA.
Expand Down Expand Up @@ -124,7 +124,7 @@ static void totp_display_error(totp_state_t *totp_state) {
char buf[10 + 1];
totp_t *totp = totp_current(totp_state);

snprintf(buf, sizeof(buf), "%c%c ERROR ", totp->labels[0], totp->labels[1]);
snprintf(buf, sizeof(buf), "%c%c ERROR %c", totp->labels[0], totp->labels[1], totp->labels[2]);
watch_display_text(0, buf);
}

Expand All @@ -140,7 +140,7 @@ static void totp_display_code(totp_state_t *totp_state) {
totp_state->steps = result.quot;
}
valid_for = totp->period - result.rem;
sprintf(buf, "%c%c%2d%06lu", totp->labels[0], totp->labels[1], valid_for, totp_state->current_code);
sprintf(buf, "%c%c%2d%06lu%c", totp->labels[0], totp->labels[1], valid_for, totp_state->current_code, totp->labels[2]);

watch_display_text(0, buf);
}
Expand Down