Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address PR feedback #6572

4 changes: 2 additions & 2 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2503,8 +2503,8 @@
"choosePasskey": {
"message": "Choose a login to save this passkey to"
},
"fido2Item": {
"message": "Fido2 Item"
"passkeyItem": {
"message": "Passkey Item"
},
"overwritePasskey": {
"message": "Overwrite passkey?"
Expand Down
11 changes: 10 additions & 1 deletion apps/browser/src/platform/browser/browser-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,16 @@ export class BrowserApi {

BrowserApi.messageListener("message", handler);

return () => chrome.runtime.onMessage.removeListener(handler);
return () => {
chrome.runtime.onMessage.removeListener(handler);

if (BrowserApi.isSafariApi) {
const index = BrowserApi.registeredMessageListeners.indexOf(handler);
if (index !== -1) {
BrowserApi.registeredMessageListeners.splice(index, 1);
}
}
};
});
}

Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/popup/services/popup-utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class PopupUtilsService {
href = win.location.href;
}

if (chrome?.windows?.create != null) {
if (typeof chrome !== "undefined" && chrome?.windows?.create != null) {
if (href.indexOf("?uilocation=") > -1) {
href = href
.replace("uilocation=popup", "uilocation=popout")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="useBrowserlink" *ngIf="(fido2PopoutSessionData$ | async).fallbackSupported">
<a [routerLink]="[]" (click)="abort()">
<button appStopClick type="button" (click)="abort()">
{{ "useBrowserName" | i18n }}
</a>
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*ngFor="let cipherItem of displayedCiphers"
[cipher]="cipherItem"
[isSearching]="searchPending"
title="{{ 'fido2Item' | i18n }}"
title="{{ 'passkeyItem' | i18n }}"
(onSelected)="selectedPasskey($event)"
[isSelected]="cipher === cipherItem"
></app-fido2-cipher-row>
Expand Down Expand Up @@ -108,7 +108,7 @@
<app-fido2-cipher-row
*ngFor="let cipherItem of displayedCiphers"
[cipher]="cipherItem"
title="{{ 'fido2Item' | i18n }}"
title="{{ 'passkeyItem' | i18n }}"
(onSelected)="selectedPasskey($event)"
[isSelected]="cipher === cipherItem"
></app-fido2-cipher-row>
Expand All @@ -131,9 +131,9 @@
</ng-container>
</ng-container>
<div class="useBrowserlink">
<a [routerLink]="[]" *ngIf="data.fallbackSupported" (click)="abort(true)">
<button *ngIf="data.fallbackSupported" appStopClick type="button" (click)="abort(true)">
{{ "useBrowserName" | i18n }}
</a>
</button>
</div>
</div>
</ng-container>
6 changes: 0 additions & 6 deletions apps/desktop/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2419,12 +2419,6 @@
"typePasskey": {
"message": "Passkey"
},
"application": {
"message": "Application"
},
"duplicatePasskey": {
"message": "A passkey with this ID already exists in this organization."
},
"passkeyNotCopied": {
"message": "Passkey will not be copied"
},
Expand Down
6 changes: 0 additions & 6 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7269,12 +7269,6 @@
"typePasskey": {
"message": "Passkey"
},
"application": {
"message": "Application"
},
"duplicatePasskey": {
"message": "A passkey with this ID already exists in this organization."
},
"passkeyNotCopied": {
"message": "Passkey will not be copied"
},
Expand Down
24 changes: 24 additions & 0 deletions libs/common/src/models/export/fido2-credential.export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { EncString } from "../../platform/models/domain/enc-string";
import { Fido2Credential } from "../../vault/models/domain/fido2-credential";
import { Fido2CredentialView } from "../../vault/models/view/fido2-credential.view";

/**
* Represents format of Fido2 Credentials in JSON exports.
*/
export class Fido2CredentialExport {
/**
* Generates a template for Fido2CredentialExport
* @returns Instance of Fido2CredentialExport with predefined values.
*/
static template(): Fido2CredentialExport {
const req = new Fido2CredentialExport();
req.credentialId = "keyId";
Expand All @@ -20,6 +27,12 @@ export class Fido2CredentialExport {
return req;
}

/**
* Converts a Fido2CredentialExport object to its view representation.
* @param req - The Fido2CredentialExport object to be converted.
* @param view - (Optional) The Fido2CredentialView object to popualte with Fido2CredentialExport data
* @returns Fido2CredentialView - The populated view, or a new instance if none was provided.
*/
static toView(req: Fido2CredentialExport, view = new Fido2CredentialView()) {
view.credentialId = req.credentialId;
view.keyType = req.keyType as "public-key";
Expand All @@ -36,6 +49,12 @@ export class Fido2CredentialExport {
return view;
}

/**
* Converts a Fido2CredentialExport object to its domain representation.
* @param req - The Fido2CredentialExport object to be converted.
* @param domain - (Optional) The Fido2Credential object to popualte with Fido2CredentialExport data
* @returns Fido2Credential - The populated domain, or a new instance if none was provided.
*/
static toDomain(req: Fido2CredentialExport, domain = new Fido2Credential()) {
domain.credentialId = req.credentialId != null ? new EncString(req.credentialId) : null;
domain.keyType = req.keyType != null ? new EncString(req.keyType) : null;
Expand Down Expand Up @@ -66,6 +85,11 @@ export class Fido2CredentialExport {
discoverable: string;
creationDate: Date;

/**
* Constructs a new Fid2CredentialExport instance.
*
* @param o - The credential storing the data being exported. When not provided, an empty export is created instead.
*/
constructor(o?: Fido2CredentialView | Fido2Credential) {
if (o == null) {
return;
Expand Down
3 changes: 2 additions & 1 deletion libs/common/src/models/export/login.export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export class LoginExport {
domain.username = req.username != null ? new EncString(req.username) : null;
domain.password = req.password != null ? new EncString(req.password) : null;
domain.totp = req.totp != null ? new EncString(req.totp) : null;
//left out fido2Credential for now
// Fido2credentials are currently not supported for exports.

return domain;
}

Expand Down
Loading