Skip to content

Commit 675a1d9

Browse files
committed
convert error otp type
1 parent fea1d0c commit 675a1d9

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/components/Popup/BackupPage.vue

+16-2
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,25 @@ function getOneLineOtpBackupFile(entryData: { [hash: string]: RawOTPStorage }) {
212212
? otpStorage.issuer + ":" + (otpStorage.account || "")
213213
: otpStorage.account || "";
214214
let type = "";
215-
if (otpStorage.type === OTPType.totp || otpStorage.type === OTPType.hex) {
215+
// We may have already have some error OTP type entries in the storage
216+
// totp = 1
217+
// hotp = 2
218+
// battle = 3
219+
// steam = 4
220+
// hex = 5
221+
// hhex = 6
222+
if (
223+
otpStorage.type === OTPType.totp ||
224+
otpStorage.type === OTPType.hex ||
225+
(otpStorage.type as unknown) === 1 ||
226+
(otpStorage.type as unknown) === 5
227+
) {
216228
type = OTPType.totp;
217229
} else if (
218230
otpStorage.type === OTPType.hotp ||
219-
otpStorage.type === OTPType.hhex
231+
otpStorage.type === OTPType.hhex ||
232+
(otpStorage.type as unknown) === 2 ||
233+
(otpStorage.type as unknown) === 6
220234
) {
221235
type = OTPType.hotp;
222236
} else {

src/definitions/module-interface.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ interface AccountsState {
6262
entries: OTPEntryInterface[];
6363
defaultEncryption: string;
6464
encryption: Map<string, EncryptionInterface>;
65-
OTPType: number;
65+
OTPType: OTPType;
6666
shouldShowPassphrase: boolean;
6767
sectorStart: boolean;
6868
sectorOffset: number;

0 commit comments

Comments
 (0)