-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-1222] Passkeys in the Bitwarden vault (#2679)
* [EC-598] feat: add support for saving fido2 keys * [EC-598] feat: add additional data * [EC-598] feat: add counter, nonDiscoverableId; remove origin * [EC-598] fix: previous incomplete commit * [EC-598] fix: previous incomplete commit.. again * [EC-598] fix: failed merge * [EC-598] fix: move files around to match new structure * [EC-598] feat: add implementation for non-discoverable credentials * [EC-598] chore: remove some changes introduced by vs * [EC-598] fix: linting issues * [PM-1500] Add feature flag to enable pass keys (#2916) * Added feature flag to enable pass keys * Renamed enable pass keys to fido2 vault credentials * only sync fido2key ciphers on clients >=2023.9.0 (#3244) * Renamed fido2key property username to userDisplayName (#3172) * [PM-1859] Renamed NonDiscoverableId to credentialId (#3198) * PM-1859 Refactor to credentialId * PM-1859 Removed unnecessary import --------- Co-authored-by: Andreas Coroiu <[email protected]> * [PM-3807] Store all passkeys as login cipher type (#3261) * [PM-3807] feat: add discoverable property to fido2key * [PM-3807] feat: remove standalone Fido2Key * [PM-3807] chore: clean up unusued constant * [PM-3807] fix: remove standadlone Fido2Key property that I missed * [PM-3807] Store passkeys in array (#3268) * [PM-3807] feat: store passkeys in array * [PM-3807] amazing adventures with the c# linter * [PM-3980] Added creationDate property to the Fido2Key object (#3279) * Added creationDate property to the Fido2Key object * Fixed lint issues * fixed comments * made createionDate required * [PM-3808] [Storage v2] Add old client/new server backward compatibility (#3262) * [PM-3807] feat: add discoverable property to fido2key * [PM-3807] feat: remove standalone Fido2Key * [PM-3807] chore: clean up unusued constant * [PM-3808] feat: add fido2 compatibility check before saving ciphers * Resolved merge conflicts. * Setting minimum version for QA. --------- Co-authored-by: Todd Martin <[email protected]> * [PM-4054] Rename Fido2Key to Fido2Credential (#3306) * Add server version compatibility check for Fido2Credentials on sharing with org (#3328) * Added compatibility checks. * Refactored into separate methods for easier removal. * Added check on ShareMany * Updated method order to be consistent. * Linting * Updated minimum server version for release, as well as defaulting the feature on for self-hosted. * Added trailing space. * Removed extra assignment --------- Co-authored-by: gbubemismith <[email protected]> Co-authored-by: SmithThe4th <[email protected]> Co-authored-by: Todd Martin <[email protected]> Co-authored-by: Kyle Spearrin <[email protected]> Co-authored-by: Carlos Gonçalves <[email protected]> Co-authored-by: Todd Martin <[email protected]> Co-authored-by: Oscar Hinton <[email protected]>
- Loading branch information
1 parent
8177821
commit 8c77c65
Showing
8 changed files
with
151 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using Bit.Core.Utilities; | ||
using Bit.Core.Vault.Models.Data; | ||
|
||
namespace Bit.Api.Vault.Models; | ||
|
||
public class CipherFido2CredentialModel | ||
{ | ||
public CipherFido2CredentialModel() { } | ||
|
||
public CipherFido2CredentialModel(CipherLoginFido2CredentialData data) | ||
{ | ||
CredentialId = data.CredentialId; | ||
KeyType = data.KeyType; | ||
KeyAlgorithm = data.KeyAlgorithm; | ||
KeyCurve = data.KeyCurve; | ||
KeyValue = data.KeyValue; | ||
RpId = data.RpId; | ||
RpName = data.RpName; | ||
UserHandle = data.UserHandle; | ||
UserDisplayName = data.UserDisplayName; | ||
Counter = data.Counter; | ||
Discoverable = data.Discoverable; | ||
CreationDate = data.CreationDate; | ||
} | ||
|
||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string CredentialId { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string KeyType { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string KeyAlgorithm { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string KeyCurve { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string KeyValue { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string RpId { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string RpName { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string UserHandle { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string UserDisplayName { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string Counter { get; set; } | ||
[EncryptedString] | ||
[EncryptedStringLength(1000)] | ||
public string Discoverable { get; set; } | ||
[Required] | ||
public DateTime CreationDate { get; set; } | ||
|
||
public CipherLoginFido2CredentialData ToCipherLoginFido2CredentialData() | ||
{ | ||
return new CipherLoginFido2CredentialData | ||
{ | ||
CredentialId = CredentialId, | ||
KeyType = KeyType, | ||
KeyAlgorithm = KeyAlgorithm, | ||
KeyCurve = KeyCurve, | ||
KeyValue = KeyValue, | ||
RpId = RpId, | ||
RpName = RpName, | ||
UserHandle = UserHandle, | ||
UserDisplayName = UserDisplayName, | ||
Counter = Counter, | ||
Discoverable = Discoverable, | ||
CreationDate = CreationDate | ||
}; | ||
} | ||
} | ||
|
||
static class CipherFido2CredentialModelExtensions | ||
{ | ||
public static CipherLoginFido2CredentialData[] ToCipherLoginFido2CredentialData(this CipherFido2CredentialModel[] models) | ||
{ | ||
return models.Select(m => m.ToCipherLoginFido2CredentialData()).ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,5 @@ public enum CipherType : byte | |
Login = 1, | ||
SecureNote = 2, | ||
Card = 3, | ||
Identity = 4 | ||
Identity = 4, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Core/Vault/Models/Data/CipherLoginFido2CredentialData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Bit.Core.Vault.Models.Data; | ||
|
||
public class CipherLoginFido2CredentialData | ||
{ | ||
public CipherLoginFido2CredentialData() { } | ||
|
||
public string CredentialId { get; set; } | ||
public string KeyType { get; set; } | ||
public string KeyAlgorithm { get; set; } | ||
public string KeyCurve { get; set; } | ||
public string KeyValue { get; set; } | ||
public string RpId { get; set; } | ||
public string RpName { get; set; } | ||
public string UserHandle { get; set; } | ||
public string UserDisplayName { get; set; } | ||
public string Counter { get; set; } | ||
public string Discoverable { get; set; } | ||
public DateTime CreationDate { get; set; } | ||
} |