mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 21:50:15 +00:00
update cipher handling
This commit is contained in:
@@ -160,6 +160,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
|
||||
}
|
||||
|
||||
async getRpId(): Promise<string> {
|
||||
console.log("getRpId");
|
||||
return lastValueFrom(
|
||||
this.rpId.pipe(
|
||||
filter((id) => id != null),
|
||||
@@ -215,6 +216,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
|
||||
userVerification,
|
||||
rpId,
|
||||
);
|
||||
this.rpId.next(rpId);
|
||||
|
||||
try {
|
||||
await this.showUi("/passkey-create");
|
||||
@@ -262,7 +264,6 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
|
||||
*/
|
||||
async createCipher({ credentialName, userName, rpId }: NewCredentialParams): Promise<Cipher> {
|
||||
// Store the passkey on a new cipher to avoid replacing something important
|
||||
this.rpId.next(rpId);
|
||||
|
||||
const cipher = new CipherView();
|
||||
cipher.name = credentialName;
|
||||
|
||||
@@ -62,21 +62,30 @@ export class Fido2CreateComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
console.log("fido2 create component");
|
||||
this.session = this.fido2UserInterfaceService.getCurrentSession();
|
||||
|
||||
console.log(this.session, "session");
|
||||
const rpid = await this.session.getRpId();
|
||||
const equivalentDomains = await firstValueFrom(
|
||||
this.domainSettingsService.getUrlEquivalentDomains(rpid),
|
||||
);
|
||||
|
||||
console.log(rpid, "webdomain stuff");
|
||||
|
||||
this.cipherService
|
||||
.getPasskeyCiphersForUrl(rpid)
|
||||
.getAllDecrypted()
|
||||
.then((ciphers) => {
|
||||
const relevantCiphers = ciphers.filter(
|
||||
(cipher) =>
|
||||
cipher.login.matchesUri(rpid, equivalentDomains) &&
|
||||
(!cipher.login.fido2Credentials || cipher.login.fido2Credentials.length === 0),
|
||||
);
|
||||
console.log(ciphers, "ciphers from url");
|
||||
const relevantCiphers = ciphers.filter((cipher) => {
|
||||
if (!cipher.login) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
cipher.login.uri === rpid &&
|
||||
(!cipher.login.fido2Credentials || cipher.login.fido2Credentials.length === 0)
|
||||
);
|
||||
});
|
||||
this.ciphersSubject.next(relevantCiphers);
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
@@ -46,7 +46,6 @@ export abstract class CipherService implements UserKeyRotationDataProvider<Ciphe
|
||||
defaultMatch?: UriMatchStrategySetting,
|
||||
) => Promise<CipherView[]>;
|
||||
getAllDecryptedForIds: (ids: string[]) => Promise<CipherView[]>;
|
||||
getPasskeyCiphersForUrl: (url: string) => Promise<CipherView[]>;
|
||||
getPasskeyCiphers: () => Promise<CipherView[]>;
|
||||
filterCiphersForUrl: (
|
||||
ciphers: CipherView[],
|
||||
|
||||
@@ -1637,14 +1637,6 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
}
|
||||
}
|
||||
|
||||
async getPasskeyCiphersForUrl(url: string): Promise<CipherView[]> {
|
||||
let ciphers = await this.getAllDecryptedForUrl(url);
|
||||
if (!ciphers) {
|
||||
return null;
|
||||
}
|
||||
ciphers = ciphers.filter((cipher) => cipher.login.fido2Credentials?.length);
|
||||
return ciphers;
|
||||
}
|
||||
async getPasskeyCiphers(): Promise<CipherView[]> {
|
||||
let ciphers = await this.getAllDecrypted();
|
||||
if (!ciphers) {
|
||||
|
||||
Reference in New Issue
Block a user