The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
A TOTP-based authenticator for the GNOME platform, inspired by the Google Authenticator.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
gauthenticator/src/otp-row.vala

42 lines
1.2 KiB

namespace GAuthenticator {
[GtkTemplate (ui = "/eu/polonkai/gergely/gauthenticator/otp-row.ui")]
class OTPRow : Gtk.Grid {
[GtkChild]
private Gtk.Label code;
[GtkChild]
private Gtk.Label provider_name;
[GtkChild]
private Gtk.Label account_name;
public string secret {get; set;}
public string provider {get; set;}
public string account {get; set;}
private OTP.TOTP generator;
public OTPRow(string secret, string provider, string account) {
Object(secret: secret, provider: provider, account: account);
generator = new OTP.TOTP(secret, 6, GLib.ChecksumType.SHA1, 30);
provider_name.set_text(provider);
account_name.set_text(account);
}
public void update(bool first = false) {
uint64 val;
// FIXME: The first run is OK, but the rest is behind one cycle
if (first) {
val = generator.now();
} else {
var dt = new GLib.DateTime.now_utc();
val = generator.at(dt, 1);
}
code.set_text("%06lu".printf((ulong)val));
}
}
}