mirror of
https://github.com/bitwarden/browser
synced 2026-02-28 02:23:25 +00:00
[PM-3807] Store passkeys as array (#6288)
* [PM-3807] feat: store passkeys as array * [PM-3807] fix: issues in views * [PM-3807] fix: additional view bugs * [PM-3807] fix: check array length * [PM-3807] fix: I secretly like build errors
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { JsonObject } from "type-fest";
|
||||
|
||||
import { Fido2KeyApi } from "../../vault/api/fido2-key.api";
|
||||
import { BaseResponse } from "../response/base.response";
|
||||
|
||||
@@ -10,7 +12,7 @@ export class LoginApi extends BaseResponse {
|
||||
passwordRevisionDate: string;
|
||||
totp: string;
|
||||
autofillOnPageLoad: boolean;
|
||||
fido2Key?: Fido2KeyApi;
|
||||
fido2Keys?: Fido2KeyApi[];
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
@@ -28,9 +30,9 @@ export class LoginApi extends BaseResponse {
|
||||
this.uris = uris.map((u: any) => new LoginUriApi(u));
|
||||
}
|
||||
|
||||
const fido2Key = this.getResponseProperty("Fido2Key");
|
||||
if (fido2Key != null) {
|
||||
this.fido2Key = new Fido2KeyApi(fido2Key);
|
||||
const fido2Keys = this.getResponseProperty("Fido2Keys");
|
||||
if (fido2Keys != null) {
|
||||
this.fido2Keys = fido2Keys.map((key: JsonObject) => new Fido2KeyApi(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export class LoginExport {
|
||||
req.username = "jdoe";
|
||||
req.password = "myp@ssword123";
|
||||
req.totp = "JBSWY3DPEHPK3PXP";
|
||||
req.fido2Key = Fido2KeyExport.template();
|
||||
req.fido2Keys = [Fido2KeyExport.template()];
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ export class LoginExport {
|
||||
view.username = req.username;
|
||||
view.password = req.password;
|
||||
view.totp = req.totp;
|
||||
if (req.fido2Key != null) {
|
||||
view.fido2Key = Fido2KeyExport.toView(req.fido2Key);
|
||||
if (req.fido2Keys != null) {
|
||||
view.fido2Keys = req.fido2Keys.map((key) => Fido2KeyExport.toView(key));
|
||||
}
|
||||
return view;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ export class LoginExport {
|
||||
username: string;
|
||||
password: string;
|
||||
totp: string;
|
||||
fido2Key: Fido2KeyExport = null;
|
||||
fido2Keys: Fido2KeyExport[] = [];
|
||||
|
||||
constructor(o?: LoginView | LoginDomain) {
|
||||
if (o == null) {
|
||||
@@ -59,8 +59,8 @@ export class LoginExport {
|
||||
}
|
||||
}
|
||||
|
||||
if (o.fido2Key != null) {
|
||||
this.fido2Key = new Fido2KeyExport(o.fido2Key);
|
||||
if (o.fido2Keys != null) {
|
||||
this.fido2Keys = o.fido2Keys.map((key) => new Fido2KeyExport(key));
|
||||
}
|
||||
|
||||
if (o instanceof LoginView) {
|
||||
|
||||
Reference in New Issue
Block a user