Skip to content

Commit

Permalink
convert error otp type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneezry committed Sep 11, 2024
1 parent fea1d0c commit 675a1d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions src/components/Popup/BackupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,25 @@ function getOneLineOtpBackupFile(entryData: { [hash: string]: RawOTPStorage }) {
? otpStorage.issuer + ":" + (otpStorage.account || "")
: otpStorage.account || "";
let type = "";
if (otpStorage.type === OTPType.totp || otpStorage.type === OTPType.hex) {
// We may have already have some error OTP type entries in the storage
// totp = 1
// hotp = 2
// battle = 3
// steam = 4
// hex = 5
// hhex = 6
if (
otpStorage.type === OTPType.totp ||
otpStorage.type === OTPType.hex ||
(otpStorage.type as unknown) === 1 ||
(otpStorage.type as unknown) === 5
) {
type = OTPType.totp;
} else if (
otpStorage.type === OTPType.hotp ||
otpStorage.type === OTPType.hhex
otpStorage.type === OTPType.hhex ||
(otpStorage.type as unknown) === 2 ||
(otpStorage.type as unknown) === 6
) {
type = OTPType.hotp;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/module-interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface AccountsState {
entries: OTPEntryInterface[];
defaultEncryption: string;
encryption: Map<string, EncryptionInterface>;
OTPType: number;
OTPType: OTPType;
shouldShowPassphrase: boolean;
sectorStart: boolean;
sectorOffset: number;
Expand Down

0 comments on commit 675a1d9

Please sign in to comment.