Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use

Manav Rathi02e8923e774e
diff --git a/web/apps/accounts/src/pages/passkeys/flow.tsx b/web/apps/accounts/src/pages/passkeys/flow.tsx
index ebf39e694c..c01560f99d 100644
--- a/web/apps/accounts/src/pages/passkeys/flow.tsx
+++ b/web/apps/accounts/src/pages/passkeys/flow.tsx
@@ -7,6 +7,7 @@ import {
import EnteButton from "@ente/shared/components/EnteButton";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import FormPaper from "@ente/shared/components/Form/FormPaper";
+import { fromB64URLSafeNoPadding } from "@ente/shared/crypto/internal/libsodium";
import HTTPService from "@ente/shared/network/HTTPService";
import { LS_KEYS, setData } from "@ente/shared/storage/localStorage";
import InfoIcon from "@mui/icons-material/Info";
@@ -144,20 +145,16 @@ const PasskeysFlow = () => {
publicKey: any,
timeoutMillis: number = 60000, // Default timeout of 60 seconds
): Promise<Credential | null> => {
- publicKey.challenge = _sodium.from_base64(
+ publicKey.challenge = await fromB64URLSafeNoPadding(
publicKey.challenge,
- _sodium.base64_variants.URLSAFE_NO_PADDING,
);
- publicKey.allowCredentials?.forEach(function (listItem: any) {
- listItem.id = _sodium.from_base64(
- listItem.id,
- _sodium.base64_variants.URLSAFE_NO_PADDING,
- );
+ for (const listItem of publicKey.allowCredentials ?? []) {
+ listItem.id = await fromB64URLSafeNoPadding(listItem.id);
// note: we are orverwriting the transports array with all possible values.
// This is because the browser will only prompt the user for the transport that is available.
// Warning: In case of invalid transport value, the webauthn will fail on Safari & iOS browsers
listItem.transports = ["usb", "nfc", "ble", "internal"];
- });
+ }
publicKey.timeout = timeoutMillis;
const publicKeyCredentialCreationOptions: CredentialRequestOptions = {
publicKey: publicKey,