@@ -222,7 +222,7 @@ export class EntryStorage {
222222 encrypted,
223223 hash: entry.hash,
224224 index: entry.index,
225- type: OTPType[ entry.type] ,
225+ type: entry.type,
226226 secret,
227227 };
228228
@@ -392,10 +392,7 @@ export class EntryStorage {
392392 }
393393
394394 // 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)) {
399396 delete entry.counter;
400397 }
401398
@@ -478,7 +475,7 @@ export class EntryStorage {
478475 algorithm: OTPAlgorithm;
479476 pinned: boolean;
480477 } = {
481- type: (parseInt( data[hash].type) as OTPType) || OTPType[OTPType .totp] ,
478+ type: data[hash].type || OTPType.totp,
482479 index: data[hash].index || 0,
483480 issuer: data[hash].issuer || "",
484481 account: data[hash].account || "",
@@ -617,29 +614,29 @@ export class EntryStorage {
617614 }
618615
619616 if (!entryData.type) {
620- entryData.type = OTPType[OTPType .totp] ;
617+ entryData.type = OTPType.totp;
621618 }
622619
623620 let type: OTPType;
624621 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;
632629 break;
633630 default:
634631 // we need correct the type here
635632 // and save it
636633 type = OTPType.totp;
637- entryData.type = OTPType[OTPType .totp] ;
634+ entryData.type = OTPType.totp;
638635 }
639636
640637 let period: number | undefined;
641638 if (
642- entryData.type === OTPType[OTPType .totp] &&
639+ entryData.type === OTPType.totp &&
643640 entryData.period &&
644641 entryData.period > 0
645642 ) {
0 commit comments