1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

Add import of totp from Lastpass (#361)

* Add import of totp from Lastpass

* Fixed import as request during review
This commit is contained in:
Daniel James Smith
2021-04-28 22:50:37 +02:00
committed by GitHub
parent 5b7d918f29
commit e298ecfee3
2 changed files with 33 additions and 2 deletions

View File

@@ -1,9 +1,27 @@
import { LastPassCsvImporter as Importer } from '../../../src/importers/lastpassCsvImporter';
import { ImportResult } from '../../../src/models/domain/importResult';
import { CipherView } from '../../../src/models/view/cipherView';
import { FieldView } from '../../../src/models/view/fieldView';
import { FieldType } from '../../../src/enums';
import { CipherType, FieldType } from '../../../src/enums';
function baseExcept(result: ImportResult) {
expect(result).not.toBeNull();
expect(result.success).toBe(true);
expect(result.ciphers.length).toBe(1);
}
function expectLogin(cipher: CipherView) {
expect(cipher.type).toBe(CipherType.Login);
expect(cipher.name).toBe('example.com');
expect(cipher.notes).toBe('super secure notes');
expect(cipher.login.uri).toBe('http://example.com');
expect(cipher.login.username).toBe('someUser');
expect(cipher.login.password).toBe('myPassword');
expect(cipher.login.totp).toBe('Y64VEVMBTSXCYIWRSHRNDZW62MPGVU2G');
}
const CipherData = [
{
@@ -168,4 +186,16 @@ describe('Lastpass CSV Importer', () => {
}
});
});
});
it('should parse login with totp', async () => {
const input = `url,username,password,totp,extra,name,grouping,fav
http://example.com,someUser,myPassword,Y64VEVMBTSXCYIWRSHRNDZW62MPGVU2G,super secure notes,example.com,,0`;
const importer = new Importer();
const result = await importer.parse(input);
baseExcept(result);
const cipher = result.ciphers[0];
expectLogin(cipher);
});
});