1
0
Fork 0
mirror of https://github.com/seiichiro0185/sailotp.git synced 2024-11-22 07:39:42 +00:00

Merge branch 'feat-diff_and_length' into develop

This commit is contained in:
seiichiro 2016-07-17 19:33:38 +02:00
commit 38671a65f7
14 changed files with 245 additions and 141 deletions

View file

@ -49,72 +49,88 @@ Lizenz: BSD (3-Klausel)</translation>
<context> <context>
<name>AddOTP</name> <name>AddOTP</name>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="68"/> <location filename="../qml/pages/AddOTP.qml" line="70"/>
<source>Show QR-Code</source> <source>Show QR-Code</source>
<translation>QR-Code anzeigen</translation> <translation>QR-Code anzeigen</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="71"/> <location filename="../qml/pages/AddOTP.qml" line="73"/>
<source>Can&apos;t create QR-Code from incomplete settings!</source> <source>Can&apos;t create QR-Code from incomplete settings!</source>
<translation>Ein QR-Code kann nur mit vollständigen Einstellungen erzeugt werden!</translation> <translation>Ein QR-Code kann nur mit vollständigen Einstellungen erzeugt werden!</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="84"/> <location filename="../qml/pages/AddOTP.qml" line="86"/>
<source>Save</source> <source>Save</source>
<translation>Speichern</translation> <translation>Speichern</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="84"/> <location filename="../qml/pages/AddOTP.qml" line="86"/>
<source>Add</source> <source>Add</source>
<translation>Hinzufügen</translation> <translation>Hinzufügen</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="89"/> <location filename="../qml/pages/AddOTP.qml" line="91"/>
<source>Type</source> <source>Type</source>
<translation>Typ</translation> <translation>Typ</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="91"/> <location filename="../qml/pages/AddOTP.qml" line="93"/>
<source>Time-based (TOTP)</source> <source>Time-based (TOTP)</source>
<translation>Zeitbasiert (TOTP)</translation> <translation>Zeitbasiert (TOTP)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="92"/> <location filename="../qml/pages/AddOTP.qml" line="94"/>
<source>Counter-based (HOTP)</source> <source>Counter-based (HOTP)</source>
<translation>Zählerbasiert (HOTP)</translation> <translation>Zählerbasiert (HOTP)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="93"/> <location filename="../qml/pages/AddOTP.qml" line="95"/>
<source>Steam Guard</source> <source>Steam Guard</source>
<translation>Steam Guard</translation> <translation>Steam Guard</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="99"/> <location filename="../qml/pages/AddOTP.qml" line="101"/>
<source>Title</source> <source>Title</source>
<translation>Titel</translation> <translation>Titel</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="100"/> <location filename="../qml/pages/AddOTP.qml" line="102"/>
<source>Title for the OTP</source> <source>Title for the OTP</source>
<translation>Titel für das Token</translation> <translation>Titel für das Token</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="112"/> <location filename="../qml/pages/AddOTP.qml" line="114"/>
<source>Secret (at least 16 characters)</source> <source>Secret (at least 16 characters)</source>
<translation>Schlüssel (mindestens 16 Zeichen)</translation> <translation>Schlüssel (mindestens 16 Zeichen)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="114"/> <location filename="../qml/pages/AddOTP.qml" line="116"/>
<source>Secret OTP Key</source> <source>Secret OTP Key</source>
<translation>Geheimer Schlüssel</translation> <translation>Geheimer Schlüssel</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="126"/> <location filename="../qml/pages/AddOTP.qml" line="127"/>
<source>Length</source>
<translation>Länge</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="129"/>
<source>Length of the Token</source>
<translation>Länge des Tokens</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="141"/>
<location filename="../qml/pages/AddOTP.qml" line="143"/>
<source>Time Derivation (Seconds)</source>
<translation>Zeitabweichung (Sekunden)</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="155"/>
<source>Next Counter Value</source> <source>Next Counter Value</source>
<translation>Nächster Zählerwert</translation> <translation>Nächster Zählerwert</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="128"/> <location filename="../qml/pages/AddOTP.qml" line="157"/>
<source>Next Value of the Counter</source> <source>Next Value of the Counter</source>
<translation>Nächster Wert für den Zähler</translation> <translation>Nächster Wert für den Zähler</translation>
</message> </message>
@ -237,7 +253,7 @@ Lizenz: BSD (3-Klausel)</translation>
<context> <context>
<name>MainView</name> <name>MainView</name>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="106"/> <location filename="../qml/pages/MainView.qml" line="96"/>
<source>About</source> <source>About</source>
<translation>Über</translation> <translation>Über</translation>
</message> </message>
@ -250,57 +266,57 @@ Lizenz: BSD (3-Klausel)</translation>
<translation type="vanished">Datenbank importieren</translation> <translation type="vanished">Datenbank importieren</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="110"/> <location filename="../qml/pages/MainView.qml" line="100"/>
<source>Export / Import</source> <source>Export / Import</source>
<translation>Export / Import</translation> <translation>Export / Import</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="114"/> <location filename="../qml/pages/MainView.qml" line="104"/>
<source>Add Token</source> <source>Add Token</source>
<translation>Token hinzufügen</translation> <translation>Token hinzufügen</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="144"/> <location filename="../qml/pages/MainView.qml" line="134"/>
<source>Nothing here</source> <source>Nothing here</source>
<translation>Hier ist nichts</translation> <translation>Hier ist nichts</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="145"/> <location filename="../qml/pages/MainView.qml" line="135"/>
<source>Pull down to add a OTP</source> <source>Pull down to add a OTP</source>
<translation>Nach unten ziehen zum hinzufügen</translation> <translation>Nach unten ziehen zum hinzufügen</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="156"/> <location filename="../qml/pages/MainView.qml" line="146"/>
<source>Deleting</source> <source>Deleting</source>
<translation>Lösche</translation> <translation>Lösche</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="172"/> <location filename="../qml/pages/MainView.qml" line="162"/>
<source>Token for </source> <source>Token for </source>
<translation>Token für </translation> <translation>Token für </translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="172"/> <location filename="../qml/pages/MainView.qml" line="162"/>
<source> copied to clipboard</source> <source> copied to clipboard</source>
<translation> kopiert</translation> <translation> kopiert</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="240"/> <location filename="../qml/pages/MainView.qml" line="230"/>
<source>Move up</source> <source>Move up</source>
<translation>Nach oben</translation> <translation>Nach oben</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="245"/> <location filename="../qml/pages/MainView.qml" line="235"/>
<source>Move down</source> <source>Move down</source>
<translation>Nach unten</translation> <translation>Nach unten</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="250"/> <location filename="../qml/pages/MainView.qml" line="240"/>
<source>Edit</source> <source>Edit</source>
<translation>Bearbeiten</translation> <translation>Bearbeiten</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="256"/> <location filename="../qml/pages/MainView.qml" line="246"/>
<source>Delete</source> <source>Delete</source>
<translation>Löschen</translation> <translation>Löschen</translation>
</message> </message>
@ -308,7 +324,7 @@ Lizenz: BSD (3-Klausel)</translation>
<context> <context>
<name>QRPage</name> <name>QRPage</name>
<message> <message>
<location filename="../qml/pages/QRPage.qml" line="73"/> <location filename="../qml/pages/QRPage.qml" line="74"/>
<source>Can&apos;t create QR-Code from incomplete settings!</source> <source>Can&apos;t create QR-Code from incomplete settings!</source>
<translation>Ein QR-Code kann nur mit vollständigen Einstellungen erzeugt werden!</translation> <translation>Ein QR-Code kann nur mit vollständigen Einstellungen erzeugt werden!</translation>
</message> </message>
@ -336,12 +352,12 @@ Lizenz: BSD (3-Klausel)</translation>
<translation>scanne...</translation> <translation>scanne...</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/ScanOTP.qml" line="97"/> <location filename="../qml/pages/ScanOTP.qml" line="101"/>
<source>No valid Token data found.</source> <source>No valid Token data found.</source>
<translation>Kein gültiges Token gefunden.</translation> <translation>Kein gültiges Token gefunden.</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/ScanOTP.qml" line="138"/> <location filename="../qml/pages/ScanOTP.qml" line="142"/>
<source>Tap the picture to start / stop scanning. Pull down to add Token manually.</source> <source>Tap the picture to start / stop scanning. Pull down to add Token manually.</source>
<translation>Vorschau antippen um den Scan zu starten / zu stoppen. Nach unten ziehen um manuell hinzu zu fügen.</translation> <translation>Vorschau antippen um den Scan zu starten / zu stoppen. Nach unten ziehen um manuell hinzu zu fügen.</translation>
</message> </message>

