@@ -222,7 +222,7 @@ export class EntryStorage {
222
222
encrypted,
223
223
hash : entry . hash ,
224
224
index : entry . index ,
225
- type : OTPType [ entry . type ] ,
225
+ type : entry . type ,
226
226
secret,
227
227
} ;
228
228
@@ -392,10 +392,7 @@ export class EntryStorage {
392
392
}
393
393
394
394
// remove unnecessary fields
395
- if (
396
- ! ( entry . type === OTPType [ OTPType . hotp ] ) &&
397
- ! ( entry . type === OTPType [ OTPType . hhex ] )
398
- ) {
395
+ if ( ! ( entry . type === OTPType . hotp ) && ! ( entry . type === OTPType . hhex ) ) {
399
396
delete entry . counter ;
400
397
}
401
398
@@ -478,7 +475,7 @@ export class EntryStorage {
478
475
algorithm : OTPAlgorithm ;
479
476
pinned : boolean ;
480
477
} = {
481
- type : ( parseInt ( data [ hash ] . type ) as OTPType ) || OTPType [ OTPType . totp ] ,
478
+ type : data [ hash ] . type || OTPType . totp ,
482
479
index : data [ hash ] . index || 0 ,
483
480
issuer : data [ hash ] . issuer || "" ,
484
481
account : data [ hash ] . account || "" ,
@@ -617,29 +614,29 @@ export class EntryStorage {
617
614
}
618
615
619
616
if ( ! entryData . type ) {
620
- entryData . type = OTPType [ OTPType . totp ] ;
617
+ entryData . type = OTPType . totp ;
621
618
}
622
619
623
620
let type : OTPType ;
624
621
switch ( entryData . type ) {
625
- case " totp" :
626
- case " hotp" :
627
- case " battle" :
628
- case " steam" :
629
- case " hex" :
630
- case " hhex" :
631
- type = OTPType [ entryData . type ] ;
622
+ case OTPType . totp :
623
+ case OTPType . hotp :
624
+ case OTPType . battle :
625
+ case OTPType . steam :
626
+ case OTPType . hex :
627
+ case OTPType . hhex :
628
+ type = entryData . type ;
632
629
break ;
633
630
default :
634
631
// we need correct the type here
635
632
// and save it
636
633
type = OTPType . totp ;
637
- entryData . type = OTPType [ OTPType . totp ] ;
634
+ entryData . type = OTPType . totp ;
638
635
}
639
636
640
637
let period : number | undefined ;
641
638
if (
642
- entryData . type === OTPType [ OTPType . totp ] &&
639
+ entryData . type === OTPType . totp &&
643
640
entryData . period &&
644
641
entryData . period > 0
645
642
) {
0 commit comments