Skip to content

Commit

Permalink
Simplify types for userkey in foreground-browser-biometrics and runti…
Browse files Browse the repository at this point in the history
…me.background.ts
  • Loading branch information
quexten committed Jan 13, 2025
1 parent 0daad18 commit b230395
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions apps/browser/src/background/runtime.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ export default class RuntimeBackground {
return await this.main.biometricsService.getBiometricsStatus();
}
case BiometricsCommands.UnlockWithBiometricsForUser: {
const userKey = await this.main.biometricsService.unlockWithBiometricsForUser(msg.userId);
return userKey.keyB64;
return await this.main.biometricsService.unlockWithBiometricsForUser(msg.userId);
}
case BiometricsCommands.GetBiometricsStatusForUser: {
return await this.main.biometricsService.getBiometricsStatusForUser(msg.userId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
import { UserId } from "@bitwarden/common/types/guid";
import { UserKey } from "@bitwarden/common/types/key";
import { BiometricsCommands, BiometricsService, BiometricsStatus } from "@bitwarden/key-management";
Expand Down Expand Up @@ -29,13 +28,13 @@ export class ForegroundBrowserBiometricsService extends BiometricsService {

async unlockWithBiometricsForUser(userId: UserId): Promise<UserKey | null> {
const response = await BrowserApi.sendMessageWithResponse<{
result: string;
result: UserKey;
error: string;
}>(BiometricsCommands.UnlockWithBiometricsForUser, { userId });
if (!response.result) {
return null;
}
return SymmetricCryptoKey.fromString(response.result) as UserKey;
return response.result;

Check warning on line 37 in apps/browser/src/key-management/biometrics/foreground-browser-biometrics.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/key-management/biometrics/foreground-browser-biometrics.ts#L37

Added line #L37 was not covered by tests
}

async getBiometricsStatusForUser(id: UserId): Promise<BiometricsStatus> {
Expand Down

0 comments on commit b230395

Please sign in to comment.