Skip to content

Commit

Permalink
[PM-3807] Store passkeys in array (#3268)
Browse files Browse the repository at this point in the history
* [PM-3807] feat: store passkeys in array

* [PM-3807] amazing adventures with the c# linter
  • Loading branch information
coroiu committed Sep 15, 2023
1 parent e074d18 commit 5857171
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/Api/Vault/Models/CipherFido2KeyModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@ public CipherLoginFido2KeyData ToCipherLoginFido2KeyData()
};
}
}

static class CipherFido2KeyModelExtensions
{
public static CipherLoginFido2KeyData[] ToCipherLoginFido2KeyData(this CipherFido2KeyModel[] models)
{
return models.Select(m => m.ToCipherLoginFido2KeyData()).ToArray();
}
}
6 changes: 3 additions & 3 deletions src/Api/Vault/Models/CipherLoginModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public CipherLoginModel(CipherLoginData data)
Uri = data.Uri;
}

if (data.Fido2Key != null)
if (data.Fido2Keys != null)
{
Fido2Key = new CipherFido2KeyModel(data.Fido2Key);
Fido2Keys = data.Fido2Keys.Select(key => new CipherFido2KeyModel(key)).ToArray();
}

Username = data.Username;
Expand Down Expand Up @@ -60,7 +60,7 @@ public string Uri
[EncryptedStringLength(1000)]
public string Totp { get; set; }
public bool? AutofillOnPageLoad { get; set; }
public CipherFido2KeyModel Fido2Key { get; set; }
public CipherFido2KeyModel[] Fido2Keys { get; set; }

public class CipherLoginUriModel
{
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Vault/Models/Request/CipherRequestModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private CipherLoginData ToCipherLoginData()
PasswordRevisionDate = Login.PasswordRevisionDate,
Totp = Login.Totp,
AutofillOnPageLoad = Login.AutofillOnPageLoad,
Fido2Key = Login.Fido2Key == null ? null : Login.Fido2Key.ToCipherLoginFido2KeyData(),
Fido2Keys = Login.Fido2Keys == null ? null : Login.Fido2Keys.ToCipherLoginFido2KeyData(),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Vault/Models/Data/CipherLoginData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public string Uri
public DateTime? PasswordRevisionDate { get; set; }
public string Totp { get; set; }
public bool? AutofillOnPageLoad { get; set; }
public CipherLoginFido2KeyData Fido2Key { get; set; }
public CipherLoginFido2KeyData[] Fido2Keys { get; set; }

public class CipherLoginUriData
{
Expand Down

0 comments on commit 5857171

Please sign in to comment.