getAlby / hub

Alby Hub - Your own lightning node connected to every app. Run anywhere. Become self-sovereign.
https://albyhub.com
Apache License 2.0
69 stars 12 forks source link

Design new 1-click App Connection flow that works on all environments #328

Open rolznz opened 1 month ago

rolznz commented 1 month ago

Try at https://paper-scissors-hodl.fly.dev/

On mobile this leaves the app connection completely broken - and copying the connection secret cannot work either because Alby Hub does not know it

Update: this cannot be fixed with nwc.getalby.com. We need to design a new 1-click app connection flow that works in all environments

bumi commented 1 month ago

we miss this event then:

// notify the opener if present of the success full connect
  window.addEventListener("load", (event) => {

    // dispatch a success event which can be listened to by the opener or by the app that embeddes the webview
    // this gives those apps the chance to know the user has enabled the connection
    const nwcEvent = new CustomEvent("nwc:success", { detail: {} });
    window.dispatchEvent(nwcEvent);

    // notify the opener of the successful connection
    if (window.opener) {
      window.opener.postMessage(
        {
          type: "nwc:success",
          payload: {success: true},
        },
        "*"
      );
    }
  });
bumi commented 1 month ago

is this useEffect correct? https://github.com/getAlby/hub/blob/master/frontend/src/screens/apps/AppCreated.tsx#L76-L90

rolznz commented 1 month ago

We need to design a new 1-click app connection flow that works in all environments