Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Sign with wallet selector in Laboratory #674

Closed
1 task
willemneal opened this issue Jun 1, 2023 · 7 comments
Closed
1 task

CLI: Sign with wallet selector in Laboratory #674

willemneal opened this issue Jun 1, 2023 · 7 comments

Comments

@willemneal
Copy link
Member

willemneal commented Jun 1, 2023

What problem does your feature solve?

To transactions created in the CLI, allow users to connect to a wallet not stored by the CLI. This is being explicitly asked by developer

What would you like to see?

This issue includes pass the xdr to the sign page on Lab and pass back the signed xdr to the CLI.

What alternatives are there?

@janewang janewang added this to DevX Jul 22, 2024
@github-project-automation github-project-automation bot moved this to Backlog in DevX Jul 22, 2024
@janewang janewang changed the title CLI: Sign with Ledger Wallet, system keychain, and redirect to Freighter CLI: Sign with wallet selector in Laboratory Jul 22, 2024
@janewang janewang moved this from Backlog to Todo in DevX Jul 22, 2024
@janewang
Copy link
Contributor

@willemneal @fnando I'm thinking of breaking out the signing with macOS keychain into a separate ticket, what do you think?

@janewang janewang assigned Ifropc and unassigned fnando Jul 23, 2024
@janewang
Copy link
Contributor

For signing with system keychain, it is moved to a separate issue: #1481

@janewang
Copy link
Contributor

It sounds like from @quietbits and @jeesunikim that this work requires adding a top level account

@Ifropc
Copy link
Contributor

Ifropc commented Jul 25, 2024

Currently blocked by #1406

@Ifropc
Copy link
Contributor

Ifropc commented Jul 26, 2024

This will add a new --sign-with-lab flag for (currently WIP) tx sign command. The flow is:

  1. Prompt user to confirm opening browser (unless --yes is passed)
  2. Start http server on any open port
  3. Open browser with constructed url: https://beta-laboratory.stellar.org/transaction/cli-sign?importXdr=<xdr>&passphrase=<network-passphrase>&redirect-url=localhost:port/callback (more below)
  4. cli: wait for callback to be called
  5. laboratory: show sign view, when user click on sign, redirect to localhost:port/callback?signed=<xdr>
  6. http server: listen to callback, when called save xdr into var
  7. http server: redirect from /callback lab's success page (https://beta-laboratory.stellar.org/transaction/cli-success)
  8. pass xdr back to cli main thread and kill server
  9. print result signed xdr

We could reuse existing /sign endpoint, but I think it's more flexible to add 2 new endpoints:

  1. /sign-cli that accepts necessary query parameters listed above:
  • importXdr: XDR to sign
  • passphrase: network passphrase (default to lab selected passphrase if not specified)
  • redirect-url: URL user will be redirected to when transaction is successfully signed
    it can also have a different UI from a regular /sign, if we would want so in the future without the need of changing the cli (e.g. I think it could be useful to be able to see decoded XDR that user is signing) -> for now it can be the same as /sign , or even redirect to /sign.
    Previously it was discussed that we should add top level account, but IMO it's not necessary. We can keep current flow where user can either sign with provided secret key account (NOT an intended flow, as they can just use other cli commands for the same result. So we can technically remove signing with secret key from /sign-cli ), OR connect wallet and sign with it.
  1. cli-success just a static page that says "transaction signed you can now close this page"

To sum up user flow (numbered):
cli:

  1. call sign command
  2. prompt to confirm action
    Browser:
  3. open laboratory/sign-cli
  4. user connects wallet and signs
  5. redirect localhost/callback (with signed XDR)
  6. redirect laboratory/success
    cli:
  7. print signed XDR

cc @quietbits @jeesunikim

@janewang
Copy link
Contributor

Close in favor of #674

@github-project-automation github-project-automation bot moved this from Todo (Ready for Dev) to Done in DevX Aug 19, 2024
@willemneal
Copy link
Member Author

@janewang You linked this same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants