From 29ffc8bfbc1e188db46ef5b1a38f9d6c42b1aa91 Mon Sep 17 00:00:00 2001 From: luckyrat Date: Mon, 4 Mar 2024 11:20:41 +0000 Subject: [PATCH] Ensure we always have a display name for custom fields --- .../browser_entry_settings_v1.dart | 15 +++++---- lib/src/kee_vault_model/field.dart | 4 +++ lib/src/utils/guid_service.dart | 12 +++++-- test/browser_entry_settings_test.dart | 32 ++++++++++++------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/lib/src/kee_vault_model/browser_entry_settings_v1.dart b/lib/src/kee_vault_model/browser_entry_settings_v1.dart index 2416104..57849f4 100644 --- a/lib/src/kee_vault_model/browser_entry_settings_v1.dart +++ b/lib/src/kee_vault_model/browser_entry_settings_v1.dart @@ -341,7 +341,7 @@ class BrowserEntrySettingsV1 { final f = Field( valuePath: 'UserName', page: max(ff.page, 1), - uuid: guidService.newGuid(), + uuid: guidService.newGuidAsBase64(), type: FieldType.Text, matcherConfigs: [mc], ); @@ -364,7 +364,7 @@ class BrowserEntrySettingsV1 { final f = Field( valuePath: 'Password', page: max(ff.page, 1), - uuid: guidService.newGuid(), + uuid: guidService.newGuidAsBase64(), type: FieldType.Password, matcherConfigs: [mc]); if (ff.placeholderHandling != PlaceholderHandling.Default.name) { @@ -378,11 +378,14 @@ class BrowserEntrySettingsV1 { id: ff.fieldId, name: ff.name, ); + final newUniqueId = guidService.newGuidAsBase64(); final f = Field( - name: ff.displayName, + name: (ff.displayName?.isNotEmpty ?? false) + ? ff.displayName + : newUniqueId, valuePath: '.', page: max(ff.page, 1), - uuid: guidService.newGuid(), + uuid: newUniqueId, type: Utilities.formFieldTypeToFieldType( ff.type ?? FormFieldType.TEXT), matcherConfigs: [mc], @@ -398,7 +401,7 @@ class BrowserEntrySettingsV1 { if (!usernameFound) { fields.add(Field( valuePath: 'UserName', - uuid: guidService.newGuid(), + uuid: guidService.newGuidAsBase64(), type: FieldType.Text, matcherConfigs: [ FieldMatcherConfig( @@ -408,7 +411,7 @@ class BrowserEntrySettingsV1 { if (!passwordFound) { fields.add(Field( valuePath: 'Password', - uuid: guidService.newGuid(), + uuid: guidService.newGuidAsBase64(), type: FieldType.Password, matcherConfigs: [ FieldMatcherConfig( diff --git a/lib/src/kee_vault_model/field.dart b/lib/src/kee_vault_model/field.dart index 8be53fe..41da765 100644 --- a/lib/src/kee_vault_model/field.dart +++ b/lib/src/kee_vault_model/field.dart @@ -156,6 +156,10 @@ class Field { ffValue = '{USERNAME}'; } + if (displayName?.isEmpty ?? true) { + displayName = uuid; + } + if (ffValue != '') { return BrowserFieldModelV1( name: htmlName, diff --git a/lib/src/utils/guid_service.dart b/lib/src/utils/guid_service.dart index 4e54d6d..b12470e 100644 --- a/lib/src/utils/guid_service.dart +++ b/lib/src/utils/guid_service.dart @@ -1,12 +1,18 @@ +import 'dart:typed_data'; + +import 'package:kdbx/src/utils/byte_utils.dart'; import 'package:uuid/uuid.dart'; abstract class IGuidService { - String newGuid(); + //String newGuid(); + String newGuidAsBase64(); } class GuidService implements IGuidService { @override - String newGuid() { - return const Uuid().v4(); + String newGuidAsBase64() { + final buf = Uint8List(16); + const Uuid().v4buffer(buf); + return buf.encodeBase64(); } } diff --git a/test/browser_entry_settings_test.dart b/test/browser_entry_settings_test.dart index 17ef271..b1dfcfa 100644 --- a/test/browser_entry_settings_test.dart +++ b/test/browser_entry_settings_test.dart @@ -13,8 +13,8 @@ final _logger = Logger('browser_entry_settings_test'); class MockGuidService implements IGuidService { @override - String newGuid() { - return '00000000-0000-0000-0000-000000000000'; + String newGuidAsBase64() { + return 'AAAAAAAAAAAAAAAAAAAAAA=='; } } @@ -57,45 +57,53 @@ void main() { group('BrowserEntrySettings', () { test('config v2->v1', () async { testCase( - '{"version":2,"altUrls":[],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"},{"matcherType":"Hide"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', + '{"version":2,"altUrls":[],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"},{"matcherType":"Hide"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', '{"version":1,"priority":0,"hide":true,"hTTPRealm":"","formFieldList":[{"displayName":"KeePass password","name":"password","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default","value":"{PASSWORD}"},{"displayName":"KeePass username","name":"username","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default","value":"{USERNAME}"}],"alwaysAutoFill":false,"alwaysAutoSubmit":false,"neverAutoFill":false,"neverAutoSubmit":false,"blockDomainOnlyMatch":false,"blockHostnameOnlyMatch":false,"altURLs":[],"regExURLs":[],"blockedURLs":[],"regExBlockedURLs":[]}'); testCase( - '{"version":2,"altUrls":[],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', + '{"version":2,"altUrls":[],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', '{"version":1,"priority":0,"hide":false,"hTTPRealm":"","formFieldList":[{"displayName":"KeePass password","name":"password","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default","value":"{PASSWORD}"},{"displayName":"KeePass username","name":"username","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default","value":"{USERNAME}"}],"alwaysAutoFill":false,"alwaysAutoSubmit":false,"neverAutoFill":false,"neverAutoSubmit":false,"blockDomainOnlyMatch":false,"blockHostnameOnlyMatch":false,"altURLs":[],"regExURLs":[],"blockedURLs":[],"regExBlockedURLs":[]}'); testCase( - '{"version":2,"altUrls":[],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', + '{"version":2,"altUrls":[],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', '{"version":1,"priority":0,"hide":false,"hTTPRealm":"","formFieldList":[{"displayName":"KeePass password","name":"password","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default","value":"{PASSWORD}"},{"displayName":"KeePass username","name":"username","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default","value":"{USERNAME}"}],"alwaysAutoFill":false,"alwaysAutoSubmit":false,"neverAutoFill":false,"neverAutoSubmit":false,"blockDomainOnlyMatch":false,"blockHostnameOnlyMatch":false,"altURLs":[],"regExURLs":[],"blockedURLs":[],"regExBlockedURLs":[]}'); testCase( - '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"matcherType":"UsernameDefaultHeuristic"}]},{"page":-1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"matcherType":"PasswordDefaultHeuristic"}]}]}', + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"matcherType":"UsernameDefaultHeuristic"}]},{"page":-1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"matcherType":"PasswordDefaultHeuristic"}]}]}', '{"version":1,"priority":0,"hide":false,"hTTPRealm":"","formFieldList":[{"displayName":"KeePass username","name":"","type":"FFTusername","id":"","page":-1,"placeholderHandling":"Default","value":"{USERNAME}"},{"displayName":"KeePass password","name":"","type":"FFTpassword","id":"","page":-1,"placeholderHandling":"Default","value":"{PASSWORD}"}],"alwaysAutoFill":false,"alwaysAutoSubmit":false,"neverAutoFill":false,"neverAutoSubmit":false,"blockDomainOnlyMatch":false,"blockHostnameOnlyMatch":false,"altURLs":[],"regExURLs":[],"blockedURLs":[],"regExBlockedURLs":[]}'); testCase( - '{"version":2,"altUrls":["http://test.com/1","http://test.com/2"],"regExUrls":["3","4"],"blockedUrls":["5","6"],"regExBlockedUrls":["7","8"],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', + '{"version":2,"altUrls":["http://test.com/1","http://test.com/2"],"regExUrls":["3","4"],"blockedUrls":["5","6"],"regExBlockedUrls":["7","8"],"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":-1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"],"queries":[]}}]},{"page":-1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"],"queries":[]}}]}]}', '{"version":1,"priority":0,"hide":false,"hTTPRealm":"","formFieldList":[{"displayName":"KeePass password","name":"password","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default","value":"{PASSWORD}"},{"displayName":"KeePass username","name":"username","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default","value":"{USERNAME}"}],"alwaysAutoFill":false,"alwaysAutoSubmit":false,"neverAutoFill":false,"neverAutoSubmit":false,"blockDomainOnlyMatch":false,"blockHostnameOnlyMatch":false,"altURLs":["http://test.com/1","http://test.com/2"],"regExURLs":["3","4"],"blockedURLs":["5","6"],"regExBlockedURLs":["7","8"]}'); + + testCase( + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":0,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"matcherType":"UsernameDefaultHeuristic"}]},{"page":-1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"matcherType":"PasswordDefaultHeuristic"}]},{"uuid":"AAAAAAAAAAAAAAAAAAAAAA==","name":"dis Name","valuePath":".","value":"KEEFOX_CHECKED_FLAG_TRUE","page":3,"type":"Toggle","placeholderHandling":"Disabled","matcherConfigs":[{"customMatcher":{"ids":["www"],"names":["rrr"],"types":["checkbox"],"queries":[]}}]},{"uuid":"AAAAAAAAAAAAAAAAAAAAAA==","name":"","valuePath":".","value":"RadioValue","page":1,"type":"Existing","matcherConfigs":[{"customMatcher":{"ids":["radid"],"names":["radname"],"types":["radio"],"queries":[]}}]}]}', + '{"version":1,"priority":0,"hide":false,"hTTPRealm":"","formFieldList":[{"displayName":"KeePass username","name":"","type":"FFTusername","id":"","page":0,"placeholderHandling":"Default","value":"{USERNAME}"},{"displayName":"KeePass password","name":"","type":"FFTpassword","id":"","page":-1,"placeholderHandling":"Default","value":"{PASSWORD}"},{"displayName":"dis Name","name":"rrr","type":"FFTcheckbox","id":"www","page":3,"placeholderHandling":"Disabled","value":"KEEFOX_CHECKED_FLAG_TRUE"},{"displayName":"AAAAAAAAAAAAAAAAAAAAAA==","name":"radname","type":"FFTradio","id":"radid","page":1,"placeholderHandling":"Default","value":"RadioValue"}],"alwaysAutoFill":false,"alwaysAutoSubmit":false,"neverAutoFill":false,"neverAutoSubmit":false,"blockDomainOnlyMatch":false,"blockHostnameOnlyMatch":false,"altURLs":[],"regExURLs":[],"blockedURLs":[],"regExBlockedURLs":[]}'); }); test('config v1->v2', () async { testCaseToV2( '{"version":1,"hTTPRealm":"","formFieldList":[{"name":"password","displayName":"KeePass password","value":"{PASSWORD}","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default"},{"name":"username","displayName":"KeePass username","value":"{USERNAME}","type":"FFTradio","id":"username","page":-1,"placeholderHandling":"Default"}],"alwaysAutoFill":false,"neverAutoFill":false,"alwaysAutoSubmit":false,"neverAutoSubmit":false,"priority":0,"altURLs":[],"hide":true,"blockHostnameOnlyMatch":false,"blockDomainOnlyMatch":false}', - '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"},{"matcherType":"Hide"}],"fields":[{"page":1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}]}'); + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"},{"matcherType":"Hide"}],"fields":[{"page":1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}]}'); testCaseToV2( '{"version":1,"hTTPRealm":"","formFieldList":[{"name":"password","displayName":"KeePass password","value":"{PASSWORD}","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default"},{"name":"username","displayName":"KeePass username","value":"{USERNAME}","type":"FFTradio","id":"username","page":-1,"placeholderHandling":"Default"}],"alwaysAutoFill":false,"neverAutoFill":false,"alwaysAutoSubmit":false,"neverAutoSubmit":false,"priority":0,"altURLs":[],"hide":false,"blockHostnameOnlyMatch":false,"blockDomainOnlyMatch":false}', - '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}]}'); + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}]}'); testCaseToV2( '{"version":1,"hTTPRealm":"","formFieldList":[{"name":"password","displayName":"KeePass password","value":"{PASSWORD}","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default"},{"name":"username","displayName":"KeePass username","value":"{USERNAME}","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default"}],"alwaysAutoFill":false,"neverAutoFill":false,"alwaysAutoSubmit":false,"neverAutoSubmit":false,"priority":0,"altURLs":[],"hide":false,"blockHostnameOnlyMatch":false,"blockDomainOnlyMatch":false}', - '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}]}'); + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}]}'); testCaseToV2( '{"version":1,"hTTPRealm":"","formFieldList":[{"name":"password","displayName":"KeePass password","value":"{PASSWORD}","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default"},{"name":"username","displayName":"KeePass username","value":"{USERNAME}","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default"}],"alwaysAutoFill":false,"neverAutoFill":false,"alwaysAutoSubmit":false,"neverAutoSubmit":false,"priority":0,"altURLs":["http://test.com/1","http://test.com/2"],"regExURLs":["3","4"],"blockedURLs":["5","6"],"regExBlockedURLs":["7","8"],"hide":false,"blockHostnameOnlyMatch":false,"blockDomainOnlyMatch":false}', - '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}],"altUrls":["http://test.com/1","http://test.com/2"],"regExUrls":["3","4"],"blockedUrls":["5","6"],"regExBlockedUrls":["7","8"]}'); + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]}],"altUrls":["http://test.com/1","http://test.com/2"],"regExUrls":["3","4"],"blockedUrls":["5","6"],"regExBlockedUrls":["7","8"]}'); testCaseToV2('', - '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"UserName","uuid":"00000000-0000-0000-0000-000000000000","type":"Text","matcherConfigs":[{"matcherType":"UsernameDefaultHeuristic"}]},{"page":1,"valuePath":"Password","uuid":"00000000-0000-0000-0000-000000000000","type":"Password","matcherConfigs":[{"matcherType":"PasswordDefaultHeuristic"}]}]}'); + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"matcherType":"UsernameDefaultHeuristic"}]},{"page":1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"matcherType":"PasswordDefaultHeuristic"}]}]}'); + + testCaseToV2( + '{"version":1,"hTTPRealm":"","formFieldList":[{"name":"password","displayName":"KeePass password","value":"{PASSWORD}","type":"FFTpassword","id":"password","page":-1,"placeholderHandling":"Default"},{"name":"username","displayName":"KeePass username","value":"{USERNAME}","type":"FFTusername","id":"username","page":-1,"placeholderHandling":"Default"},{"displayName":"dis Name","name":"rrr","type":"FFTcheckbox","id":"www","page":3,"placeholderHandling":"Disabled","value":"KEEFOX_CHECKED_FLAG_TRUE"},{"displayName":"","name":"radname","type":"FFTradio","id":"radid","page":1,"placeholderHandling":"Default","value":"RadioValue"}],"alwaysAutoFill":false,"neverAutoFill":false,"alwaysAutoSubmit":false,"neverAutoSubmit":false,"priority":0,"altURLs":[],"hide":false,"blockHostnameOnlyMatch":false,"blockDomainOnlyMatch":false}', + '{"version":2,"authenticationMethods":["password"],"matcherConfigs":[{"matcherType":"Url"}],"fields":[{"page":1,"valuePath":"Password","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Password","matcherConfigs":[{"customMatcher":{"ids":["password"],"names":["password"],"types":["password"]}}]},{"page":1,"valuePath":"UserName","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Text","matcherConfigs":[{"customMatcher":{"ids":["username"],"names":["username"],"types":["text"]}}]},{"page":3,"valuePath":".","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Toggle","matcherConfigs":[{"customMatcher":{"ids":["www"],"names":["rrr"],"types":["checkbox"]}}],"name":"dis Name","value":"KEEFOX_CHECKED_FLAG_TRUE","placeholderHandling":"Disabled"},{"page":1,"valuePath":".","uuid":"AAAAAAAAAAAAAAAAAAAAAA==","type":"Existing","matcherConfigs":[{"customMatcher":{"ids":["radid"],"names":["radname"],"types":["radio"]}}],"name":"AAAAAAAAAAAAAAAAAAAAAA==","value":"RadioValue"}]}'); }); }); }