View file

@ -39,72 +39,88 @@ License: BSD (3-clause)</source>
<context> <context>
<name>AddOTP</name> <name>AddOTP</name>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="68"/> <location filename="../qml/pages/AddOTP.qml" line="70"/>
<source>Show QR-Code</source> <source>Show QR-Code</source>
<translation>Show QR-Code</translation> <translation>Show QR-Code</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="71"/> <location filename="../qml/pages/AddOTP.qml" line="73"/>
<source>Can&apos;t create QR-Code from incomplete settings!</source> <source>Can&apos;t create QR-Code from incomplete settings!</source>
<translation>Can&apos;t create QR-Code from incomplete settings!</translation> <translation>Can&apos;t create QR-Code from incomplete settings!</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="84"/> <location filename="../qml/pages/AddOTP.qml" line="86"/>
<source>Save</source> <source>Save</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="84"/> <location filename="../qml/pages/AddOTP.qml" line="86"/>
<source>Add</source> <source>Add</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="89"/> <location filename="../qml/pages/AddOTP.qml" line="91"/>
<source>Type</source> <source>Type</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="91"/> <location filename="../qml/pages/AddOTP.qml" line="93"/>
<source>Time-based (TOTP)</source> <source>Time-based (TOTP)</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="92"/> <location filename="../qml/pages/AddOTP.qml" line="94"/>
<source>Counter-based (HOTP)</source> <source>Counter-based (HOTP)</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="93"/> <location filename="../qml/pages/AddOTP.qml" line="95"/>
<source>Steam Guard</source> <source>Steam Guard</source>
<translation>Steam Guard</translation> <translation>Steam Guard</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="99"/> <location filename="../qml/pages/AddOTP.qml" line="101"/>
<source>Title</source> <source>Title</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="100"/> <location filename="../qml/pages/AddOTP.qml" line="102"/>
<source>Title for the OTP</source> <source>Title for the OTP</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="112"/> <location filename="../qml/pages/AddOTP.qml" line="114"/>
<source>Secret (at least 16 characters)</source> <source>Secret (at least 16 characters)</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="114"/> <location filename="../qml/pages/AddOTP.qml" line="116"/>
<source>Secret OTP Key</source> <source>Secret OTP Key</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="126"/> <location filename="../qml/pages/AddOTP.qml" line="127"/>
<source>Length</source>
<translation>Length</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="129"/>
<source>Length of the Token</source>
<translation>Length of the Token</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="141"/>
<location filename="../qml/pages/AddOTP.qml" line="143"/>
<source>Time Derivation (Seconds)</source>
<translation>Time Derivation (Seconds)</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="155"/>
<source>Next Counter Value</source> <source>Next Counter Value</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="128"/> <location filename="../qml/pages/AddOTP.qml" line="157"/>
<source>Next Value of the Counter</source> <source>Next Value of the Counter</source>
<translation></translation> <translation></translation>
</message> </message>
@ -227,62 +243,62 @@ License: BSD (3-clause)</source>
<context> <context>
<name>MainView</name> <name>MainView</name>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="106"/> <location filename="../qml/pages/MainView.qml" line="96"/>
<source>About</source> <source>About</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="110"/> <location filename="../qml/pages/MainView.qml" line="100"/>
<source>Export / Import</source> <source>Export / Import</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="114"/> <location filename="../qml/pages/MainView.qml" line="104"/>
<source>Add Token</source> <source>Add Token</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="144"/> <location filename="../qml/pages/MainView.qml" line="134"/>
<source>Nothing here</source> <source>Nothing here</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="145"/> <location filename="../qml/pages/MainView.qml" line="135"/>
<source>Pull down to add a OTP</source> <source>Pull down to add a OTP</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="156"/> <location filename="../qml/pages/MainView.qml" line="146"/>
<source>Deleting</source> <source>Deleting</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="172"/> <location filename="../qml/pages/MainView.qml" line="162"/>
<source>Token for </source> <source>Token for </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="172"/> <location filename="../qml/pages/MainView.qml" line="162"/>
<source> copied to clipboard</source> <source> copied to clipboard</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="240"/> <location filename="../qml/pages/MainView.qml" line="230"/>
<source>Move up</source> <source>Move up</source>
<translation>Move up</translation> <translation>Move up</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="245"/> <location filename="../qml/pages/MainView.qml" line="235"/>
<source>Move down</source> <source>Move down</source>
<translation>Move down</translation> <translation>Move down</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="250"/> <location filename="../qml/pages/MainView.qml" line="240"/>
<source>Edit</source> <source>Edit</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="256"/> <location filename="../qml/pages/MainView.qml" line="246"/>
<source>Delete</source> <source>Delete</source>
<translation></translation> <translation></translation>
</message> </message>
@ -290,7 +306,7 @@ License: BSD (3-clause)</source>
<context> <context>
<name>QRPage</name> <name>QRPage</name>
<message> <message>
<location filename="../qml/pages/QRPage.qml" line="73"/> <location filename="../qml/pages/QRPage.qml" line="74"/>
<source>Can&apos;t create QR-Code from incomplete settings!</source> <source>Can&apos;t create QR-Code from incomplete settings!</source>
<translation>Can&apos;t create QR-Code from incomplete settings!</translation> <translation>Can&apos;t create QR-Code from incomplete settings!</translation>
</message> </message>
@ -318,12 +334,12 @@ License: BSD (3-clause)</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/ScanOTP.qml" line="97"/> <location filename="../qml/pages/ScanOTP.qml" line="101"/>
<source>No valid Token data found.</source> <source>No valid Token data found.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/ScanOTP.qml" line="138"/> <location filename="../qml/pages/ScanOTP.qml" line="142"/>
<source>Tap the picture to start / stop scanning. Pull down to add Token manually.</source> <source>Tap the picture to start / stop scanning. Pull down to add Token manually.</source>
<translation></translation> <translation></translation>
</message> </message>

