Skip to content

Commit 8115026

Browse files
committed
remove unnecessary fields backupGetExport
1 parent 3ad95d5 commit 8115026

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/models/storage.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,34 @@ export class EntryStorage {
304304
delete _data[hash];
305305
continue;
306306
}
307+
// remove unnecessary fields
308+
if (
309+
!(_data[hash].type === OTPType[OTPType.hotp]) &&
310+
!(_data[hash].type === OTPType[OTPType.hhex])
311+
) {
312+
delete _data[hash].counter;
313+
}
314+
315+
if (_data[hash].period === 30) {
316+
delete _data[hash].period;
317+
}
318+
319+
if (!_data[hash].issuer) {
320+
delete _data[hash].issuer;
321+
}
322+
323+
if (!_data[hash].account) {
324+
delete _data[hash].account;
325+
}
326+
327+
if (_data[hash].digits === 6) {
328+
delete _data[hash].digits;
329+
}
330+
331+
if (_data[hash].algorithm === OTPAlgorithm[OTPAlgorithm.SHA1]) {
332+
delete _data[hash].algorithm;
333+
}
334+
307335
if (!encrypted) {
308336
// decrypt the data to export
309337
if (_data[hash].encrypted) {

0 commit comments

Comments
 (0)