Parse the type

This commit is contained in:
Manav Rathi 2024-05-24 13:47:11 +05:30
parent cb78c848d6
commit 0ec75c2435
No known key found for this signature in database

View file

@ -104,6 +104,7 @@ const parsePathname = (url: URL): [type: Code["type"], path: string] => {
const p = url.pathname.toLowerCase(); const p = url.pathname.toLowerCase();
if (p.startsWith("//totp")) return ["totp", url.pathname.slice(6)]; if (p.startsWith("//totp")) return ["totp", url.pathname.slice(6)];
if (p.startsWith("//hotp")) return ["hotp", url.pathname.slice(6)]; if (p.startsWith("//hotp")) return ["hotp", url.pathname.slice(6)];
if (p.startsWith("//steam")) return ["steam", url.pathname.slice(7)];
throw new Error(`Unsupported code or unparseable path "${url.pathname}"`); throw new Error(`Unsupported code or unparseable path "${url.pathname}"`);
}; };