View file

@ -41,72 +41,88 @@ Licens: BSD (3-clause)</translation>
<context> <context>
<name>AddOTP</name> <name>AddOTP</name>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="68"/> <location filename="../qml/pages/AddOTP.qml" line="70"/>
<source>Show QR-Code</source> <source>Show QR-Code</source>
<translation>Visa QR-kod</translation> <translation>Visa QR-kod</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="71"/> <location filename="../qml/pages/AddOTP.qml" line="73"/>
<source>Can&apos;t create QR-Code from incomplete settings!</source> <source>Can&apos;t create QR-Code from incomplete settings!</source>
<translation>Kan inte skapa QR-kod från ofullständiga inställningar!</translation> <translation>Kan inte skapa QR-kod från ofullständiga inställningar!</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="84"/> <location filename="../qml/pages/AddOTP.qml" line="86"/>
<source>Save</source> <source>Save</source>
<translation>Spara</translation> <translation>Spara</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="84"/> <location filename="../qml/pages/AddOTP.qml" line="86"/>
<source>Add</source> <source>Add</source>
<translation>Lägg till</translation> <translation>Lägg till</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="89"/> <location filename="../qml/pages/AddOTP.qml" line="91"/>
<source>Type</source> <source>Type</source>
<translation>Typ</translation> <translation>Typ</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="91"/> <location filename="../qml/pages/AddOTP.qml" line="93"/>
<source>Time-based (TOTP)</source> <source>Time-based (TOTP)</source>
<translation>Tidsbaserad (TOTP)</translation> <translation>Tidsbaserad (TOTP)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="92"/> <location filename="../qml/pages/AddOTP.qml" line="94"/>
<source>Counter-based (HOTP)</source> <source>Counter-based (HOTP)</source>
<translation>Räknarbaserad (HOTP)</translation> <translation>Räknarbaserad (HOTP)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="93"/> <location filename="../qml/pages/AddOTP.qml" line="95"/>
<source>Steam Guard</source> <source>Steam Guard</source>
<translation>Steam Guard</translation> <translation>Steam Guard</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="99"/> <location filename="../qml/pages/AddOTP.qml" line="101"/>
<source>Title</source> <source>Title</source>
<translation>Namn</translation> <translation>Namn</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="100"/> <location filename="../qml/pages/AddOTP.qml" line="102"/>
<source>Title for the OTP</source> <source>Title for the OTP</source>
<translation>Namn OTP:n</translation> <translation>Namn OTP:n</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="112"/> <location filename="../qml/pages/AddOTP.qml" line="114"/>
<source>Secret (at least 16 characters)</source> <source>Secret (at least 16 characters)</source>
<translation>Hemlighet (Minst 16 tecken)</translation> <translation>Hemlighet (Minst 16 tecken)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="114"/> <location filename="../qml/pages/AddOTP.qml" line="116"/>
<source>Secret OTP Key</source> <source>Secret OTP Key</source>
<translation>Hemlig OTP-nyckel</translation> <translation>Hemlig OTP-nyckel</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="126"/> <location filename="../qml/pages/AddOTP.qml" line="127"/>
<source>Length</source>
<translation>längd</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="129"/>
<source>Length of the Token</source>
<translation>Längden av token</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="141"/>
<location filename="../qml/pages/AddOTP.qml" line="143"/>
<source>Time Derivation (Seconds)</source>
<translation>Tidsavvikelsen (sekunder)</translation>
</message>
<message>
<location filename="../qml/pages/AddOTP.qml" line="155"/>
<source>Next Counter Value</source> <source>Next Counter Value</source>
<translation>Nästa räknarvärde</translation> <translation>Nästa räknarvärde</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/AddOTP.qml" line="128"/> <location filename="../qml/pages/AddOTP.qml" line="157"/>
<source>Next Value of the Counter</source> <source>Next Value of the Counter</source>
<translation>Nästa värde räknaren</translation> <translation>Nästa värde räknaren</translation>
</message> </message>
@ -229,62 +245,62 @@ Licens: BSD (3-clause)</translation>
<context> <context>
<name>MainView</name> <name>MainView</name>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="106"/> <location filename="../qml/pages/MainView.qml" line="96"/>
<source>About</source> <source>About</source>
<translation>Om</translation> <translation>Om</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="110"/> <location filename="../qml/pages/MainView.qml" line="100"/>
<source>Export / Import</source> <source>Export / Import</source>
<translation>Export / Import</translation> <translation>Export / Import</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="114"/> <location filename="../qml/pages/MainView.qml" line="104"/>
<source>Add Token</source> <source>Add Token</source>
<translation>Lägg till Token</translation> <translation>Lägg till Token</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="144"/> <location filename="../qml/pages/MainView.qml" line="134"/>
<source>Nothing here</source> <source>Nothing here</source>
<translation>Inget här</translation> <translation>Inget här</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="145"/> <location filename="../qml/pages/MainView.qml" line="135"/>
<source>Pull down to add a OTP</source> <source>Pull down to add a OTP</source>
<translation>Dra neråt för att lägga till en OTP</translation> <translation>Dra neråt för att lägga till en OTP</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="156"/> <location filename="../qml/pages/MainView.qml" line="146"/>
<source>Deleting</source> <source>Deleting</source>
<translation>Tar bort</translation> <translation>Tar bort</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="172"/> <location filename="../qml/pages/MainView.qml" line="162"/>
<source>Token for </source> <source>Token for </source>
<translation>Token för </translation> <translation>Token för </translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="172"/> <location filename="../qml/pages/MainView.qml" line="162"/>
<source> copied to clipboard</source> <source> copied to clipboard</source>
<translation>kopierad till urklipp</translation> <translation>kopierad till urklipp</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="240"/> <location filename="../qml/pages/MainView.qml" line="230"/>
<source>Move up</source> <source>Move up</source>
<translation>Flytta upp</translation> <translation>Flytta upp</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="245"/> <location filename="../qml/pages/MainView.qml" line="235"/>
<source>Move down</source> <source>Move down</source>
<translation>Flytta ner</translation> <translation>Flytta ner</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="250"/> <location filename="../qml/pages/MainView.qml" line="240"/>
<source>Edit</source> <source>Edit</source>
<translation>Redigera</translation> <translation>Redigera</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainView.qml" line="256"/> <location filename="../qml/pages/MainView.qml" line="246"/>
<source>Delete</source> <source>Delete</source>
<translation>Ta bort</translation> <translation>Ta bort</translation>
</message> </message>
@ -292,7 +308,7 @@ Licens: BSD (3-clause)</translation>
<context> <context>
<name>QRPage</name> <name>QRPage</name>
<message> <message>
<location filename="../qml/pages/QRPage.qml" line="73"/> <location filename="../qml/pages/QRPage.qml" line="74"/>
<source>Can&apos;t create QR-Code from incomplete settings!</source> <source>Can&apos;t create QR-Code from incomplete settings!</source>
<translation>Kan inte skapa QR-kod från ofullständiga inställningar!</translation> <translation>Kan inte skapa QR-kod från ofullständiga inställningar!</translation>
</message> </message>
@ -320,12 +336,12 @@ Licens: BSD (3-clause)</translation>
<translation>Skannar...</translation> <translation>Skannar...</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/ScanOTP.qml" line="97"/> <location filename="../qml/pages/ScanOTP.qml" line="101"/>
<source>No valid Token data found.</source> <source>No valid Token data found.</source>
<translation>Ingen giltig Token-data hittades.</translation> <translation>Ingen giltig Token-data hittades.</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/ScanOTP.qml" line="138"/> <location filename="../qml/pages/ScanOTP.qml" line="142"/>
<source>Tap the picture to start / stop scanning. Pull down to add Token manually.</source> <source>Tap the picture to start / stop scanning. Pull down to add Token manually.</source>
<translation>Tryck bilden för att starta / stoppa skanning. Dra neråt för att lägga till Token manuellt.</translation> <translation>Tryck bilden för att starta / stoppa skanning. Dra neråt för att lägga till Token manuellt.</translation>
</message> </message>

