1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-20 02:03:49 +00:00

[PM-3811] Passkeys unification (#2774)

* PM-3811 Unified passkeys view and moved both inside Login as an array of FIdo2Key

* PM-3811 Passkeys unification => updated cipher details view an helpers

* PM-3811 Updated passkeys creation date time format
This commit is contained in:
Federico Maccaroni
2023-09-22 11:55:35 -03:00
committed by GitHub
parent 6ef6cf5d84
commit a4a0d31fc6
28 changed files with 7367 additions and 5018 deletions

View File

@@ -43,7 +43,6 @@ namespace Bit.Core.Models.View
public IdentityView Identity { get; set; }
public CardView Card { get; set; }
public SecureNoteView SecureNote { get; set; }
public Fido2KeyView Fido2Key { get; set; }
public List<AttachmentView> Attachments { get; set; }
public List<FieldView> Fields { get; set; }
public List<PasswordHistoryView> PasswordHistory { get; set; }
@@ -67,8 +66,6 @@ namespace Bit.Core.Models.View
return Card;
case CipherType.Identity:
return Identity;
case CipherType.Fido2Key:
return Fido2Key;
default:
break;
}
@@ -115,12 +112,14 @@ namespace Bit.Core.Models.View
return LinkedFieldOptions.Find(lfo => lfo.Value == id).Key;
}
public string ComparableName => Name + Login?.Username + Fido2Key?.UserName;
public string ComparableName => Name + Login?.Username;
public bool CanLaunch => Login?.CanLaunch == true || Fido2Key?.CanLaunch == true;
public bool CanLaunch => Login?.CanLaunch == true;
public string LaunchUri => Login?.LaunchUri ?? Fido2Key?.LaunchUri;
public string LaunchUri => Login?.LaunchUri;
public bool IsClonable => OrganizationId is null && Type != CipherType.Fido2Key;
public bool IsClonable => OrganizationId is null;
public bool HasFido2Key => Type == CipherType.Login && Login?.HasFido2Keys == true;
}
}

View File

@@ -5,7 +5,8 @@ namespace Bit.Core.Models.View
{
public class Fido2KeyView : ItemView, ILaunchableView
{
public string NonDiscoverableId { get; set; }
public string CredentialId { get; set; }
public string Discoverable { get; set; }
public string KeyType { get; set; } = Constants.DefaultFido2KeyType;
public string KeyAlgorithm { get; set; } = Constants.DefaultFido2KeyAlgorithm;
public string KeyCurve { get; set; } = Constants.DefaultFido2KeyCurve;
@@ -18,6 +19,7 @@ namespace Bit.Core.Models.View
public override string SubTitle => UserName;
public override List<KeyValuePair<string, LinkedIdType>> LinkedFieldOptions => new List<KeyValuePair<string, LinkedIdType>>();
public bool IsDiscoverable => !string.IsNullOrWhiteSpace(Discoverable);
public bool CanLaunch => !string.IsNullOrEmpty(RpId);
public string LaunchUri => $"https://{RpId}";

View File

@@ -20,7 +20,7 @@ namespace Bit.Core.Models.View
public DateTime? PasswordRevisionDate { get; set; }
public string Totp { get; set; }
public List<LoginUriView> Uris { get; set; }
public Fido2KeyView Fido2Key { get; set; }
public List<Fido2KeyView> Fido2Keys { get; set; }
public string Uri => HasUris ? Uris[0].Uri : null;
public string MaskedPassword => Password != null ? "••••••••" : null;
@@ -28,6 +28,8 @@ namespace Bit.Core.Models.View
public bool CanLaunch => HasUris && Uris.Any(u => u.CanLaunch);
public string LaunchUri => HasUris ? Uris.FirstOrDefault(u => u.CanLaunch)?.LaunchUri : null;
public bool HasUris => (Uris?.Count ?? 0) > 0;
public bool HasFido2Keys => Fido2Keys?.Any() == true;
public Fido2KeyView MainFido2Key => HasFido2Keys ? Fido2Keys[0] : null;
public override List<KeyValuePair<string, LinkedIdType>> LinkedFieldOptions
{