Support Aegis URL scheme for NIP-46 login #161

Merged
hodlbod merged 5 commits from priyanshu_bharti/flotilla:83-aegis-url-scheme into dev 2026-04-10 19:04:35 +00:00
Showing only changes of commit 13e1ca46fc - Show all commits
+10 -10
View File
@@ -15,19 +15,18 @@ const APP_SCHEME = "social.flotilla"
type NostrSignerScheme = "aegis" | "nostrsigner"
const makeSignerCallbackUrl = (path: string, sourceAppScheme: string) =>
`${sourceAppScheme}://x-callback-url/${path}`
const makeSignerCallbackUrl = (path: string) => `${APP_SCHEME}://x-callback-url/${path}`
const makeSignerLaunchUrl = (scheme: NostrSignerScheme, nostrconnectUrl: string) => {
const makeSignerLaunchUrl = (nostrconnectUrl: string) => {
const params = new URLSearchParams({
method: "connect",
nostrconnect: nostrconnectUrl,
"x-source": APP_SCHEME,
"x-success": makeSignerCallbackUrl("authSuccess", APP_SCHEME),
"x-error": makeSignerCallbackUrl("authError", APP_SCHEME),
"x-success": makeSignerCallbackUrl("authSuccess"),
"x-error": makeSignerCallbackUrl("authError"),
})
return `${scheme}://x-callback-url/auth/nip46?${params.toString()}`
return `nostrsigner://x-callback-url/auth/nip46?${params.toString()}`
}
export class Nip46Controller {
@@ -54,8 +53,8 @@ export class Nip46Controller {
this.url.set(url)
this.signerUrls.set({
aegis: makeSignerLaunchUrl("aegis", url),
nostrsigner: makeSignerLaunchUrl("nostrsigner", url),
aegis: makeSignerLaunchUrl(url),
nostrsigner: makeSignerLaunchUrl(url),
})
priyanshu_bharti marked this conversation as resolved Outdated
Outdated
Review

This seems like unnecessary state/indirection

This seems like unnecessary state/indirection
let response
@@ -78,8 +77,9 @@ export class Nip46Controller {
}
}
launchSigner(scheme: NostrSignerScheme) {
const signerUrl = get(this.signerUrls)?.[scheme]
launchSigner(_scheme?: NostrSignerScheme) {
const nostrconnectUrl = get(this.url)
const signerUrl = nostrconnectUrl && makeSignerLaunchUrl(nostrconnectUrl)
if (!signerUrl) {
pushToast({