View file

@ -42,12 +42,14 @@ CoverBackground {
// get seconds from current Date // get seconds from current Date
var curDate = new Date(); var curDate = new Date();
if (lOTP.text == "------" || curDate.getSeconds() == 30 || curDate.getSeconds() == 0 || (curDate.getTime() - lastUpdated > 2000)) { var seconds = (curDate.getSeconds() + appWin.coverDiff) % 30
appWin.coverOTP = OTP.calcOTP(appWin.coverSecret, appWin.coverType, 0);
if (lOTP.text == "------" || seconds == 0 || (curDate.getTime() - lastUpdated > 2000)) {
appWin.coverOTP = OTP.calcOTP(appWin.coverSecret, appWin.coverType, appWin.coverLen, appWin.coverDiff, 0);
} }
// Change color of the OTP to red if less than 5 seconds left // Change color of the OTP to red if less than 5 seconds left
if (29 - (curDate.getSeconds() % 30) < 5) { if (29 - seconds < 5) {
lOTP.color = "red" lOTP.color = "red"
} else { } else {
lOTP.color = Theme.highlightColor lOTP.color = Theme.highlightColor
@ -101,7 +103,7 @@ CoverBackground {
iconSource: appWin.coverType == "HOTP" ? "image://theme/icon-cover-refresh" : "image://theme/icon-cover-previous" iconSource: appWin.coverType == "HOTP" ? "image://theme/icon-cover-refresh" : "image://theme/icon-cover-previous"
onTriggered: { onTriggered: {
if (appWin.coverType == "HOTP") { if (appWin.coverType == "HOTP") {
appWin.coverOTP = OTP.calcOTP(appWin.coverSecret, "HOTP", DB.getCounter(appWin.coverTitle, appWin.coverSecret, true)); appWin.coverOTP = OTP.calcOTP(appWin.coverSecret, "HOTP", appWin.CoverLen, 0, DB.getCounter(appWin.coverTitle, appWin.coverSecret, true));
} else { } else {
var index = appWin.coverIndex - 1 var index = appWin.coverIndex - 1
if (index < 0) index = appWin.listModel.count - 1 if (index < 0) index = appWin.listModel.count - 1

View file

@ -42,6 +42,8 @@ ApplicationWindow
property string coverSecret: "" property string coverSecret: ""
property string coverType: "" property string coverType: ""
property string coverOTP: "------" property string coverOTP: "------"
property int coverLen: 6
property int coverDiff: 0
property int coverIndex: 0 property int coverIndex: 0
// Global Listmodel for Tokens // Global Listmodel for Tokens
@ -51,8 +53,8 @@ ApplicationWindow
NotifyBanner { id: notify } NotifyBanner { id: notify }
// Add an entry to the list // Add an entry to the list
function appendOTP(title, secret, type, counter, fav) { function appendOTP(title, secret, type, counter, fav, len, diff) {
listModel.append({"secret": secret, "title": title, "fav": fav, "type": type, "counter": counter, "otp": "------"}); listModel.append({"secret": secret, "title": title, "fav": fav, "type": type, "counter": counter, "len": len, "diff": diff, "otp": "------"});
} }
// Set the OTP shown on the Cover // Set the OTP shown on the Cover
@ -61,6 +63,8 @@ ApplicationWindow
coverTitle = listModel.get(index).title; coverTitle = listModel.get(index).title;
coverSecret = listModel.get(index).secret; coverSecret = listModel.get(index).secret;
coverType = listModel.get(index).type; coverType = listModel.get(index).type;
coverLen = listModel.get(index).len;
coverDiff = listModel.get(index).diff;
coverIndex = index; coverIndex = index;
if (coverType == "TOTP") { coverOTP = "------"; } else { coverOTP = listModel.get(index).otp; } if (coverType == "TOTP") { coverOTP = "------"; } else { coverOTP = listModel.get(index).otp; }
for (var i=0; i<listModel.count; i++) { for (var i=0; i<listModel.count; i++) {

View file

@ -75,14 +75,16 @@ var steamChars = ['2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C',
// secret: The secret key in Base32-Notation // secret: The secret key in Base32-Notation
// tpye: either TOTP for timer based or HOTP for counter based calculation // tpye: either TOTP for timer based or HOTP for counter based calculation
// counter: counter value for HOTP // counter: counter value for HOTP
function calcOTP(secret, type, counter) { // length: length of the returned token
// diff: derivation of time between phone and server
function calcOTP(secret, type, len, diff, counter) {
// Convert the key to HEX // Convert the key to HEX
var key = base32tohex(secret); var key = base32tohex(secret);
var factor = ""; var factor = "";
if (type.substr(0, 4) == "TOTP") { if (type.substr(0, 4) == "TOTP") {
// Get current Time in UNIX Timestamp format (Seconds since 01.01.1970 00:00 UTC) // Get current Time in UNIX Timestamp format (Seconds since 01.01.1970 00:00 UTC), and add derivation value
var epoch = Math.round(new Date().getTime() / 1000.0); var epoch = Math.round(new Date().getTime() / 1000.0) + diff;
// Get last full 30 / 60 Seconds and convert to HEX // Get last full 30 / 60 Seconds and convert to HEX
factor = leftpad(dec2hex(Math.floor(epoch / 30)), 16, '0'); factor = leftpad(dec2hex(Math.floor(epoch / 30)), 16, '0');
} else { } else {
@ -108,7 +110,11 @@ function calcOTP(secret, type, counter) {
} }
} else { } else {
otp = code + ''; otp = code + '';
otp = (otp).substr(otp.length - 6, 6); otp = (otp).substr(otp.length - len, len);
// pad return code with 0 from the left
for (i=0; i++; otp.length < len) {
otp = "0" + otp;
}
} }
} catch (e) { } catch (e) {
otp = "Invalid Secret!" otp = "Invalid Secret!"

View file

@ -38,22 +38,33 @@ function getDB() {
// Initialize an empty DB, Create the Table // Initialize an empty DB, Create the Table
db.changeVersion("", "3", db.changeVersion("", "3",
function(tx) { function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS OTPStorage(title TEXT, secret TEXT, type TEXT DEFAULT 'TOPT', counter INTEGER DEFAULT 0, fav INTEGER DEFAULT 0, sort INTEGER DEFAULT 0);"); tx.executeSql("CREATE TABLE IF NOT EXISTS OTPStorage(title TEXT, secret TEXT, type TEXT DEFAULT 'TOPT', counter INTEGER DEFAULT 0, fav INTEGER DEFAULT 0, sort INTEGER DEFAULT 0, len INTEGER default 6, diff INTEGER default 0);");
}); });
} else if (db.version == "1.0") { } else if (db.version == "1.0") {
// Upgrade DB Schema to Version 3 // Upgrade DB Schema to Version 4
db.changeVersion("1.0", "3", db.changeVersion("1.0", "4",
function(tx) { function(tx) {
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN type TEXT DEFAULT 'TOTP';"); tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN type TEXT DEFAULT 'TOTP';");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN counter INTEGER DEFAULT 0;"); tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN counter INTEGER DEFAULT 0;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN fav INTEGER DEFAULT 0;"); tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN fav INTEGER DEFAULT 0;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN sort INTEGER DEFAULT 0;"); tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN sort INTEGER DEFAULT 0;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN len INTEGER DEFAULT 6;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN diff INTEGER DEFAULT 0;");
}); });
} else if (db.version == "2") { } else if (db.version == "2") {
// Upgrade DB Schema to Version 3 // Upgrade DB Schema to Version 3
db.changeVersion("2", "3", db.changeVersion("2", "4",
function(tx) { function(tx) {
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN sort INTEGER DEFAULT 0;"); tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN sort INTEGER DEFAULT 0;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN len INTEGER DEFAULT 6;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN diff INTEGER DEFAULT 0;");
});
} else if (db.version == "3") {
// Upgrade DB Schema to Version 4
db.changeVersion("3", "4",
function(tx) {
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN len INTEGER DEFAULT 6;");
tx.executeSql("ALTER TABLE OTPStorage ADD COLUMN diff INTEGER DEFAULT 0;");
}); });
} }
} catch (e) { } catch (e) {
@ -72,7 +83,7 @@ function getOTP() {
function(tx) { function(tx) {
var res = tx.executeSql("select * from OTPStorage order by sort;"); var res = tx.executeSql("select * from OTPStorage order by sort;");
for (var i=0; i < res.rows.length; i++) { for (var i=0; i < res.rows.length; i++) {
appWin.appendOTP(res.rows.item(i).title, res.rows.item(i).secret, res.rows.item(i).type, res.rows.item(i).counter, res.rows.item(i).fav, res.rows.item(i).sort); appWin.appendOTP(res.rows.item(i).title, res.rows.item(i).secret, res.rows.item(i).type, res.rows.item(i).counter, res.rows.item(i).fav, res.rows.item(i).len, res.rows.item(i).diff);
if (res.rows.item(i).fav) appWin.setCover(i); if (res.rows.item(i).fav) appWin.setCover(i);
} }
}); });
@ -93,12 +104,14 @@ function db2json() {
"type": res.rows.item(i).type, "type": res.rows.item(i).type,
"counter": res.rows.item(i).counter, "counter": res.rows.item(i).counter,
"sort": res.rows.item(i).sort, "sort": res.rows.item(i).sort,
"len": res.rows.item(i).len,
"diff": res.rows.item(i).diff,
}); });
} }
}); });
if (otpList.length > 0) { if (otpList.length > 0) {
return(JSON.stringify({"app": "sailotp", "version": 2, "otplist": otpList})); return(JSON.stringify({"app": "sailotp", "version": 3, "otplist": otpList}));
} else { } else {
return("") return("")
} }
@ -109,7 +122,7 @@ function json2db(jsonString, error) {
var json = JSON.parse(jsonString); var json = JSON.parse(jsonString);
error = ""; error = "";
if ((json.version != "1" || json.version != "2") && json.app != "sailotp" ) { if ((json.version != "1" || json.version != "2" || json.version != "3") && json.app != "sailotp" ) {
error = "Unrecognized format, file is not a SailOTP export"; error = "Unrecognized format, file is not a SailOTP export";
return(false); return(false);
} else { } else {
@ -120,9 +133,11 @@ function json2db(jsonString, error) {
var otpItem = otpList.shift(); var otpItem = otpList.shift();
if (otpItem.title != "" & otpItem.secret.length >= 16) { if (otpItem.title != "" & otpItem.secret.length >= 16) {
if (json.version == "1") { if (json.version == "1") {
addOTP(otpItem.title, otpItem.secret, otpItem.type, otpItem.counter, 0); addOTP(otpItem.title, otpItem.secret, otpItem.type, otpItem.counter, 0, 6, 0);
} else if (json.version == "2") {
addOTP(otpItem.title, otpItem.secret, otpItem.type, otpItem.counter, otpItem.sort, 6, 0);
} else { } else {
addOTP(otpItem.title, otpItem.secret, otpItem.type, otpItem.counter, otpItem.sort); addOTP(otpItem.title, otpItem.secret, otpItem.type, otpItem.counter, otpItem.sort, otpItem.len, otpItem.diff);
} }
} }
} }
@ -136,7 +151,7 @@ function json2db(jsonString, error) {
} }
// Add a new OTP // Add a new OTP
function addOTP(title, secret, type, counter, sort) { function addOTP(title, secret, type, counter, sort, len, diff) {
var db = getDB(); var db = getDB();
db.transaction( db.transaction(
@ -144,7 +159,7 @@ function addOTP(title, secret, type, counter, sort) {
if (checkOTP(title, secret)) { if (checkOTP(title, secret)) {
console.log("Token " + title + " is already in DB"); console.log("Token " + title + " is already in DB");
} else { } else {
tx.executeSql("INSERT INTO OTPStorage VALUES(?, ?, ?, ?, ?, ?);", [title, secret, type, counter, 0, sort]); tx.executeSql("INSERT INTO OTPStorage VALUES(?, ?, ?, ?, ?, ?, ?, ?);", [title, secret, type, counter, 0, sort, len, diff]);
console.log("Token " + title + " added."); console.log("Token " + title + " added.");
} }
}); });
@ -195,12 +210,12 @@ function resetFav(title, secret) {
} }
// Change an existing OTP // Change an existing OTP
function changeOTP(title, secret, type, counter, oldtitle, oldsecret) { function changeOTP(title, secret, type, counter, len, diff, oldtitle, oldsecret) {
var db = getDB(); var db = getDB();
db.transaction( db.transaction(
function(tx) { function(tx) {
tx.executeSql("UPDATE OTPStorage SET title=?, secret=?, type=?, counter=? WHERE title=? and secret=?;", [title, secret, type, counter, oldtitle, oldsecret]); tx.executeSql("UPDATE OTPStorage SET title=?, secret=?, type=?, counter=?, len=?, diff=? WHERE title=? and secret=?;", [title, secret, type, counter, len, diff, oldtitle, oldsecret]);
console.log("Token " + title + " modified."); console.log("Token " + title + " modified.");
} }
); );

View file

@ -15,6 +15,7 @@ function decode(url) {
var tmp = pstr.split("="); var tmp = pstr.split("=");
if (tmp[0] == "secret") ret.secret = tmp[1]; if (tmp[0] == "secret") ret.secret = tmp[1];
if (tmp[0] == "counter") ret.counter = tmp[1]; if (tmp[0] == "counter") ret.counter = tmp[1];
if (tmp[0] == "digits") ret.digits = tmp[1];
} }
return ret; return ret;

View file

@ -45,6 +45,8 @@ Dialog {
property string paramType: "TOTP" property string paramType: "TOTP"
property string paramLabel: "" property string paramLabel: ""
property string paramKey: "" property string paramKey: ""
property int paramLen: 6
property int paramDiff: 0
property int paramCounter: 1 // New Counters start at 1 property int paramCounter: 1 // New Counters start at 1
property bool paramNew: false property bool paramNew: false
@ -59,8 +61,7 @@ Dialog {
SilicaFlickable { SilicaFlickable {
id: addOtpList id: addOtpList
anchors.fill: parent anchors.fill: parent
contentHeight: dialog.height
PullDownMenu { PullDownMenu {
visible: checkQR() visible: checkQR()
@ -70,7 +71,7 @@ Dialog {
if (((paramType == "TOTP" || paramType == "TOTP_STEAM") && (otpLabel.text == "" || otpSecret.text == "")) || (paramType == "HOTP" && (otpLabel.text == "" || otpSecret.text == "" || otpCounter.text <= 0))) { if (((paramType == "TOTP" || paramType == "TOTP_STEAM") && (otpLabel.text == "" || otpSecret.text == "")) || (paramType == "HOTP" && (otpLabel.text == "" || otpSecret.text == "" || otpCounter.text <= 0))) {
notify.show(qsTr("Can't create QR-Code from incomplete settings!"), 4000); notify.show(qsTr("Can't create QR-Code from incomplete settings!"), 4000);
} else { } else {
pageStack.push(Qt.resolvedUrl("QRPage.qml"), {paramLabel: otpLabel.text, paramKey: otpSecret.text, paramType: paramType, paramCounter: otpCounter.text}); pageStack.push(Qt.resolvedUrl("QRPage.qml"), {paramLabel: otpLabel.text, paramKey: otpSecret.text, paramType: paramType, paramCounter: otpCounter.text, paramLen: otpLen.text});
} }
} }
} }
@ -79,7 +80,8 @@ Dialog {
VerticalScrollDecorator {} VerticalScrollDecorator {}
Column { Column {
anchors.fill: parent id: dialog
width: parent.width
DialogHeader { DialogHeader {
acceptText: paramNew ? qsTr("Add") : qsTr("Save") acceptText: paramNew ? qsTr("Add") : qsTr("Save")
} }
@ -116,8 +118,35 @@ Dialog {
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
EnterKey.enabled: text.length > 15 EnterKey.enabled: text.length > 15
EnterKey.iconSource: paramType == "HOTP" ? "image://theme/icon-m-enter-next" : "image://theme/icon-m-enter-accept" EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: paramType == "HOTP" ? otpCounter.focus = true : addOTP.accept() EnterKey.onClicked: otpLen.focus = true
}
TextField {
id: otpLen
width: parent.width
label: qsTr("Length")
text: paramLen
placeholderText: qsTr("Length of the Token")
focus: true
horizontalAlignment: TextInput.AlignLeft
validator: IntValidator { bottom: 1 }
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: paramType == "HOTP" ? otpCounter.focus = true : otpDiff.focus = true
}
TextField {
id: otpDiff
width: parent.width
visible: paramType == "TOTP" ? true : false
label: qsTr("Time Derivation (Seconds)")
text: paramDiff
placeholderText: qsTr("Time Derivation (Seconds)")
focus: true
horizontalAlignment: TextInput.AlignLeft
validator: IntValidator {}
EnterKey.iconSource: "image://theme/icon-m-enter-accept"
EnterKey.onClicked: addOTP.accept()
} }
TextField { TextField {
id: otpCounter id: otpCounter
@ -138,7 +167,7 @@ Dialog {
} }
// Check if we can Save // Check if we can Save
canAccept: otpLabel.text.length > 0 && otpSecret.text.length >= 16 && (paramType == "TOTP" || paramType == "TOTP_STEAM" || otpCounter.text.length > 0) ? true : false canAccept: otpLabel.text.length > 0 && otpSecret.text.length >= 16 && otpLen.text >= 1 && ((paramType == "TOTP" && otpDiff.text != "") || paramType == "TOTP_STEAM" || otpCounter.text.length > 0) ? true : false
// Save if page is Left with Add // Save if page is Left with Add
onDone: { onDone: {
@ -146,10 +175,10 @@ Dialog {
// Save the entry to the Config DB // Save the entry to the Config DB
if (paramLabel != "" && paramKey != "" && !paramNew) { if (paramLabel != "" && paramKey != "" && !paramNew) {
// Parameters where filled -> Change existing entry // Parameters where filled -> Change existing entry
DB.changeOTP(otpLabel.text, otpSecret.text, paramType, otpCounter.text, paramLabel, paramKey) DB.changeOTP(otpLabel.text, otpSecret.text, paramType, otpCounter.text, otpLen.text, otpDiff.text, paramLabel, paramKey)
} else { } else {
// There were no parameters -> Add new entry // There were no parameters -> Add new entry
DB.addOTP(otpLabel.text, otpSecret.text, paramType, otpCounter.text, appWin.listModel.count); DB.addOTP(otpLabel.text, otpSecret.text, paramType, otpCounter.text, appWin.listModel.count, otpLen.text, otpDiff.text);
} }
// Refresh the main Page // Refresh the main Page

View file

@ -41,18 +41,6 @@ Page {
// This holds the time of the last update of the page as Unix Timestamp (in Milliseconds) // This holds the time of the last update of the page as Unix Timestamp (in Milliseconds)
property double lastUpdated: 0 property double lastUpdated: 0
// Hand favorite over to the cover
function setCoverOTP(title, secret, type) {
appWin.coverTitle = title
appWin.coverSecret = secret
appWin.coverType = type
if (secret == "") {
appWin.coverOTP = "";
} else if (type == "HOTP") {
appWin.coverOTP = "------";
}
}
// Reload the List of OTPs from storage // Reload the List of OTPs from storage
function refreshOTPList() { function refreshOTPList() {
otpList.visible = false; otpList.visible = false;
@ -68,14 +56,16 @@ Page {
function refreshOTPValues() { function refreshOTPValues() {
// get seconds from current Date // get seconds from current Date
var curDate = new Date(); var curDate = new Date();
var seconds = curDate.getSeconds(); var seconds_global = curDate.getSeconds() % 30
// Iterate over all List entries // Iterate over all List entries
for (var i=0; i<appWin.listModel.count; i++) { for (var i=0; i<appWin.listModel.count; i++) {
if (appWin.listModel.get(i).type == "TOTP" || appWin.listModel.get(i).type == "TOTP_STEAM" ) { if (appWin.listModel.get(i).type == "TOTP" || appWin.listModel.get(i).type == "TOTP_STEAM" ) {
// Take derivation into account if set
var seconds = (curDate.getSeconds() + appWin.listModel.get(i).diff) % 30;
// Only update on full 30 / 60 Seconds or if last run of the Functions is more than 2s in the past (e.g. app was in background) // Only update on full 30 / 60 Seconds or if last run of the Functions is more than 2s in the past (e.g. app was in background)
if (appWin.listModel.get(i).otp == "------" || seconds == 30 || seconds == 0 || (curDate.getTime() - lastUpdated > 2000)) { if (appWin.listModel.get(i).otp == "------" || seconds == 0 || (curDate.getTime() - lastUpdated > 2000)) {
var curOTP = OTP.calcOTP(appWin.listModel.get(i).secret, appWin.listModel.get(i).type) var curOTP = OTP.calcOTP(appWin.listModel.get(i).secret, appWin.listModel.get(i).type, appWin.listModel.get(i).len, appWin.listModel.get(i).diff, 0)
appWin.listModel.setProperty(i, "otp", curOTP); appWin.listModel.setProperty(i, "otp", curOTP);
} }
} else if (appWin.coverType == "HOTP" && (curDate.getTime() - lastUpdated > 2000) && appWin.listModel.get(i).fav == 1) { } else if (appWin.coverType == "HOTP" && (curDate.getTime() - lastUpdated > 2000) && appWin.listModel.get(i).fav == 1) {
@ -85,7 +75,7 @@ Page {
} }
// Update the Progressbar // Update the Progressbar
updateProgress.value = 29 - (seconds % 30) updateProgress.value = 29 - seconds_global
// Set lastUpdate property // Set lastUpdate property
lastUpdated = curDate.getTime(); lastUpdated = curDate.getTime();
} }
@ -228,7 +218,7 @@ Page {
visible: type == "HOTP" ? true : false visible: type == "HOTP" ? true : false
onClicked: { onClicked: {
appWin.listModel.setProperty(index, "counter", DB.getCounter(title, secret, true)); appWin.listModel.setProperty(index, "counter", DB.getCounter(title, secret, true));
appWin.listModel.setProperty(index, "otp", OTP.calcOTP(secret, "HOTP", counter)); appWin.listModel.setProperty(index, "otp", OTP.calcOTP(secret, "HOTP", len, 0, counter));
if (fav == 1) appWin.coverOTP = otp; if (fav == 1) appWin.coverOTP = otp;
} }
} }
@ -249,7 +239,7 @@ Page {
MenuItem { MenuItem {
text: qsTr("Edit") text: qsTr("Edit")
onClicked: { onClicked: {
pageStack.push(Qt.resolvedUrl("AddOTP.qml"), {parentPage: mainPage, paramLabel: title, paramKey: secret, paramType: type, paramCounter: DB.getCounter(title, secret, false)}) pageStack.push(Qt.resolvedUrl("AddOTP.qml"), {parentPage: mainPage, paramLabel: title, paramKey: secret, paramType: type, paramLen: len, paramDiff: diff, paramCounter: DB.getCounter(title, secret, false)})
} }
} }
MenuItem { MenuItem {

View file

@ -38,6 +38,7 @@ Page {
property string paramType: "" property string paramType: ""
property string paramLabel: "" property string paramLabel: ""
property string paramKey: "" property string paramKey: ""
property int paramLen: 6
property int paramCounter: 0 property int paramCounter: 0
Label { Label {
@ -61,11 +62,11 @@ Page {
var otpurl = ""; var otpurl = "";
if (paramType == "TOTP") { if (paramType == "TOTP") {
if (paramLabel != "" && paramKey != "") if (paramLabel != "" && paramKey != "")
otpurl = "otpauth://totp/"+paramLabel+"?secret="+paramKey; otpurl = "otpauth://totp/"+paramLabel+"?secret="+paramKey+"&digits="+paramLen;
} else if (paramType == "HOTP") { } else if (paramType == "HOTP") {
if (paramLabel != "" && paramKey != "" && paramCounter > 0) if (paramLabel != "" && paramKey != "" && paramCounter > 0)
otpurl = "otpauth://hotp/"+paramLabel+"?secret="+paramKey+"&counter="+paramCounter; otpurl = "otpauth://hotp/"+paramLabel+"?secret="+paramKey+"&counter="+paramCounter+"&digits="+paramLen;
} }
if (otpurl != "") { if (otpurl != "") {
qrImage.source = "image://qqrencoder/"+otpurl; qrImage.source = "image://qqrencoder/"+otpurl;

View file

@ -90,9 +90,13 @@ Page {
onTagFound: { onTagFound: {
var ret = URL.decode(tag); var ret = URL.decode(tag);
var len = 6
scanning = false scanning = false
if (ret && ret.type != "" && ret.title != "" && ret.secret != "" && (ret.counter != "" || ret.type == "TOTP")) { if (ret && ret.type != "" && ret.title != "" && ret.secret != "" && (ret.counter != "" || ret.type == "TOTP")) {
pageStack.replace(Qt.resolvedUrl("AddOTP.qml"), {parentPage: parentPage, paramLabel: ret.title, paramKey: ret.secret, paramType: ret.type, paramCounter: ret.counter, paramNew: true}) if (ret.digits != "") {
len = ret.digits
}
pageStack.replace(Qt.resolvedUrl("AddOTP.qml"), {parentPage: parentPage, paramLabel: ret.title, paramKey: ret.secret, paramType: ret.type, paramCounter: ret.counter, paramLen: len, paramNew: true})
} else { } else {
notify.show(qsTr("No valid Token data found."), 3000); notify.show(qsTr("No valid Token data found."), 3000);
} }

View file

@ -1,3 +1,7 @@
* Thu Jul 14 2016 Stefan Brand <sailfish@seiichiro0185.org> 1.4-1
- Added Setting for Time Derivation
- Added Setting for Token Length
* Sun Dec 06 2015 Stefan Brand <sailfish@seiichiro0185.org> 1.3-1 * Sun Dec 06 2015 Stefan Brand <sailfish@seiichiro0185.org> 1.3-1
- Added SteamGuard OTP Type (Thanks to Robin Appelman) - Added SteamGuard OTP Type (Thanks to Robin Appelman)

View file

@ -1,6 +1,6 @@
Name: harbour-sailotp Name: harbour-sailotp
Summary: SailOTP Summary: SailOTP
Version: 1.3 Version: 1.4
Release: 1 Release: 1
Group: Security Group: Security
URL: https://github.com/seiichiro0185/sailotp/ URL: https://github.com/seiichiro0185/sailotp/