Skip to content

Commit 7c24e89

Browse files
committed
Comments and error handling
1 parent fae6884 commit 7c24e89

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

typescript/packages/jumble/src/contexts/AuthenticationContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const AuthenticationProvider: React.FC<{ children: React.ReactNode }> = (
9191
if (!keyStore) {
9292
throw new Error("Key store not initialized");
9393
}
94-
// Pass the keyName to PassKey.get() if provided
94+
// if we can, we prompt directly for the passed credential
9595
const passkey = await PassKey.get({ allowCredentials: key ? [key] : [] });
9696
const root = await passkey.createRootKey();
9797
await keyStore.set(ROOT_KEY, root);
@@ -113,7 +113,7 @@ export const AuthenticationProvider: React.FC<{ children: React.ReactNode }> = (
113113
const passphraseAuthenticate = useCallback(
114114
async (mnemonic: string) => {
115115
if (!keyStore) {
116-
return;
116+
throw new Error("Key store not initialized");
117117
}
118118
const root = await Identity.fromMnemonic(mnemonic);
119119
await keyStore.set(ROOT_KEY, root);

typescript/packages/jumble/src/views/AuthenticationView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function AuthenticationView() {
125125
);
126126

127127
useEffect(() => {
128-
const methods: AuthMethod[] = []; // Passphrase always available
128+
const methods: AuthMethod[] = [];
129129
// Add passkey if available
130130
const isPasskeyAvailable =
131131
window.location.hostname !== "localhost" && window.PublicKeyCredential !== undefined;
@@ -134,6 +134,7 @@ export function AuthenticationView() {
134134
methods.push(AUTH_METHOD_PASSKEY);
135135
}
136136

137+
// Passphrase always available, but second in list
137138
methods.push(AUTH_METHOD_PASSPHRASE);
138139

139140
setAvailableMethods(methods);

0 commit comments

Comments
 (0)