Add oauth event handler everywhere, dedup auth_url handling, add requested perms, add since to reply filter

This commit is contained in:
artur
2024-03-08 08:49:36 +03:00
parent 2b98f0fc4a
commit 4f7b9f1b99
3 changed files with 15 additions and 6 deletions

View File

@ -85,6 +85,9 @@ export default function useLoginHandler() {
}
} else if (key.startsWith("bunker://")) {
const nip46 = new Nip46Signer(key);
nip46.on("oauth", url => {
window.open(url, CONFIG.appNameCapitalized, "width=600,height=800,popup=yes");
});
await nip46.init();
const loginPubkey = await nip46.getPubKey();

View File

@ -247,6 +247,9 @@ export function createPublisher(l: LoginSession) {
const relayArgs = (l.remoteSignerRelays ?? []).map(a => `relay=${encodeURIComponent(a)}`);
const inner = new PrivateKeySigner(unwrap(l.privateKeyData as KeyStorage).value);
const nip46 = new Nip46Signer(`bunker://${unwrap(l.publicKey)}?${[...relayArgs].join("&")}`, inner);
nip46.on("oauth", url => {
window.open(url, CONFIG.appNameCapitalized, "width=600,height=800,popup=yes");
});
return new EventPublisher(nip46, unwrap(l.publicKey));
}
case LoginSessionType.Nip7os: {