mirror of
https://github.com/bitwarden/android.git
synced 2024-12-26 10:58:29 +03:00
[PM-1575] Display Passkeys (#2523)
* PM-1575 Added new models for Fido2Key
* PM-1575 Added discoverable passkeys and WIP non-discoverable ones
* PM-1575 Fix format
* PM-1575 Added non-discoverable passkeys to login UI
* PM-1575 Added copy application icon to Fido2Key UI
* PM-1575 Updated bwi font with the updated passkey icon
* PM-1575 For now just display Available for two-step login on non-discoverable passkey inside of a cipher login
* PM-1575 Fix non-discoverable passkey visibility
* PM-1575 remove Passkeys as a filter in the vault list
* PM-1575 Display error toast if there is a duplicate passkey when moving a cipher to an org
* Revert "PM-1575 Display error toast if there is a duplicate passkey when moving a cipher to an org"
This reverts commit 78e6353602
.
* [PM-2378] Display error toast on duplicate Passkey when moving cipher to an organization (#2594)
* PM-2378 Display error toast if there is a duplicate passkey when moving a cipher to an org
* PM-3097 Fix issue when moving cipher with passkey to an org where the uniqueness should be taken into consideration on different passkeys types and also the Username (#2632)
* PM-3096 Fix non-discoverable passkey to be taken into account when encrypting a cipher which was causing the passkey to be removed when moving to an org (#2637)
This commit is contained in:
parent
174549e5bc
commit
ea81acb3bf
42 changed files with 664 additions and 131 deletions
Binary file not shown.
|
@ -31,7 +31,7 @@ namespace Bit.App.Controls
|
||||||
public bool ShowIconImage
|
public bool ShowIconImage
|
||||||
{
|
{
|
||||||
get => WebsiteIconsEnabled
|
get => WebsiteIconsEnabled
|
||||||
&& !string.IsNullOrWhiteSpace(Cipher.Login?.Uri)
|
&& !string.IsNullOrWhiteSpace(Cipher.LaunchUri)
|
||||||
&& IconImageSource != null;
|
&& IconImageSource != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
if (_iconImageSource == string.Empty) // default value since icon source can return null
|
if (_iconImageSource == string.Empty) // default value since icon source can return null
|
||||||
{
|
{
|
||||||
_iconImageSource = IconImageHelper.GetLoginIconImage(Cipher);
|
_iconImageSource = IconImageHelper.GetIconImage(Cipher);
|
||||||
}
|
}
|
||||||
return _iconImageSource;
|
return _iconImageSource;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace Bit.App.Pages
|
||||||
set => SetProperty(ref _cipher, value, additionalPropertyNames: AdditionalPropertiesToRaiseOnCipherChanged);
|
set => SetProperty(ref _cipher, value, additionalPropertyNames: AdditionalPropertiesToRaiseOnCipherChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CreationDate => string.Format(AppResources.CreatedX, Cipher.CreationDate.ToShortDateString());
|
||||||
|
|
||||||
public AsyncCommand CheckPasswordCommand { get; }
|
public AsyncCommand CheckPasswordCommand { get; }
|
||||||
|
|
||||||
protected async Task CheckPasswordAsync()
|
protected async Task CheckPasswordAsync()
|
||||||
|
|
|
@ -223,6 +223,17 @@
|
||||||
AutomationId="RegeneratePasswordButton" />
|
AutomationId="RegeneratePasswordButton" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Passkey}"
|
||||||
|
StyleClass="box-label"
|
||||||
|
Margin="0,10,0,0"
|
||||||
|
IsVisible="{Binding ShowPasskeyInfo}"/>
|
||||||
|
<Entry
|
||||||
|
Text="{u:I18n AvailableForTwoStepLogin}"
|
||||||
|
IsEnabled="False"
|
||||||
|
StyleClass="box-value,text-muted"
|
||||||
|
IsVisible="{Binding ShowPasskeyInfo}" />
|
||||||
|
|
||||||
<Grid StyleClass="box-row, box-row-input">
|
<Grid StyleClass="box-row, box-row-input">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
@ -639,6 +650,38 @@
|
||||||
AutomationId="IdentityCountryEntry" />
|
AutomationId="IdentityCountryEntry" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
|
<StackLayout IsVisible="{Binding IsFido2Key}" Spacing="0" Padding="0">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Username}"
|
||||||
|
StyleClass="box-label"
|
||||||
|
Margin="0,10,0,0"/>
|
||||||
|
<Entry
|
||||||
|
x:Name="_fido2KeyUsernameEntry"
|
||||||
|
Text="{Binding Cipher.Fido2Key.UserName}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
Grid.Row="1"/>
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Passkey}"
|
||||||
|
StyleClass="box-label"
|
||||||
|
Margin="0,10,0,0"/>
|
||||||
|
<Entry
|
||||||
|
Text="{Binding CreationDate}"
|
||||||
|
IsEnabled="False"
|
||||||
|
StyleClass="box-value,text-muted" />
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Application}"
|
||||||
|
StyleClass="box-label"
|
||||||
|
Margin="0,10,0,0"/>
|
||||||
|
<Entry
|
||||||
|
Text="{Binding Cipher.Fido2Key.LaunchUri}"
|
||||||
|
IsEnabled="False"
|
||||||
|
StyleClass="box-value,text-muted" />
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n YouCannotEditPasskeyApplicationBecauseItWouldInvalidateThePasskey}"
|
||||||
|
StyleClass="box-sub-label" />
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box" IsVisible="{Binding IsLogin}">
|
<StackLayout StyleClass="box" IsVisible="{Binding IsLogin}">
|
||||||
<StackLayout StyleClass="box-row-header">
|
<StackLayout StyleClass="box-row-header">
|
||||||
|
|
|
@ -88,7 +88,6 @@ namespace Bit.App.Pages
|
||||||
_watchDeviceService = ServiceContainer.Resolve<IWatchDeviceService>();
|
_watchDeviceService = ServiceContainer.Resolve<IWatchDeviceService>();
|
||||||
_accountsManager = ServiceContainer.Resolve<IAccountsManager>();
|
_accountsManager = ServiceContainer.Resolve<IAccountsManager>();
|
||||||
|
|
||||||
|
|
||||||
GeneratePasswordCommand = new Command(GeneratePassword);
|
GeneratePasswordCommand = new Command(GeneratePassword);
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
ToggleCardNumberCommand = new Command(ToggleCardNumber);
|
ToggleCardNumberCommand = new Command(ToggleCardNumber);
|
||||||
|
@ -297,6 +296,7 @@ namespace Bit.App.Pages
|
||||||
public bool IsIdentity => Cipher?.Type == CipherType.Identity;
|
public bool IsIdentity => Cipher?.Type == CipherType.Identity;
|
||||||
public bool IsCard => Cipher?.Type == CipherType.Card;
|
public bool IsCard => Cipher?.Type == CipherType.Card;
|
||||||
public bool IsSecureNote => Cipher?.Type == CipherType.SecureNote;
|
public bool IsSecureNote => Cipher?.Type == CipherType.SecureNote;
|
||||||
|
public bool IsFido2Key => Cipher?.Type == CipherType.Fido2Key;
|
||||||
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
|
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
|
||||||
public bool ShowAttachments => Cipher.HasAttachments;
|
public bool ShowAttachments => Cipher.HasAttachments;
|
||||||
public string ShowPasswordIcon => ShowPassword ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
|
public string ShowPasswordIcon => ShowPassword ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
|
||||||
|
@ -309,6 +309,7 @@ namespace Bit.App.Pages
|
||||||
public string PasswordVisibilityAccessibilityText => ShowPassword ? AppResources.PasswordIsVisibleTapToHide : AppResources.PasswordIsNotVisibleTapToShow;
|
public string PasswordVisibilityAccessibilityText => ShowPassword ? AppResources.PasswordIsVisibleTapToHide : AppResources.PasswordIsNotVisibleTapToShow;
|
||||||
public bool HasTotpValue => IsLogin && !string.IsNullOrEmpty(Cipher?.Login?.Totp);
|
public bool HasTotpValue => IsLogin && !string.IsNullOrEmpty(Cipher?.Login?.Totp);
|
||||||
public string SetupTotpText => $"{BitwardenIcons.Camera} {AppResources.SetupTotp}";
|
public string SetupTotpText => $"{BitwardenIcons.Camera} {AppResources.SetupTotp}";
|
||||||
|
public bool ShowPasskeyInfo => Cipher?.Login?.Fido2Key != null && !CloneMode;
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
@ -367,6 +368,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
Cipher.OrganizationId = OrganizationId;
|
Cipher.OrganizationId = OrganizationId;
|
||||||
}
|
}
|
||||||
|
if (Cipher.Type == CipherType.Login)
|
||||||
|
{
|
||||||
|
// passkeys can't be cloned
|
||||||
|
Cipher.Login.Fido2Key = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (appOptions?.OtpData != null && Cipher.Type == CipherType.Login)
|
if (appOptions?.OtpData != null && Cipher.Type == CipherType.Login)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
x:Name="_attachmentsItem" x:Key="attachmentsItem" />
|
x:Name="_attachmentsItem" x:Key="attachmentsItem" />
|
||||||
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True"
|
<ToolbarItem Text="{u:I18n Delete}" Clicked="Delete_Clicked" Order="Secondary" IsDestructive="True"
|
||||||
x:Name="_deleteItem" x:Key="deleteItem" />
|
x:Name="_deleteItem" x:Key="deleteItem" />
|
||||||
<ToolbarItem Text="{u:I18n Clone}" Clicked="Clone_Clicked" Order="Secondary"
|
<ToolbarItem Text="{u:I18n Clone}" Command="{Binding CloneCommand}" Order="Secondary"
|
||||||
x:Name="_cloneItem" x:Key="cloneItem" />
|
x:Name="_cloneItem" x:Key="cloneItem" />
|
||||||
|
|
||||||
<DataTemplate x:Key="TextCustomFieldDataTemplate">
|
<DataTemplate x:Key="TextCustomFieldDataTemplate">
|
||||||
|
@ -195,6 +195,16 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
<BoxView StyleClass="box-row-separator"
|
<BoxView StyleClass="box-row-separator"
|
||||||
IsVisible="{Binding Cipher.Login.Password, Converter={StaticResource stringHasValue}}" />
|
IsVisible="{Binding Cipher.Login.Password, Converter={StaticResource stringHasValue}}" />
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Passkey}"
|
||||||
|
StyleClass="box-label"
|
||||||
|
Margin="0,10,0,0"
|
||||||
|
IsVisible="{Binding Cipher.Login.Fido2Key, Converter={StaticResource notNull}}"/>
|
||||||
|
<Entry
|
||||||
|
Text="{u:I18n AvailableForTwoStepLogin}"
|
||||||
|
IsEnabled="False"
|
||||||
|
StyleClass="box-value,text-muted"
|
||||||
|
IsVisible="{Binding Cipher.Login.Fido2Key, Converter={StaticResource notNull}}" />
|
||||||
<Grid StyleClass="box-row"
|
<Grid StyleClass="box-row"
|
||||||
IsVisible="{Binding ShowTotp}"
|
IsVisible="{Binding ShowTotp}"
|
||||||
AutomationId="ItemRow">
|
AutomationId="ItemRow">
|
||||||
|
@ -569,6 +579,64 @@
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowIdentityAddress}" />
|
<BoxView StyleClass="box-row-separator" IsVisible="{Binding ShowIdentityAddress}" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
<StackLayout
|
||||||
|
IsVisible="{Binding IsFido2Key}"
|
||||||
|
Spacing="0"
|
||||||
|
Padding="0"
|
||||||
|
Margin="0,10,0,0">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Username}"
|
||||||
|
StyleClass="box-label" />
|
||||||
|
<Label
|
||||||
|
Text="{Binding Cipher.Fido2Key.UserName, Mode=OneWay}"
|
||||||
|
StyleClass="box-value" />
|
||||||
|
<BoxView StyleClass="box-row-separator" Margin="0,10,0,0" />
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Passkey}"
|
||||||
|
StyleClass="box-label"
|
||||||
|
Margin="0,10,0,0" />
|
||||||
|
<Label
|
||||||
|
Text="{Binding CreationDate, Mode=OneWay}"
|
||||||
|
StyleClass="box-value" />
|
||||||
|
<BoxView StyleClass="box-row-separator" Margin="0,10,0,0" />
|
||||||
|
<Grid
|
||||||
|
StyleClass="box-row"
|
||||||
|
RowDefinitions="Auto,*,Auto"
|
||||||
|
ColumnDefinitions="*,Auto,Auto">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n Application}"
|
||||||
|
StyleClass="box-label" />
|
||||||
|
<Label
|
||||||
|
Grid.Row="1"
|
||||||
|
Text="{Binding Cipher.Fido2Key.LaunchUri, Mode=OneWay}"
|
||||||
|
StyleClass="box-value" />
|
||||||
|
<controls:IconButton
|
||||||
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
|
Text="{Binding Source={x:Static core:BitwardenIcons.ShareSquare}}"
|
||||||
|
Command="{Binding LaunchUriCommand}"
|
||||||
|
CommandParameter="{Binding Cipher.Fido2Key}"
|
||||||
|
Grid.Column="1"
|
||||||
|
Grid.RowSpan="2"
|
||||||
|
VerticalOptions="End"
|
||||||
|
IsVisible="{Binding Cipher.Fido2Key.CanLaunch, Mode=OneWay}"
|
||||||
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
|
AutomationProperties.Name="{u:I18n Launch}" />
|
||||||
|
<controls:IconButton
|
||||||
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
|
Text="{Binding Source={x:Static core:BitwardenIcons.Clone}}"
|
||||||
|
Command="{Binding CopyCommand}"
|
||||||
|
CommandParameter="Fido2KeyApplication"
|
||||||
|
Grid.Column="2"
|
||||||
|
Grid.RowSpan="2"
|
||||||
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
|
AutomationProperties.Name="{u:I18n CopyApplication}" />
|
||||||
|
<BoxView
|
||||||
|
StyleClass="box-row-separator"
|
||||||
|
Margin="0,3,0,0"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.ColumnSpan="3" />
|
||||||
|
</Grid>
|
||||||
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box" IsVisible="{Binding ShowUris}">
|
<StackLayout StyleClass="box" IsVisible="{Binding ShowUris}">
|
||||||
<StackLayout StyleClass="box-row-header">
|
<StackLayout StyleClass="box-row-header">
|
||||||
|
|
|
@ -204,19 +204,6 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Clone_Clicked(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
if (DoOnce())
|
|
||||||
{
|
|
||||||
if (!await _vm.PromptPasswordAsync())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var page = new CipherAddEditPage(_vm.CipherId, cloneMode: true, cipherDetailsPage: this);
|
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void More_Clicked(object sender, System.EventArgs e)
|
private async void More_Clicked(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (!DoOnce())
|
if (!DoOnce())
|
||||||
|
@ -267,8 +254,7 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
else if (selection == AppResources.Clone)
|
else if (selection == AppResources.Clone)
|
||||||
{
|
{
|
||||||
var page = new CipherAddEditPage(_vm.CipherId, cloneMode: true, cipherDetailsPage: this);
|
_vm.CloneCommand.Execute(null);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,13 +288,13 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
ToolbarItems.Remove(_collectionsItem);
|
ToolbarItems.Remove(_collectionsItem);
|
||||||
}
|
}
|
||||||
if (!ToolbarItems.Contains(_cloneItem))
|
if (_vm.Cipher.Type != Core.Enums.CipherType.Fido2Key && !ToolbarItems.Contains(_cloneItem))
|
||||||
{
|
{
|
||||||
ToolbarItems.Insert(1, _cloneItem);
|
ToolbarItems.Insert(1, _cloneItem);
|
||||||
}
|
}
|
||||||
if (!ToolbarItems.Contains(_shareItem))
|
if (!ToolbarItems.Contains(_shareItem))
|
||||||
{
|
{
|
||||||
ToolbarItems.Insert(2, _shareItem);
|
ToolbarItems.Insert(_vm.Cipher.Type == Core.Enums.CipherType.Fido2Key ? 1 : 2, _shareItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -68,7 +68,8 @@ namespace Bit.App.Pages
|
||||||
CopyCommand = new AsyncCommand<string>((id) => CopyAsync(id, null), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
|
CopyCommand = new AsyncCommand<string>((id) => CopyAsync(id, null), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
|
||||||
CopyUriCommand = new AsyncCommand<LoginUriView>(uriView => CopyAsync("LoginUri", uriView.Uri), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
|
CopyUriCommand = new AsyncCommand<LoginUriView>(uriView => CopyAsync("LoginUri", uriView.Uri), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
|
||||||
CopyFieldCommand = new AsyncCommand<FieldView>(field => CopyAsync(field.Type == FieldType.Hidden ? "H_FieldValue" : "FieldValue", field.Value), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
|
CopyFieldCommand = new AsyncCommand<FieldView>(field => CopyAsync(field.Type == FieldType.Hidden ? "H_FieldValue" : "FieldValue", field.Value), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
|
||||||
LaunchUriCommand = new Command<LoginUriView>(LaunchUri);
|
LaunchUriCommand = new Command<ILaunchableView>(LaunchUri);
|
||||||
|
CloneCommand = new AsyncCommand(CloneAsync, onException: ex => HandleException(ex), allowsMultipleExecutions: false);
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
ToggleCardNumberCommand = new Command(ToggleCardNumber);
|
ToggleCardNumberCommand = new Command(ToggleCardNumber);
|
||||||
ToggleCardCodeCommand = new Command(ToggleCardCode);
|
ToggleCardCodeCommand = new Command(ToggleCardCode);
|
||||||
|
@ -81,6 +82,7 @@ namespace Bit.App.Pages
|
||||||
public ICommand CopyUriCommand { get; set; }
|
public ICommand CopyUriCommand { get; set; }
|
||||||
public ICommand CopyFieldCommand { get; set; }
|
public ICommand CopyFieldCommand { get; set; }
|
||||||
public Command LaunchUriCommand { get; set; }
|
public Command LaunchUriCommand { get; set; }
|
||||||
|
public ICommand CloneCommand { get; set; }
|
||||||
public Command TogglePasswordCommand { get; set; }
|
public Command TogglePasswordCommand { get; set; }
|
||||||
public Command ToggleCardNumberCommand { get; set; }
|
public Command ToggleCardNumberCommand { get; set; }
|
||||||
public Command ToggleCardCodeCommand { get; set; }
|
public Command ToggleCardCodeCommand { get; set; }
|
||||||
|
@ -146,6 +148,7 @@ namespace Bit.App.Pages
|
||||||
public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity;
|
public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity;
|
||||||
public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card;
|
public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card;
|
||||||
public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote;
|
public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote;
|
||||||
|
public bool IsFido2Key => Cipher?.Type == Core.Enums.CipherType.Fido2Key;
|
||||||
public FormattedString ColoredPassword => GeneratedValueFormatter.Format(Cipher.Login.Password);
|
public FormattedString ColoredPassword => GeneratedValueFormatter.Format(Cipher.Login.Password);
|
||||||
public FormattedString UpdatedText
|
public FormattedString UpdatedText
|
||||||
{
|
{
|
||||||
|
@ -645,6 +648,11 @@ namespace Bit.App.Pages
|
||||||
text = Cipher.Card.Code;
|
text = Cipher.Card.Code;
|
||||||
name = AppResources.SecurityCode;
|
name = AppResources.SecurityCode;
|
||||||
}
|
}
|
||||||
|
else if (id == "Fido2KeyApplication")
|
||||||
|
{
|
||||||
|
text = Cipher.Fido2Key?.LaunchUri;
|
||||||
|
name = AppResources.Application;
|
||||||
|
}
|
||||||
|
|
||||||
if (text != null)
|
if (text != null)
|
||||||
{
|
{
|
||||||
|
@ -668,14 +676,25 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LaunchUri(LoginUriView uri)
|
private void LaunchUri(ILaunchableView launchableView)
|
||||||
{
|
{
|
||||||
if (uri.CanLaunch && (Page as BaseContentPage).DoOnce())
|
if (launchableView.CanLaunch && (Page as BaseContentPage).DoOnce())
|
||||||
{
|
{
|
||||||
_platformUtilsService.LaunchUri(uri.LaunchUri);
|
_platformUtilsService.LaunchUri(launchableView.LaunchUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task CloneAsync()
|
||||||
|
{
|
||||||
|
if (!await CanCloneAsync() || !await PromptPasswordAsync())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var page = new CipherAddEditPage(CipherId, cloneMode: true, cipherDetailsPage: Page as CipherDetailsPage);
|
||||||
|
await Page.Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<bool> PromptPasswordAsync()
|
public async Task<bool> PromptPasswordAsync()
|
||||||
{
|
{
|
||||||
if (Cipher.Reprompt == CipherRepromptType.None || _passwordReprompted)
|
if (Cipher.Reprompt == CipherRepromptType.None || _passwordReprompted)
|
||||||
|
@ -685,5 +704,15 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
return _passwordReprompted = await _passwordRepromptService.ShowPasswordPromptAsync();
|
return _passwordReprompted = await _passwordRepromptService.ShowPasswordPromptAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<bool> CanCloneAsync()
|
||||||
|
{
|
||||||
|
if (Cipher.Type == CipherType.Login && Cipher.Login?.Fido2Key != null)
|
||||||
|
{
|
||||||
|
return await _platformUtilsService.ShowDialogAsync(AppResources.ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem, AppResources.PasskeyWillNotBeCopied, AppResources.Yes, AppResources.No);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,9 @@ namespace Bit.App.Pages
|
||||||
case CipherType.Identity:
|
case CipherType.Identity:
|
||||||
_name = AppResources.TypeIdentity;
|
_name = AppResources.TypeIdentity;
|
||||||
break;
|
break;
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
_name = AppResources.Passkey;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +111,9 @@ namespace Bit.App.Pages
|
||||||
case CipherType.Identity:
|
case CipherType.Identity:
|
||||||
_icon = BitwardenIcons.IdCard;
|
_icon = BitwardenIcons.IdCard;
|
||||||
break;
|
break;
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
_icon = BitwardenIcons.Passkey;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
_icon = BitwardenIcons.Globe;
|
_icon = BitwardenIcons.Globe;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -235,35 +235,18 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
AddTotpGroupItem(groupedItems, uppercaseGroupNames);
|
AddTotpGroupItem(groupedItems, uppercaseGroupNames);
|
||||||
|
|
||||||
groupedItems.Add(new GroupingsPageListGroup(
|
var types = new CipherType[] { CipherType.Login, CipherType.Card, CipherType.Identity, CipherType.SecureNote };
|
||||||
AppResources.Types, 4, uppercaseGroupNames, !hasFavorites)
|
var typesGroup = new GroupingsPageListGroup(AppResources.Types, types.Length, uppercaseGroupNames, !hasFavorites);
|
||||||
|
foreach (CipherType t in types)
|
||||||
{
|
{
|
||||||
new GroupingsPageListItem
|
typesGroup.Add(new GroupingsPageListItem
|
||||||
{
|
{
|
||||||
Type = CipherType.Login,
|
Type = t,
|
||||||
ItemCount = (_typeCounts.ContainsKey(CipherType.Login) ?
|
ItemCount = _typeCounts.GetValueOrDefault(t).ToString("N0")
|
||||||
_typeCounts[CipherType.Login] : 0).ToString("N0")
|
|
||||||
},
|
|
||||||
new GroupingsPageListItem
|
|
||||||
{
|
|
||||||
Type = CipherType.Card,
|
|
||||||
ItemCount = (_typeCounts.ContainsKey(CipherType.Card) ?
|
|
||||||
_typeCounts[CipherType.Card] : 0).ToString("N0")
|
|
||||||
},
|
|
||||||
new GroupingsPageListItem
|
|
||||||
{
|
|
||||||
Type = CipherType.Identity,
|
|
||||||
ItemCount = (_typeCounts.ContainsKey(CipherType.Identity) ?
|
|
||||||
_typeCounts[CipherType.Identity] : 0).ToString("N0")
|
|
||||||
},
|
|
||||||
new GroupingsPageListItem
|
|
||||||
{
|
|
||||||
Type = CipherType.SecureNote,
|
|
||||||
ItemCount = (_typeCounts.ContainsKey(CipherType.SecureNote) ?
|
|
||||||
_typeCounts[CipherType.SecureNote] : 0).ToString("N0")
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
groupedItems.Add(typesGroup);
|
||||||
|
}
|
||||||
if (NestedFolders?.Any() ?? false)
|
if (NestedFolders?.Any() ?? false)
|
||||||
{
|
{
|
||||||
var folderListItems = NestedFolders.Select(f =>
|
var folderListItems = NestedFolders.Select(f =>
|
||||||
|
@ -584,7 +567,9 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
else if (Type != null)
|
else if (Type != null)
|
||||||
{
|
{
|
||||||
Filter = c => c.Type == Type.Value && !c.IsDeleted;
|
Filter = c => !c.IsDeleted
|
||||||
|
&&
|
||||||
|
Type.Value.IsEqualToOrCanSignIn(c.Type);
|
||||||
}
|
}
|
||||||
else if (FolderId != null)
|
else if (FolderId != null)
|
||||||
{
|
{
|
||||||
|
@ -651,14 +636,11 @@ namespace Bit.App.Pages
|
||||||
NoFolderCiphers.Add(c);
|
NoFolderCiphers.Add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_typeCounts.ContainsKey(c.Type))
|
// Fido2Key ciphers should be counted as Login ciphers
|
||||||
{
|
var countType = c.Type == CipherType.Fido2Key ? CipherType.Login : c.Type;
|
||||||
_typeCounts[c.Type] = _typeCounts[c.Type] + 1;
|
_typeCounts[countType] = _typeCounts.TryGetValue(countType, out var currentTypeCount)
|
||||||
}
|
? currentTypeCount + 1
|
||||||
else
|
: 1;
|
||||||
{
|
|
||||||
_typeCounts.Add(c.Type, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.IsDeleted)
|
if (c.IsDeleted)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
<ContentPage.ToolbarItems>
|
||||||
<ToolbarItem Text="{u:I18n Cancel}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
|
<ToolbarItem Text="{u:I18n Cancel}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
|
||||||
<ToolbarItem Text="{u:I18n Move}" Clicked="Save_Clicked" />
|
<ToolbarItem Text="{u:I18n Move}" Command="{Binding MoveCommand}" />
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
|
|
|
@ -32,19 +32,6 @@ namespace Bit.App.Pages
|
||||||
await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync());
|
await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDisappearing()
|
|
||||||
{
|
|
||||||
base.OnDisappearing();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Save_Clicked(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
if (DoOnce())
|
|
||||||
{
|
|
||||||
await _vm.SubmitAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Close_Clicked(object sender, System.EventArgs e)
|
private async void Close_Clicked(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
if (DoOnce())
|
if (DoOnce())
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
|
@ -8,6 +9,7 @@ using Bit.Core.Enums;
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Bit.Core.Models.View;
|
using Bit.Core.Models.View;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
|
@ -34,6 +36,8 @@ namespace Bit.App.Pages
|
||||||
Collections = new ExtendedObservableCollection<CollectionViewModel>();
|
Collections = new ExtendedObservableCollection<CollectionViewModel>();
|
||||||
OrganizationOptions = new List<KeyValuePair<string, string>>();
|
OrganizationOptions = new List<KeyValuePair<string, string>>();
|
||||||
PageTitle = AppResources.MoveToOrganization;
|
PageTitle = AppResources.MoveToOrganization;
|
||||||
|
|
||||||
|
MoveCommand = new AsyncCommand(MoveAsync, onException: ex => HandleException(ex), allowsMultipleExecutions: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CipherId { get; set; }
|
public string CipherId { get; set; }
|
||||||
|
@ -62,6 +66,8 @@ namespace Bit.App.Pages
|
||||||
set => SetProperty(ref _hasOrganizations, value);
|
set => SetProperty(ref _hasOrganizations, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand MoveCommand { get; }
|
||||||
|
|
||||||
public async Task LoadAsync()
|
public async Task LoadAsync()
|
||||||
{
|
{
|
||||||
var allCollections = await _collectionService.GetAllDecryptedAsync();
|
var allCollections = await _collectionService.GetAllDecryptedAsync();
|
||||||
|
@ -84,7 +90,7 @@ namespace Bit.App.Pages
|
||||||
FilterCollections();
|
FilterCollections();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> SubmitAsync()
|
public async Task<bool> MoveAsync()
|
||||||
{
|
{
|
||||||
var selectedCollectionIds = Collections?.Where(c => c.Checked).Select(c => c.Collection.Id);
|
var selectedCollectionIds = Collections?.Where(c => c.Checked).Select(c => c.Collection.Id);
|
||||||
if (!selectedCollectionIds?.Any() ?? true)
|
if (!selectedCollectionIds?.Any() ?? true)
|
||||||
|
@ -107,8 +113,15 @@ namespace Bit.App.Pages
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Saving);
|
await _deviceActionService.ShowLoadingAsync(AppResources.Saving);
|
||||||
await _cipherService.ShareWithServerAsync(cipherView, OrganizationId, checkedCollectionIds);
|
var error = await _cipherService.ShareWithServerAsync(cipherView, OrganizationId, checkedCollectionIds);
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
|
||||||
|
if (error == ICipherService.ShareWithServerError.DuplicatedPasskeyInOrg)
|
||||||
|
{
|
||||||
|
_platformUtilsService.ShowToast(null, null, AppResources.ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePasskey);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var movedItemToOrgText = string.Format(AppResources.MovedItemToOrg, cipherView.Name,
|
var movedItemToOrgText = string.Format(AppResources.MovedItemToOrg, cipherView.Name,
|
||||||
(await _organizationService.GetAsync(OrganizationId)).Name);
|
(await _organizationService.GetAsync(OrganizationId)).Name);
|
||||||
_platformUtilsService.ShowToast("success", null, movedItemToOrgText);
|
_platformUtilsService.ShowToast("success", null, movedItemToOrgText);
|
||||||
|
|
91
src/App/Resources/AppResources.Designer.cs
generated
91
src/App/Resources/AppResources.Designer.cs
generated
|
@ -553,6 +553,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Application.
|
||||||
|
/// </summary>
|
||||||
|
public static string Application {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Application", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Approve login requests.
|
/// Looks up a localized string similar to Approve login requests.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -949,6 +958,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Available for two-step login.
|
||||||
|
/// </summary>
|
||||||
|
public static string AvailableForTwoStepLogin {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AvailableForTwoStepLogin", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to A verification code was sent to your email.
|
/// Looks up a localized string similar to A verification code was sent to your email.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1570,6 +1588,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Copy application.
|
||||||
|
/// </summary>
|
||||||
|
public static string CopyApplication {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CopyApplication", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Copy link.
|
/// Looks up a localized string similar to Copy link.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1678,6 +1705,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Created {0}.
|
||||||
|
/// </summary>
|
||||||
|
public static string CreatedX {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CreatedX", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Creating account....
|
/// Looks up a localized string similar to Creating account....
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -4786,6 +4822,33 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Passkey.
|
||||||
|
/// </summary>
|
||||||
|
public static string Passkey {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Passkey", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Passkeys.
|
||||||
|
/// </summary>
|
||||||
|
public static string Passkeys {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Passkeys", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Passkey will not be copied.
|
||||||
|
/// </summary>
|
||||||
|
public static string PasskeyWillNotBeCopied {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("PasskeyWillNotBeCopied", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Passphrase.
|
/// Looks up a localized string similar to Passphrase.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -6201,6 +6264,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to The passkey will not be copied to the cloned item. Do you want to continue cloning this item?.
|
||||||
|
/// </summary>
|
||||||
|
public static string ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem", resourceCulture);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Looks up a localized string similar to There are no blocked URIs.
|
/// Looks up a localized string similar to There are no blocked URIs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ThereAreNoBlockedURIs {
|
public static string ThereAreNoBlockedURIs {
|
||||||
|
@ -6263,6 +6335,16 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to This item cannot be shared with the organization because there is one already with the same passkey..
|
||||||
|
/// </summary>
|
||||||
|
public static string ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePasskey {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePassk" +
|
||||||
|
"ey", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to This request is no longer valid.
|
/// Looks up a localized string similar to This request is no longer valid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -7235,6 +7317,15 @@ namespace Bit.App.Resources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to You cannot edit passkey application because it would invalidate the passkey.
|
||||||
|
/// </summary>
|
||||||
|
public static string YouCannotEditPasskeyApplicationBecauseItWouldInvalidateThePasskey {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("YouCannotEditPasskeyApplicationBecauseItWouldInvalidateThePasskey", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Your account has been permanently deleted.
|
/// Looks up a localized string similar to Your account has been permanently deleted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2628,6 +2628,34 @@ Do you want to switch to this account?</value>
|
||||||
<data name="CurrentMasterPassword" xml:space="preserve">
|
<data name="CurrentMasterPassword" xml:space="preserve">
|
||||||
<value>Current master password</value>
|
<value>Current master password</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Passkey" xml:space="preserve">
|
||||||
|
<value>Passkey</value>
|
||||||
|
</data>
|
||||||
|
<data name="Passkeys" xml:space="preserve">
|
||||||
|
<value>Passkeys</value>
|
||||||
|
</data>
|
||||||
|
<data name="CreatedX" xml:space="preserve">
|
||||||
|
<value>Created {0}</value>
|
||||||
|
<comment>To state the date in which the cipher was created: Created 03/21/2023</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Application" xml:space="preserve">
|
||||||
|
<value>Application</value>
|
||||||
|
</data>
|
||||||
|
<data name="YouCannotEditPasskeyApplicationBecauseItWouldInvalidateThePasskey" xml:space="preserve">
|
||||||
|
<value>You cannot edit passkey application because it would invalidate the passkey</value>
|
||||||
|
</data>
|
||||||
|
<data name="PasskeyWillNotBeCopied" xml:space="preserve">
|
||||||
|
<value>Passkey will not be copied</value>
|
||||||
|
</data>
|
||||||
|
<data name="ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem" xml:space="preserve">
|
||||||
|
<value>The passkey will not be copied to the cloned item. Do you want to continue cloning this item?</value>
|
||||||
|
</data>
|
||||||
|
<data name="CopyApplication" xml:space="preserve">
|
||||||
|
<value>Copy application</value>
|
||||||
|
</data>
|
||||||
|
<data name="AvailableForTwoStepLogin" xml:space="preserve">
|
||||||
|
<value>Available for two-step login</value>
|
||||||
|
</data>
|
||||||
<data name="MasterPasswordRePromptHelp" xml:space="preserve">
|
<data name="MasterPasswordRePromptHelp" xml:space="preserve">
|
||||||
<value>Master password re-prompt help</value>
|
<value>Master password re-prompt help</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -2640,6 +2668,9 @@ Do you want to switch to this account?</value>
|
||||||
<data name="InvalidAPIToken" xml:space="preserve">
|
<data name="InvalidAPIToken" xml:space="preserve">
|
||||||
<value>Invalid API token</value>
|
<value>Invalid API token</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ThisItemCannotBeSharedWithTheOrganizationBecauseThereIsOneAlreadyWithTheSamePasskey" xml:space="preserve">
|
||||||
|
<value>This item cannot be shared with the organization because there is one already with the same passkey.</value>
|
||||||
|
</data>
|
||||||
<data name="BlockAutoFill" xml:space="preserve">
|
<data name="BlockAutoFill" xml:space="preserve">
|
||||||
<value>Block auto-fill</value>
|
<value>Block auto-fill</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -78,6 +78,18 @@ namespace Bit.App.Utilities
|
||||||
options.Add(AppResources.CopyNotes);
|
options.Add(AppResources.CopyNotes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cipher.Type == Core.Enums.CipherType.Fido2Key)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(cipher.Fido2Key.UserName))
|
||||||
|
{
|
||||||
|
options.Add(AppResources.CopyUsername);
|
||||||
|
}
|
||||||
|
if (cipher.Fido2Key.CanLaunch)
|
||||||
|
{
|
||||||
|
options.Add(AppResources.Launch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var selection = await page.DisplayActionSheet(cipher.Name, AppResources.Cancel, null, options.ToArray());
|
var selection = await page.DisplayActionSheet(cipher.Name, AppResources.Cancel, null, options.ToArray());
|
||||||
if (await vaultTimeoutService.IsLockedAsync())
|
if (await vaultTimeoutService.IsLockedAsync())
|
||||||
{
|
{
|
||||||
|
@ -96,7 +108,7 @@ namespace Bit.App.Utilities
|
||||||
}
|
}
|
||||||
else if (selection == AppResources.CopyUsername)
|
else if (selection == AppResources.CopyUsername)
|
||||||
{
|
{
|
||||||
await clipboardService.CopyTextAsync(cipher.Login.Username);
|
await clipboardService.CopyTextAsync(cipher.Type == CipherType.Login ? cipher.Login.Username : cipher.Fido2Key.UserName);
|
||||||
platformUtilsService.ShowToastForCopiedValue(AppResources.Username);
|
platformUtilsService.ShowToastForCopiedValue(AppResources.Username);
|
||||||
}
|
}
|
||||||
else if (selection == AppResources.CopyPassword)
|
else if (selection == AppResources.CopyPassword)
|
||||||
|
@ -121,9 +133,9 @@ namespace Bit.App.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (selection == AppResources.Launch)
|
else if (selection == AppResources.Launch && cipher.CanLaunch)
|
||||||
{
|
{
|
||||||
platformUtilsService.LaunchUri(cipher.Login.LaunchUri);
|
platformUtilsService.LaunchUri(cipher.LaunchUri);
|
||||||
}
|
}
|
||||||
else if (selection == AppResources.CopyNumber)
|
else if (selection == AppResources.CopyNumber)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,25 +8,20 @@ namespace Bit.App.Utilities
|
||||||
{
|
{
|
||||||
public static string GetIcon(this CipherView cipher)
|
public static string GetIcon(this CipherView cipher)
|
||||||
{
|
{
|
||||||
string icon = null;
|
|
||||||
switch (cipher.Type)
|
switch (cipher.Type)
|
||||||
{
|
{
|
||||||
case CipherType.Login:
|
case CipherType.Login:
|
||||||
icon = GetLoginIconGlyph(cipher);
|
return GetLoginIconGlyph(cipher);
|
||||||
break;
|
|
||||||
case CipherType.SecureNote:
|
case CipherType.SecureNote:
|
||||||
icon = BitwardenIcons.StickyNote;
|
return BitwardenIcons.StickyNote;
|
||||||
break;
|
|
||||||
case CipherType.Card:
|
case CipherType.Card:
|
||||||
icon = BitwardenIcons.CreditCard;
|
return BitwardenIcons.CreditCard;
|
||||||
break;
|
|
||||||
case CipherType.Identity:
|
case CipherType.Identity:
|
||||||
icon = BitwardenIcons.IdCard;
|
return BitwardenIcons.IdCard;
|
||||||
break;
|
case CipherType.Fido2Key:
|
||||||
default:
|
return BitwardenIcons.Passkey;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return icon;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetLoginIconGlyph(CipherView cipher)
|
static string GetLoginIconGlyph(CipherView cipher)
|
||||||
|
|
|
@ -13,31 +13,29 @@ namespace Bit.App.Utilities
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
var cipher = value as CipherView;
|
var cipher = value as CipherView;
|
||||||
return GetIcon(cipher);
|
return IconImageHelper.GetIconImage(cipher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetIcon(CipherView cipher)
|
|
||||||
{
|
|
||||||
string icon = null;
|
|
||||||
switch (cipher.Type)
|
|
||||||
{
|
|
||||||
case CipherType.Login:
|
|
||||||
icon = IconImageHelper.GetLoginIconImage(cipher);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IconImageHelper
|
public static class IconImageHelper
|
||||||
{
|
{
|
||||||
|
public static string GetIconImage(CipherView cipher)
|
||||||
|
{
|
||||||
|
switch (cipher.Type)
|
||||||
|
{
|
||||||
|
case CipherType.Login:
|
||||||
|
return IconImageHelper.GetLoginIconImage(cipher);
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
return IconImageHelper.GetFido2KeyIconImage(cipher);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetLoginIconImage(CipherView cipher)
|
public static string GetLoginIconImage(CipherView cipher)
|
||||||
{
|
{
|
||||||
string image = null;
|
string image = null;
|
||||||
|
@ -67,6 +65,26 @@ namespace Bit.App.Utilities
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetFido2KeyIconImage(CipherView cipher)
|
||||||
|
{
|
||||||
|
var hostnameUri = cipher.Fido2Key.LaunchUri;
|
||||||
|
if (!hostnameUri.Contains("."))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hostnameUri.Contains("://"))
|
||||||
|
{
|
||||||
|
hostnameUri = string.Concat("https://", hostnameUri);
|
||||||
|
}
|
||||||
|
if (hostnameUri.StartsWith("http"))
|
||||||
|
{
|
||||||
|
return GetIconUrl(hostnameUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetIconUrl(string hostnameUri)
|
private static string GetIconUrl(string hostnameUri)
|
||||||
{
|
{
|
||||||
IEnvironmentService _environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
IEnvironmentService _environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
||||||
|
@ -85,7 +103,6 @@ namespace Bit.App.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string.Format("{0}/{1}/icon.png", iconsUrl, hostname);
|
return string.Format("{0}/{1}/icon.png", iconsUrl, hostname);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,12 @@ namespace Bit.Core.Abstractions
|
||||||
{
|
{
|
||||||
public interface ICipherService
|
public interface ICipherService
|
||||||
{
|
{
|
||||||
|
public enum ShareWithServerError
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
DuplicatedPasskeyInOrg
|
||||||
|
}
|
||||||
|
|
||||||
Task ClearAsync(string userId);
|
Task ClearAsync(string userId);
|
||||||
Task ClearCacheAsync();
|
Task ClearCacheAsync();
|
||||||
Task DeleteAsync(List<string> ids);
|
Task DeleteAsync(List<string> ids);
|
||||||
|
@ -31,7 +37,7 @@ namespace Bit.Core.Abstractions
|
||||||
Task SaveCollectionsWithServerAsync(Cipher cipher);
|
Task SaveCollectionsWithServerAsync(Cipher cipher);
|
||||||
Task SaveNeverDomainAsync(string domain);
|
Task SaveNeverDomainAsync(string domain);
|
||||||
Task SaveWithServerAsync(Cipher cipher);
|
Task SaveWithServerAsync(Cipher cipher);
|
||||||
Task ShareWithServerAsync(CipherView cipher, string organizationId, HashSet<string> collectionIds);
|
Task<ShareWithServerError> ShareWithServerAsync(CipherView cipher, string organizationId, HashSet<string> collectionIds);
|
||||||
Task UpdateLastUsedDateAsync(string id);
|
Task UpdateLastUsedDateAsync(string id);
|
||||||
Task UpsertAsync(CipherData cipher);
|
Task UpsertAsync(CipherData cipher);
|
||||||
Task UpsertAsync(List<CipherData> cipher);
|
Task UpsertAsync(List<CipherData> cipher);
|
||||||
|
|
|
@ -114,5 +114,6 @@
|
||||||
public const string ViewCellMenu = "\xe5d3";
|
public const string ViewCellMenu = "\xe5d3";
|
||||||
public const string Device = "\xe986";
|
public const string Device = "\xe986";
|
||||||
public const string Suitcase = "\xe98c";
|
public const string Suitcase = "\xe98c";
|
||||||
|
public const string Passkey = "\xe99f";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,9 @@
|
||||||
public const int Argon2MemoryInMB = 64;
|
public const int Argon2MemoryInMB = 64;
|
||||||
public const int Argon2Parallelism = 4;
|
public const int Argon2Parallelism = 4;
|
||||||
public const int MasterPasswordMinimumChars = 12;
|
public const int MasterPasswordMinimumChars = 12;
|
||||||
|
public const string DefaultFido2KeyType = "public-key";
|
||||||
|
public const string DefaultFido2KeyAlgorithm = "ECDSA";
|
||||||
|
public const string DefaultFido2KeyCurve = "P-256";
|
||||||
|
|
||||||
public static readonly string[] AndroidAllClearCipherCacheKeys =
|
public static readonly string[] AndroidAllClearCipherCacheKeys =
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
Login = 1,
|
Login = 1,
|
||||||
SecureNote = 2,
|
SecureNote = 2,
|
||||||
Card = 3,
|
Card = 3,
|
||||||
Identity = 4
|
Identity = 4,
|
||||||
|
Fido2Key = 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
37
src/Core/Models/Api/Fido2KeyApi.cs
Normal file
37
src/Core/Models/Api/Fido2KeyApi.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
using Bit.Core.Models.Domain;
|
||||||
|
using Bit.Core.Models.Export;
|
||||||
|
|
||||||
|
namespace Bit.Core.Models.Api
|
||||||
|
{
|
||||||
|
public class Fido2KeyApi
|
||||||
|
{
|
||||||
|
public Fido2KeyApi()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Fido2KeyApi(Fido2Key fido2Key)
|
||||||
|
{
|
||||||
|
NonDiscoverableId = fido2Key.NonDiscoverableId?.EncryptedString;
|
||||||
|
KeyType = fido2Key.KeyType?.EncryptedString;
|
||||||
|
KeyAlgorithm = fido2Key.KeyAlgorithm?.EncryptedString;
|
||||||
|
KeyCurve = fido2Key.KeyCurve?.EncryptedString;
|
||||||
|
KeyValue = fido2Key.KeyValue?.EncryptedString;
|
||||||
|
RpId = fido2Key.RpId?.EncryptedString;
|
||||||
|
RpName = fido2Key.RpName?.EncryptedString;
|
||||||
|
UserHandle = fido2Key.UserHandle?.EncryptedString;
|
||||||
|
UserName = fido2Key.UserName?.EncryptedString;
|
||||||
|
Counter = fido2Key.Counter?.EncryptedString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NonDiscoverableId { get; set; }
|
||||||
|
public string KeyType { get; set; } = Constants.DefaultFido2KeyType;
|
||||||
|
public string KeyAlgorithm { get; set; } = Constants.DefaultFido2KeyAlgorithm;
|
||||||
|
public string KeyCurve { get; set; } = Constants.DefaultFido2KeyCurve;
|
||||||
|
public string KeyValue { get; set; }
|
||||||
|
public string RpId { get; set; }
|
||||||
|
public string RpName { get; set; }
|
||||||
|
public string UserHandle { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Counter { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,5 +10,6 @@ namespace Bit.Core.Models.Api
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public DateTime? PasswordRevisionDate { get; set; }
|
public DateTime? PasswordRevisionDate { get; set; }
|
||||||
public string Totp { get; set; }
|
public string Totp { get; set; }
|
||||||
|
public Fido2KeyApi Fido2Key { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace Bit.Core.Models.Data
|
||||||
OrganizationUseTotp = response.OrganizationUseTotp;
|
OrganizationUseTotp = response.OrganizationUseTotp;
|
||||||
Favorite = response.Favorite;
|
Favorite = response.Favorite;
|
||||||
RevisionDate = response.RevisionDate;
|
RevisionDate = response.RevisionDate;
|
||||||
|
CreationDate = response.CreationDate;
|
||||||
|
DeletedDate = response.DeletedDate;
|
||||||
Type = response.Type;
|
Type = response.Type;
|
||||||
Name = response.Name;
|
Name = response.Name;
|
||||||
Notes = response.Notes;
|
Notes = response.Notes;
|
||||||
|
@ -43,6 +45,9 @@ namespace Bit.Core.Models.Data
|
||||||
case Enums.CipherType.Identity:
|
case Enums.CipherType.Identity:
|
||||||
Identity = new IdentityData(response.Identity);
|
Identity = new IdentityData(response.Identity);
|
||||||
break;
|
break;
|
||||||
|
case Enums.CipherType.Fido2Key:
|
||||||
|
Fido2Key = new Fido2KeyData(response.Fido2Key);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +66,6 @@ namespace Bit.Core.Models.Data
|
||||||
Fields = response.Fields?.Select(f => new FieldData(f)).ToList();
|
Fields = response.Fields?.Select(f => new FieldData(f)).ToList();
|
||||||
Attachments = response.Attachments?.Select(a => new AttachmentData(a)).ToList();
|
Attachments = response.Attachments?.Select(a => new AttachmentData(a)).ToList();
|
||||||
PasswordHistory = response.PasswordHistory?.Select(ph => new PasswordHistoryData(ph)).ToList();
|
PasswordHistory = response.PasswordHistory?.Select(ph => new PasswordHistoryData(ph)).ToList();
|
||||||
DeletedDate = response.DeletedDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
@ -73,6 +77,8 @@ namespace Bit.Core.Models.Data
|
||||||
public bool OrganizationUseTotp { get; set; }
|
public bool OrganizationUseTotp { get; set; }
|
||||||
public bool Favorite { get; set; }
|
public bool Favorite { get; set; }
|
||||||
public DateTime RevisionDate { get; set; }
|
public DateTime RevisionDate { get; set; }
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
|
public DateTime? DeletedDate { get; set; }
|
||||||
public Enums.CipherType Type { get; set; }
|
public Enums.CipherType Type { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
@ -80,11 +86,11 @@ namespace Bit.Core.Models.Data
|
||||||
public SecureNoteData SecureNote { get; set; }
|
public SecureNoteData SecureNote { get; set; }
|
||||||
public CardData Card { get; set; }
|
public CardData Card { get; set; }
|
||||||
public IdentityData Identity { get; set; }
|
public IdentityData Identity { get; set; }
|
||||||
|
public Fido2KeyData Fido2Key { get; set; }
|
||||||
public List<FieldData> Fields { get; set; }
|
public List<FieldData> Fields { get; set; }
|
||||||
public List<AttachmentData> Attachments { get; set; }
|
public List<AttachmentData> Attachments { get; set; }
|
||||||
public List<PasswordHistoryData> PasswordHistory { get; set; }
|
public List<PasswordHistoryData> PasswordHistory { get; set; }
|
||||||
public List<string> CollectionIds { get; set; }
|
public List<string> CollectionIds { get; set; }
|
||||||
public DateTime? DeletedDate { get; set; }
|
|
||||||
public Enums.CipherRepromptType Reprompt { get; set; }
|
public Enums.CipherRepromptType Reprompt { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
34
src/Core/Models/Data/Fido2KeyData.cs
Normal file
34
src/Core/Models/Data/Fido2KeyData.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using Bit.Core.Models.Api;
|
||||||
|
|
||||||
|
namespace Bit.Core.Models.Data
|
||||||
|
{
|
||||||
|
public class Fido2KeyData : Data
|
||||||
|
{
|
||||||
|
public Fido2KeyData() { }
|
||||||
|
|
||||||
|
public Fido2KeyData(Fido2KeyApi apiData)
|
||||||
|
{
|
||||||
|
NonDiscoverableId = apiData.NonDiscoverableId;
|
||||||
|
KeyType = apiData.KeyType;
|
||||||
|
KeyAlgorithm = apiData.KeyAlgorithm;
|
||||||
|
KeyCurve = apiData.KeyCurve;
|
||||||
|
KeyValue = apiData.KeyValue;
|
||||||
|
RpId = apiData.RpId;
|
||||||
|
RpName = apiData.RpName;
|
||||||
|
UserHandle = apiData.UserHandle;
|
||||||
|
UserName = apiData.UserName;
|
||||||
|
Counter = apiData.Counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NonDiscoverableId { get; set; }
|
||||||
|
public string KeyType { get; set; } = Constants.DefaultFido2KeyType;
|
||||||
|
public string KeyAlgorithm { get; set; } = Constants.DefaultFido2KeyAlgorithm;
|
||||||
|
public string KeyCurve { get; set; } = Constants.DefaultFido2KeyCurve;
|
||||||
|
public string KeyValue { get; set; }
|
||||||
|
public string RpId { get; set; }
|
||||||
|
public string RpName { get; set; }
|
||||||
|
public string UserHandle { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Counter { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ namespace Bit.Core.Models.Data
|
||||||
PasswordRevisionDate = data.PasswordRevisionDate;
|
PasswordRevisionDate = data.PasswordRevisionDate;
|
||||||
Totp = data.Totp;
|
Totp = data.Totp;
|
||||||
Uris = data.Uris?.Select(u => new LoginUriData(u)).ToList();
|
Uris = data.Uris?.Select(u => new LoginUriData(u)).ToList();
|
||||||
|
Fido2Key = data.Fido2Key != null ? new Fido2KeyData(data.Fido2Key) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LoginUriData> Uris { get; set; }
|
public List<LoginUriData> Uris { get; set; }
|
||||||
|
@ -23,5 +24,6 @@ namespace Bit.Core.Models.Data
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public DateTime? PasswordRevisionDate { get; set; }
|
public DateTime? PasswordRevisionDate { get; set; }
|
||||||
public string Totp { get; set; }
|
public string Totp { get; set; }
|
||||||
|
public Fido2KeyData Fido2Key { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Bit.Core.Models.Domain
|
||||||
Edit = obj.Edit;
|
Edit = obj.Edit;
|
||||||
ViewPassword = obj.ViewPassword;
|
ViewPassword = obj.ViewPassword;
|
||||||
RevisionDate = obj.RevisionDate;
|
RevisionDate = obj.RevisionDate;
|
||||||
|
CreationDate = obj.CreationDate;
|
||||||
CollectionIds = obj.CollectionIds != null ? new HashSet<string>(obj.CollectionIds) : null;
|
CollectionIds = obj.CollectionIds != null ? new HashSet<string>(obj.CollectionIds) : null;
|
||||||
LocalData = localData;
|
LocalData = localData;
|
||||||
Reprompt = obj.Reprompt;
|
Reprompt = obj.Reprompt;
|
||||||
|
@ -47,6 +48,9 @@ namespace Bit.Core.Models.Domain
|
||||||
case Enums.CipherType.Identity:
|
case Enums.CipherType.Identity:
|
||||||
Identity = new Identity(obj.Identity, alreadyEncrypted);
|
Identity = new Identity(obj.Identity, alreadyEncrypted);
|
||||||
break;
|
break;
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
Fido2Key = new Fido2Key(obj.Fido2Key, alreadyEncrypted);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -68,16 +72,18 @@ namespace Bit.Core.Models.Domain
|
||||||
public bool Edit { get; set; }
|
public bool Edit { get; set; }
|
||||||
public bool ViewPassword { get; set; }
|
public bool ViewPassword { get; set; }
|
||||||
public DateTime RevisionDate { get; set; }
|
public DateTime RevisionDate { get; set; }
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
|
public DateTime? DeletedDate { get; set; }
|
||||||
public Dictionary<string, object> LocalData { get; set; }
|
public Dictionary<string, object> LocalData { get; set; }
|
||||||
public Login Login { get; set; }
|
public Login Login { get; set; }
|
||||||
public Identity Identity { get; set; }
|
public Identity Identity { get; set; }
|
||||||
public Card Card { get; set; }
|
public Card Card { get; set; }
|
||||||
public SecureNote SecureNote { get; set; }
|
public SecureNote SecureNote { get; set; }
|
||||||
|
public Fido2Key Fido2Key { get; set; }
|
||||||
public List<Attachment> Attachments { get; set; }
|
public List<Attachment> Attachments { get; set; }
|
||||||
public List<Field> Fields { get; set; }
|
public List<Field> Fields { get; set; }
|
||||||
public List<PasswordHistory> PasswordHistory { get; set; }
|
public List<PasswordHistory> PasswordHistory { get; set; }
|
||||||
public HashSet<string> CollectionIds { get; set; }
|
public HashSet<string> CollectionIds { get; set; }
|
||||||
public DateTime? DeletedDate { get; set; }
|
|
||||||
public CipherRepromptType Reprompt { get; set; }
|
public CipherRepromptType Reprompt { get; set; }
|
||||||
|
|
||||||
public async Task<CipherView> DecryptAsync()
|
public async Task<CipherView> DecryptAsync()
|
||||||
|
@ -103,6 +109,9 @@ namespace Bit.Core.Models.Domain
|
||||||
case Enums.CipherType.Identity:
|
case Enums.CipherType.Identity:
|
||||||
model.Identity = await Identity.DecryptAsync(OrganizationId);
|
model.Identity = await Identity.DecryptAsync(OrganizationId);
|
||||||
break;
|
break;
|
||||||
|
case Enums.CipherType.Fido2Key:
|
||||||
|
model.Fido2Key = await Fido2Key.DecryptAsync(OrganizationId);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -167,6 +176,7 @@ namespace Bit.Core.Models.Domain
|
||||||
OrganizationUseTotp = OrganizationUseTotp,
|
OrganizationUseTotp = OrganizationUseTotp,
|
||||||
Favorite = Favorite,
|
Favorite = Favorite,
|
||||||
RevisionDate = RevisionDate,
|
RevisionDate = RevisionDate,
|
||||||
|
CreationDate = CreationDate,
|
||||||
Type = Type,
|
Type = Type,
|
||||||
CollectionIds = CollectionIds.ToList(),
|
CollectionIds = CollectionIds.ToList(),
|
||||||
DeletedDate = DeletedDate,
|
DeletedDate = DeletedDate,
|
||||||
|
@ -191,6 +201,9 @@ namespace Bit.Core.Models.Domain
|
||||||
case Enums.CipherType.Identity:
|
case Enums.CipherType.Identity:
|
||||||
c.Identity = Identity.ToIdentityData();
|
c.Identity = Identity.ToIdentityData();
|
||||||
break;
|
break;
|
||||||
|
case Enums.CipherType.Fido2Key:
|
||||||
|
c.Fido2Key = Fido2Key.ToFido2KeyData();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
54
src/Core/Models/Domain/Fido2Key.cs
Normal file
54
src/Core/Models/Domain/Fido2Key.cs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bit.Core.Models.Data;
|
||||||
|
using Bit.Core.Models.View;
|
||||||
|
|
||||||
|
namespace Bit.Core.Models.Domain
|
||||||
|
{
|
||||||
|
public class Fido2Key : Domain
|
||||||
|
{
|
||||||
|
public static HashSet<string> EncryptableProperties => new HashSet<string>
|
||||||
|
{
|
||||||
|
nameof(NonDiscoverableId),
|
||||||
|
nameof(KeyType),
|
||||||
|
nameof(KeyAlgorithm),
|
||||||
|
nameof(KeyCurve),
|
||||||
|
nameof(KeyValue),
|
||||||
|
nameof(RpId),
|
||||||
|
nameof(RpName),
|
||||||
|
nameof(UserHandle),
|
||||||
|
nameof(UserName),
|
||||||
|
nameof(Counter)
|
||||||
|
};
|
||||||
|
|
||||||
|
public Fido2Key() { }
|
||||||
|
|
||||||
|
public Fido2Key(Fido2KeyData data, bool alreadyEncrypted = false)
|
||||||
|
{
|
||||||
|
BuildDomainModel(this, data, EncryptableProperties, alreadyEncrypted);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EncString NonDiscoverableId { get; set; }
|
||||||
|
public EncString KeyType { get; set; }
|
||||||
|
public EncString KeyAlgorithm { get; set; }
|
||||||
|
public EncString KeyCurve { get; set; }
|
||||||
|
public EncString KeyValue { get; set; }
|
||||||
|
public EncString RpId { get; set; }
|
||||||
|
public EncString RpName { get; set; }
|
||||||
|
public EncString UserHandle { get; set; }
|
||||||
|
public EncString UserName { get; set; }
|
||||||
|
public EncString Counter { get; set; }
|
||||||
|
|
||||||
|
public async Task<Fido2KeyView> DecryptAsync(string orgId)
|
||||||
|
{
|
||||||
|
return await DecryptObjAsync(new Fido2KeyView(), this, EncryptableProperties, orgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Fido2KeyData ToFido2KeyData()
|
||||||
|
{
|
||||||
|
var data = new Fido2KeyData();
|
||||||
|
BuildDataModel(this, data, EncryptableProperties);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ namespace Bit.Core.Models.Domain
|
||||||
{
|
{
|
||||||
PasswordRevisionDate = obj.PasswordRevisionDate;
|
PasswordRevisionDate = obj.PasswordRevisionDate;
|
||||||
Uris = obj.Uris?.Select(u => new LoginUri(u, alreadyEncrypted)).ToList();
|
Uris = obj.Uris?.Select(u => new LoginUri(u, alreadyEncrypted)).ToList();
|
||||||
|
Fido2Key = obj.Fido2Key != null ? new Fido2Key(obj.Fido2Key, alreadyEncrypted) : null;
|
||||||
BuildDomainModel(this, obj, new HashSet<string>
|
BuildDomainModel(this, obj, new HashSet<string>
|
||||||
{
|
{
|
||||||
"Username",
|
"Username",
|
||||||
|
@ -28,6 +29,7 @@ namespace Bit.Core.Models.Domain
|
||||||
public EncString Password { get; set; }
|
public EncString Password { get; set; }
|
||||||
public DateTime? PasswordRevisionDate { get; set; }
|
public DateTime? PasswordRevisionDate { get; set; }
|
||||||
public EncString Totp { get; set; }
|
public EncString Totp { get; set; }
|
||||||
|
public Fido2Key Fido2Key { get; set; }
|
||||||
|
|
||||||
public async Task<LoginView> DecryptAsync(string orgId)
|
public async Task<LoginView> DecryptAsync(string orgId)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +47,10 @@ namespace Bit.Core.Models.Domain
|
||||||
view.Uris.Add(await uri.DecryptAsync(orgId));
|
view.Uris.Add(await uri.DecryptAsync(orgId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Fido2Key != null)
|
||||||
|
{
|
||||||
|
view.Fido2Key = await Fido2Key.DecryptAsync(orgId);
|
||||||
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +68,10 @@ namespace Bit.Core.Models.Domain
|
||||||
{
|
{
|
||||||
l.Uris = Uris.Select(u => u.ToLoginUriData()).ToList();
|
l.Uris = Uris.Select(u => u.ToLoginUriData()).ToList();
|
||||||
}
|
}
|
||||||
|
if (Fido2Key != null)
|
||||||
|
{
|
||||||
|
l.Fido2Key = Fido2Key.ToFido2KeyData();
|
||||||
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ namespace Bit.Core.Models.Request
|
||||||
Username = cipher.Login.Username?.EncryptedString,
|
Username = cipher.Login.Username?.EncryptedString,
|
||||||
Password = cipher.Login.Password?.EncryptedString,
|
Password = cipher.Login.Password?.EncryptedString,
|
||||||
PasswordRevisionDate = cipher.Login.PasswordRevisionDate,
|
PasswordRevisionDate = cipher.Login.PasswordRevisionDate,
|
||||||
Totp = cipher.Login.Totp?.EncryptedString
|
Totp = cipher.Login.Totp?.EncryptedString,
|
||||||
|
Fido2Key = cipher.Login.Fido2Key != null ? new Fido2KeyApi(cipher.Login.Fido2Key) : null
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case CipherType.Card:
|
case CipherType.Card:
|
||||||
|
@ -73,6 +74,9 @@ namespace Bit.Core.Models.Request
|
||||||
Type = cipher.SecureNote.Type
|
Type = cipher.SecureNote.Type
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
Fido2Key = new Fido2KeyApi(cipher.Fido2Key);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -118,6 +122,7 @@ namespace Bit.Core.Models.Request
|
||||||
public SecureNoteApi SecureNote { get; set; }
|
public SecureNoteApi SecureNote { get; set; }
|
||||||
public CardApi Card { get; set; }
|
public CardApi Card { get; set; }
|
||||||
public IdentityApi Identity { get; set; }
|
public IdentityApi Identity { get; set; }
|
||||||
|
public Fido2KeyApi Fido2Key { get; set; }
|
||||||
public List<FieldApi> Fields { get; set; }
|
public List<FieldApi> Fields { get; set; }
|
||||||
public List<PasswordHistoryRequest> PasswordHistory { get; set; }
|
public List<PasswordHistoryRequest> PasswordHistory { get; set; }
|
||||||
public Dictionary<string, string> Attachments { get; set; }
|
public Dictionary<string, string> Attachments { get; set; }
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace Bit.Core.Models.Response
|
||||||
public CardApi Card { get; set; }
|
public CardApi Card { get; set; }
|
||||||
public IdentityApi Identity { get; set; }
|
public IdentityApi Identity { get; set; }
|
||||||
public SecureNoteApi SecureNote { get; set; }
|
public SecureNoteApi SecureNote { get; set; }
|
||||||
|
public Fido2KeyApi Fido2Key { get; set; }
|
||||||
public bool Favorite { get; set; }
|
public bool Favorite { get; set; }
|
||||||
public bool Edit { get; set; }
|
public bool Edit { get; set; }
|
||||||
public bool ViewPassword { get; set; } = true; // Fallback for old server versions
|
public bool ViewPassword { get; set; } = true; // Fallback for old server versions
|
||||||
|
@ -28,5 +29,6 @@ namespace Bit.Core.Models.Response
|
||||||
public List<string> CollectionIds { get; set; }
|
public List<string> CollectionIds { get; set; }
|
||||||
public DateTime? DeletedDate { get; set; }
|
public DateTime? DeletedDate { get; set; }
|
||||||
public CipherRepromptType Reprompt { get; set; }
|
public CipherRepromptType Reprompt { get; set; }
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ using Bit.Core.Models.Domain;
|
||||||
|
|
||||||
namespace Bit.Core.Models.View
|
namespace Bit.Core.Models.View
|
||||||
{
|
{
|
||||||
public class CipherView : View
|
public class CipherView : View, ILaunchableView
|
||||||
{
|
{
|
||||||
public CipherView() { }
|
public CipherView() { }
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ namespace Bit.Core.Models.View
|
||||||
LocalData = c.LocalData;
|
LocalData = c.LocalData;
|
||||||
CollectionIds = c.CollectionIds;
|
CollectionIds = c.CollectionIds;
|
||||||
RevisionDate = c.RevisionDate;
|
RevisionDate = c.RevisionDate;
|
||||||
|
CreationDate = c.CreationDate;
|
||||||
DeletedDate = c.DeletedDate;
|
DeletedDate = c.DeletedDate;
|
||||||
Reprompt = c.Reprompt;
|
Reprompt = c.Reprompt;
|
||||||
}
|
}
|
||||||
|
@ -42,11 +43,13 @@ namespace Bit.Core.Models.View
|
||||||
public IdentityView Identity { get; set; }
|
public IdentityView Identity { get; set; }
|
||||||
public CardView Card { get; set; }
|
public CardView Card { get; set; }
|
||||||
public SecureNoteView SecureNote { get; set; }
|
public SecureNoteView SecureNote { get; set; }
|
||||||
|
public Fido2KeyView Fido2Key { get; set; }
|
||||||
public List<AttachmentView> Attachments { get; set; }
|
public List<AttachmentView> Attachments { get; set; }
|
||||||
public List<FieldView> Fields { get; set; }
|
public List<FieldView> Fields { get; set; }
|
||||||
public List<PasswordHistoryView> PasswordHistory { get; set; }
|
public List<PasswordHistoryView> PasswordHistory { get; set; }
|
||||||
public HashSet<string> CollectionIds { get; set; }
|
public HashSet<string> CollectionIds { get; set; }
|
||||||
public DateTime RevisionDate { get; set; }
|
public DateTime RevisionDate { get; set; }
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
public DateTime? DeletedDate { get; set; }
|
public DateTime? DeletedDate { get; set; }
|
||||||
public CipherRepromptType Reprompt { get; set; }
|
public CipherRepromptType Reprompt { get; set; }
|
||||||
|
|
||||||
|
@ -64,6 +67,8 @@ namespace Bit.Core.Models.View
|
||||||
return Card;
|
return Card;
|
||||||
case CipherType.Identity:
|
case CipherType.Identity:
|
||||||
return Identity;
|
return Identity;
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
return Fido2Key;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -110,5 +115,10 @@ namespace Bit.Core.Models.View
|
||||||
return LinkedFieldOptions.Find(lfo => lfo.Value == id).Key;
|
return LinkedFieldOptions.Find(lfo => lfo.Value == id).Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ComparableName => Name + Login?.Username + Fido2Key?.UserName;
|
||||||
|
|
||||||
|
public bool CanLaunch => Login?.CanLaunch == true || Fido2Key?.CanLaunch == true;
|
||||||
|
|
||||||
|
public string LaunchUri => Login?.LaunchUri ?? Fido2Key?.LaunchUri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
26
src/Core/Models/View/Fido2KeyView.cs
Normal file
26
src/Core/Models/View/Fido2KeyView.cs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Bit.Core.Enums;
|
||||||
|
|
||||||
|
namespace Bit.Core.Models.View
|
||||||
|
{
|
||||||
|
public class Fido2KeyView : ItemView, ILaunchableView
|
||||||
|
{
|
||||||
|
public string NonDiscoverableId { get; set; }
|
||||||
|
public string KeyType { get; set; } = Constants.DefaultFido2KeyType;
|
||||||
|
public string KeyAlgorithm { get; set; } = Constants.DefaultFido2KeyAlgorithm;
|
||||||
|
public string KeyCurve { get; set; } = Constants.DefaultFido2KeyCurve;
|
||||||
|
public string KeyValue { get; set; }
|
||||||
|
public string RpId { get; set; }
|
||||||
|
public string RpName { get; set; }
|
||||||
|
public string UserHandle { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string Counter { get; set; }
|
||||||
|
|
||||||
|
public override string SubTitle => UserName;
|
||||||
|
public override List<KeyValuePair<string, LinkedIdType>> LinkedFieldOptions => new List<KeyValuePair<string, LinkedIdType>>();
|
||||||
|
public bool CanLaunch => !string.IsNullOrEmpty(RpId);
|
||||||
|
public string LaunchUri => $"https://{RpId}";
|
||||||
|
|
||||||
|
public bool IsUniqueAgainst(Fido2KeyView fido2View) => fido2View?.RpId != RpId || fido2View?.UserName != UserName;
|
||||||
|
}
|
||||||
|
}
|
8
src/Core/Models/View/ILaunchableView.cs
Normal file
8
src/Core/Models/View/ILaunchableView.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Bit.Core.Models.View
|
||||||
|
{
|
||||||
|
public interface ILaunchableView
|
||||||
|
{
|
||||||
|
bool CanLaunch { get; }
|
||||||
|
string LaunchUri { get; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ using Bit.Core.Utilities;
|
||||||
|
|
||||||
namespace Bit.Core.Models.View
|
namespace Bit.Core.Models.View
|
||||||
{
|
{
|
||||||
public class LoginUriView : View
|
public class LoginUriView : View, ILaunchableView
|
||||||
{
|
{
|
||||||
private HashSet<string> _canLaunchWhitelist = new HashSet<string>
|
private HashSet<string> _canLaunchWhitelist = new HashSet<string>
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace Bit.Core.Models.View
|
||||||
public DateTime? PasswordRevisionDate { get; set; }
|
public DateTime? PasswordRevisionDate { get; set; }
|
||||||
public string Totp { get; set; }
|
public string Totp { get; set; }
|
||||||
public List<LoginUriView> Uris { get; set; }
|
public List<LoginUriView> Uris { get; set; }
|
||||||
|
public Fido2KeyView Fido2Key { get; set; }
|
||||||
|
|
||||||
public string Uri => HasUris ? Uris[0].Uri : null;
|
public string Uri => HasUris ? Uris[0].Uri : null;
|
||||||
public string MaskedPassword => Password != null ? "••••••••" : null;
|
public string MaskedPassword => Password != null ? "••••••••" : null;
|
||||||
public override string SubTitle => Username;
|
public override string SubTitle => Username;
|
||||||
|
|
|
@ -176,6 +176,7 @@ namespace Bit.Core.Services
|
||||||
OrganizationId = model.OrganizationId,
|
OrganizationId = model.OrganizationId,
|
||||||
Type = model.Type,
|
Type = model.Type,
|
||||||
CollectionIds = model.CollectionIds,
|
CollectionIds = model.CollectionIds,
|
||||||
|
CreationDate = model.CreationDate,
|
||||||
RevisionDate = model.RevisionDate,
|
RevisionDate = model.RevisionDate,
|
||||||
Reprompt = model.Reprompt
|
Reprompt = model.Reprompt
|
||||||
};
|
};
|
||||||
|
@ -531,8 +532,13 @@ namespace Bit.Core.Services
|
||||||
await UpsertAsync(data);
|
await UpsertAsync(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShareWithServerAsync(CipherView cipher, string organizationId, HashSet<string> collectionIds)
|
public async Task<ICipherService.ShareWithServerError> ShareWithServerAsync(CipherView cipher, string organizationId, HashSet<string> collectionIds)
|
||||||
{
|
{
|
||||||
|
if (!await ValidateCanBeSharedWithOrgAsync(cipher, organizationId))
|
||||||
|
{
|
||||||
|
return ICipherService.ShareWithServerError.DuplicatedPasskeyInOrg;
|
||||||
|
}
|
||||||
|
|
||||||
var attachmentTasks = new List<Task>();
|
var attachmentTasks = new List<Task>();
|
||||||
if (cipher.Attachments != null)
|
if (cipher.Attachments != null)
|
||||||
{
|
{
|
||||||
|
@ -553,6 +559,34 @@ namespace Bit.Core.Services
|
||||||
var userId = await _stateService.GetActiveUserIdAsync();
|
var userId = await _stateService.GetActiveUserIdAsync();
|
||||||
var data = new CipherData(response, userId, collectionIds);
|
var data = new CipherData(response, userId, collectionIds);
|
||||||
await UpsertAsync(data);
|
await UpsertAsync(data);
|
||||||
|
|
||||||
|
return ICipherService.ShareWithServerError.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> ValidateCanBeSharedWithOrgAsync(CipherView cipher, string organizationId)
|
||||||
|
{
|
||||||
|
if (cipher.Login?.Fido2Key is null && cipher.Fido2Key is null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var decCiphers = await GetAllDecryptedAsync();
|
||||||
|
var orgCiphers = decCiphers.Where(c => c.OrganizationId == organizationId);
|
||||||
|
if (cipher.Login?.Fido2Key != null)
|
||||||
|
{
|
||||||
|
return !orgCiphers.Any(c => !cipher.Login.Fido2Key.IsUniqueAgainst(c.Login?.Fido2Key)
|
||||||
|
||
|
||||||
|
!cipher.Login.Fido2Key.IsUniqueAgainst(c.Fido2Key));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cipher.Fido2Key != null)
|
||||||
|
{
|
||||||
|
return !orgCiphers.Any(c => !cipher.Fido2Key.IsUniqueAgainst(c.Login?.Fido2Key)
|
||||||
|
||
|
||||||
|
!cipher.Fido2Key.IsUniqueAgainst(c.Fido2Key));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Cipher> SaveAttachmentRawWithServerAsync(Cipher cipher, string filename, byte[] data)
|
public async Task<Cipher> SaveAttachmentRawWithServerAsync(Cipher cipher, string filename, byte[] data)
|
||||||
|
@ -1104,6 +1138,11 @@ namespace Bit.Core.Services
|
||||||
cipher.Login.Uris.Add(loginUri);
|
cipher.Login.Uris.Add(loginUri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (model.Login.Fido2Key != null)
|
||||||
|
{
|
||||||
|
cipher.Login.Fido2Key = new Fido2Key();
|
||||||
|
await EncryptObjPropertyAsync(model.Login.Fido2Key, cipher.Login.Fido2Key, Fido2Key.EncryptableProperties, key);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CipherType.SecureNote:
|
case CipherType.SecureNote:
|
||||||
cipher.SecureNote = new SecureNote
|
cipher.SecureNote = new SecureNote
|
||||||
|
@ -1147,6 +1186,10 @@ namespace Bit.Core.Services
|
||||||
"LicenseNumber"
|
"LicenseNumber"
|
||||||
}, key);
|
}, key);
|
||||||
break;
|
break;
|
||||||
|
case CipherType.Fido2Key:
|
||||||
|
cipher.Fido2Key = new Fido2Key();
|
||||||
|
await EncryptObjPropertyAsync(model.Fido2Key, cipher.Fido2Key, Fido2Key.EncryptableProperties, key);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception("Unknown cipher type.");
|
throw new Exception("Unknown cipher type.");
|
||||||
}
|
}
|
||||||
|
@ -1229,8 +1272,8 @@ namespace Bit.Core.Services
|
||||||
|
|
||||||
public int Compare(CipherView a, CipherView b)
|
public int Compare(CipherView a, CipherView b)
|
||||||
{
|
{
|
||||||
var aName = a?.Name;
|
var aName = a?.ComparableName;
|
||||||
var bName = b?.Name;
|
var bName = b?.ComparableName;
|
||||||
if (aName == null && bName != null)
|
if (aName == null && bName != null)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1243,19 +1286,6 @@ namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
var result = _i18nService.StringComparer.Compare(aName, bName);
|
|
||||||
if (result != 0 || a.Type != CipherType.Login || b.Type != CipherType.Login)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (a.Login.Username != null)
|
|
||||||
{
|
|
||||||
aName += a.Login.Username;
|
|
||||||
}
|
|
||||||
if (b.Login.Username != null)
|
|
||||||
{
|
|
||||||
bName += b.Login.Username;
|
|
||||||
}
|
|
||||||
return _i18nService.StringComparer.Compare(aName, bName);
|
return _i18nService.StringComparer.Compare(aName, bName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
src/Core/Utilities/CipherTypeExtensions.cs
Normal file
14
src/Core/Utilities/CipherTypeExtensions.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using Bit.Core.Enums;
|
||||||
|
|
||||||
|
namespace Bit.Core.Utilities
|
||||||
|
{
|
||||||
|
public static class CipherTypeExtensions
|
||||||
|
{
|
||||||
|
public static bool IsEqualToOrCanSignIn(this CipherType type, CipherType type2)
|
||||||
|
{
|
||||||
|
return type == type2
|
||||||
|
||
|
||||||
|
(type == CipherType.Login && type2 == CipherType.Fido2Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue