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

Adding ability to signMessage with Ledger adapter #712

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

martincik
Copy link

@martincik martincik commented Jan 25, 2023

For this patch to work, we would need a new Solana App released with supporting off-chain message signing. The code is done here: LedgerHQ/app-solana#37 not yet been released.

@changeset-bot
Copy link

changeset-bot bot commented Jan 25, 2023

🦋 Changeset detected

Latest commit: 3d84674

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@solana/wallet-adapter-ledger Patch
@solana/wallet-adapter-wallets Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@martincik
Copy link
Author

@elbywan any possibility of getting the new Solana app released with the off-chain signing?Thank you.

@elbywan
Copy link

elbywan commented Jan 25, 2023

Hey @martincik, sorry but I am not working in the Ledger firmware team and my work is not related to the nano apps at all.

Copy link
Collaborator

@jordaaash jordaaash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! We want to avoid breaking changes, so please limit the scope to just the signMessage change. The default derivation path is fine, but can also be provided arbitrarily if the caller doesn't want to start with 44'/501'/.

packages/wallets/ledger/src/adapter.ts Outdated Show resolved Hide resolved
packages/wallets/ledger/src/util.ts Outdated Show resolved Hide resolved
Comment on lines +43 to +51
/** @internal */
export async function signMessage(transport: Transport, message: Buffer, derivationPath: Buffer): Promise<Buffer> {
const paths = Buffer.alloc(1);
paths.writeUInt8(1, 0);

const data = Buffer.concat([paths, derivationPath, message]);

return await send(transport, INS_SIGN_MESSAGE_OFFCHAIN, P1_CONFIRM, data);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great. I think we'll need to add some things to the adapter/utils to help apps prepare the right message format to sign, but this is a good start.

packages/wallets/ledger/src/util.ts Outdated Show resolved Hide resolved
packages/wallets/ledger/package.json Outdated Show resolved Hide resolved
.changeset/chilled-badgers-warn.md Outdated Show resolved Hide resolved
packages/wallets/ledger/src/adapter.ts Outdated Show resolved Hide resolved
@martincik
Copy link
Author

@jordansexton Thanks for the review and feedback. I've applied all the input and reverted all the new derivative path codes. Feel free to let me know if there's anything else I can do to move it forward.

@jordaaash
Copy link
Collaborator

This looks good. I think we need to wait to merge until the Ledger app actually supports the full message preamble: https://edge.docs.solana.com/proposals/off-chain-message-signing#message-preamble

The current (1.3.1) release does support INS_SIGN_MESSAGE_OFFCHAIN and Phantom has done some testing, which (I'm told) works: https://github.com/phantom-labs/sandbox/pull/33/files#diff-ef62378fde56dd1b353bf1263bff96352f72df5be1d8c676855450bdf42cd61f

But the addition to the Ledger app was done before the spec was finalized, and some of the message headers have changed.

@manzgoeggel
Copy link

pinging you on this @jordansexton, when do you expect to merge this?

@tiboprea
Copy link

hey @jordansexton , are there any plans to merge this anytime soon?

@jordaaash
Copy link
Collaborator

This is still in development for the Ledger app. While the app was updated to include message signing support, it doesn't implement the final version of the Solana offline signing spec yet. Apps shouldn't start to use until it's implemented correctly (the message preamble has changed, so the input and signatures won't match). I'll merge this when it's released.

@manzgoeggel
Copy link

so ledger is still working on this I assume?

@danvernon
Copy link

This is still in development for the Ledger app. While the app was updated to include message signing support, it doesn't implement the final version of the Solana offline signing spec yet. Apps shouldn't start to use until it's implemented correctly (the message preamble has changed, so the input and signatures won't match). I'll merge this when it's released.

hey jordan was there any update on this?

@Dulb26
Copy link

Dulb26 commented Apr 18, 2024

Hey any update on this?

@GrimLothar
Copy link

Hey, I know it was mentioned that the ledger app still needs updating before this can be merged. But it is my understanding that each of the apps on the ledger are not developed by ledger itself but by each of the blockchain providers? If that's the case, any chance you can find who is working there and see if that is even been worked on? This is a request that has been around since 2021... I wonder if there's pushback for some reason and just will never be done... Thanks!

@trading-peter
Copy link

Hm, is that release of the app not done yet? Their versioning is a bit of a weird to me but it seems like the pr in question has been merged and released? LedgerHQ/app-solana#37

Unless I'm getting something wrong lol

@GrimLothar
Copy link

Hm, is that release of the app not done yet? Their versioning is a bit of a weird to me but it seems like the pr in question has been merged and released? LedgerHQ/app-solana#37

Unless I'm getting something wrong lol

Looks like not everything is done yet. Check this previous answer by @jordaaash #712 (comment)

It baffles my mind how this is still an issue after 3 years. I totally understand some people not even wanting this because it's not decentralizes to use web2 auth system with a web3 sign. Or because it's not good to have people using their ledgers all the time to sign auth messages. (i've heard both of those in the past). But the reality is that people still do it resorting to all sorts of workarounds which are even worse from a security stand point (disabling blind signing and signing random transactions that don't end up being sent on chain). That's an awful habit to put users into, and probably how they end up being drained. I hope the different teams needed to get this through can get together and try to push this forward "soonish" 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants