mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
Handle custom auth providers in saved profiles
This commit is contained in:
1 parent
1137a8ca78
commit
ea45488ee4
5 files changed
+256
-23
No files matched your search
+23
-2
@@ -360,7 +360,10 @@ export function persistSavedProfiles({ persistActive = true } = {}) {
|
||||
typeof entry.npub === "string" && entry.npub.trim() ? entry.npub.trim() : null,
|
||||
name: typeof entry.name === "string" ? entry.name : "",
|
||||
picture: typeof entry.picture === "string" ? entry.picture : "",
|
||||
authType: entry.authType === "nsec" ? "nsec" : "nip07",
|
||||
authType:
|
||||
typeof entry.authType === "string" && entry.authType.trim()
|
||||
? entry.authType.trim()
|
||||
: null,
|
||||
})),
|
||||
activePubkey: activePubkeyToPersist,
|
||||
};
|
||||
@@ -408,7 +411,25 @@ export function loadSavedProfilesFromStorage() {
|
||||
}
|
||||
|
||||
seenPubkeys.add(normalizedPubkey);
|
||||
const storedAuthType = candidate.authType === "nsec" ? "nsec" : "nip07";
|
||||
const rawAuthType =
|
||||
typeof candidate.authType === "string" ? candidate.authType : null;
|
||||
let storedAuthType = null;
|
||||
if (rawAuthType) {
|
||||
const trimmedAuthType = rawAuthType.trim();
|
||||
if (trimmedAuthType) {
|
||||
storedAuthType = trimmedAuthType;
|
||||
if (trimmedAuthType !== rawAuthType) {
|
||||
needsRewrite = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!storedAuthType) {
|
||||
storedAuthType = "nip07";
|
||||
if (rawAuthType !== "nip07") {
|
||||
needsRewrite = true;
|
||||
}
|
||||
}
|
||||
const npub =
|
||||
typeof candidate.npub === "string" && candidate.npub.trim()
|
||||
? candidate.npub.trim()
|
||||
|
||||
Reference in new issue
Block a user