Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ export class KeyManagerFactory {
static async getKeyManagerForContext(
keyId: string,
context: "onboarding" | "signing" | "verification" | "pre-verification",
isFake: boolean,
): Promise<KeyManager> {
const config: KeyManagerConfig = {
keyId,
useHardware: context !== "pre-verification",
useHardware: isFake
? false
: context !== "pre-verification" &&
(await KeyManagerFactory.isHardwareAvailable()),
preVerificationMode: context === "pre-verification",
};

Expand Down
14 changes: 14 additions & 0 deletions infrastructure/eid-wallet/src/lib/global/controllers/key.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { KeyManagerFactory } from "$lib/crypto";
import type { KeyManager } from "$lib/crypto";
import type { Store } from "@tauri-apps/plugin-store";
import type { UserController } from "./user";

export type KeyServiceContext =
| "onboarding"
Expand Down Expand Up @@ -72,9 +73,22 @@ export class KeyService {
this.#managerCache.delete(cacheKey);
}

const isFake = await this.#store
.get<boolean>("fake")
.then((f) => {
if (!f) {
return undefined;
}
return f;
})
.catch((error) => {
console.error("Failed to get fake:", error);
return undefined;
});
const manager = await KeyManagerFactory.getKeyManagerForContext(
keyId,
context,
isFake ?? false,
Comment thread
sosweetham marked this conversation as resolved.
Outdated
);
this.#managerCache.set(cacheKey, manager);
await this.#persistContext(cacheKey, manager, keyId, context);
Expand Down