-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Feature: Bidirectional QR code accounts #6267
Conversation
@whymarrh @danjm @frankiebee Hi, This PR was originally PR |
@tmashuang had reviewed a prior version of this PR, I added him here |
Also, I think @tmashuang's comments in #6007 still stand, can you link to the PRs you've created for the dependent packages? (i.e. |
@tmashuang and @whymarrh ETH-keyring-controller pr: The entirely new package, not a pr: BTW my apologies for making your lives harder by closing the PR all the time. I keep screwing with the rebasing with git: if I don't rebase, then tests fail, if I do rebase and recreate the whole branch it gets closed here, if I force push then only the very last commit will contain the rebase the previous ones will not, this way you can't really roll back, only if you do another rebase yourself. But from now on I will just use force push, and this way you can keep track of the PR more easily. |
ui/app/components/app/modals/external-sign-modal/external-sign-modal.js
Outdated
Show resolved
Hide resolved
hello @r001, lots of good work here : ) I really like the airgapped bidirectional QR code style. As a side project, I'm working on adding support for the ellipal hardware wallet which works very similarly to yours. I worked out their current uri schema here https://github.com/kumavis/eth-ellipal-util Could you clarify your external signing target? seems like the encoding and URI schema are specific to AirSign. This is fine, but we should be explicit and call this an AirSign account and not an "external account". If you are interested in your URI schema being generic and standardized, I would recommend opening an EIP/ERC. |
ui/app/components/app/modals/qr-scanner/qr-scanner.component.js
Outdated
Show resolved
Hide resolved
maybe we should land a refactor for the QR code widget outside of this PR that makes it more generically useful by other parts of the app |
i also look forward to writing something like class EllipalSigner extends BidrectionalQrSigner {
decodeReadAddressUri: () => { ... },
encodeSignRequestUri: () => { ... },
decodeSignedTxUri: () => { ... },
...
} where the "signer" refers to a collection of views + routes + keyrings. one day! |
pulled out from a review thread: I think using the keyring to trigger the qr code reader is not a good idea in this case. I think a better way to approach this would be:
|
I have answeret this above. |
I have refactored the code to be able to implement encoding/decoding in an easy way. I have implemented the Ellippal encoder/decoder into the project. |
Done. |
Now it is possible, but you don't have to do that. I have implemented Ellipal support Please check it for me, just to make sure I got everything right in the code. |
yeah, fair. let me see if we have some bounty funds available for this. I think its a really important feature. |
ui/app/components/app/modals/external-sign-modal/external-sign-signer-airsign.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signer
, ParitySigner
, Erc67Signer
, Ellipal
, AirSign
nice!
I want to surface the remaining TODOs on this PR. @r001 do you have any you're still working on or is it just feedback stuff on our end? |
Well there are no remaining TODOs. Except if we are doing the UI flow model you have suggested before. Current solution keeps current code intact. None of the signing classes had to be changed, none of the UI side code had to be updated either (only of course |
25ebe18
to
ac38747
Compare
The CLA bot should hopefully be fixed now? I just updated it |
This comment has been minimized.
This comment has been minimized.
Looks like this protocol offers very similar functionality and is supported in some ways by Metamask? Maybe we can at least reuse some code from there: https://walletconnect.org/ |
Hi all, I am from the @CoboVault team and we like the Bidirectional QR code accounts feature idea. Currently, a lot of hardware wallets can take the air-gapped way to transmit data(QR Code) and I think it can hugely reduce the attack surface and bring more security to the whole community. Also - QR code has much fewer compatibility issues compared to USB solutions. But after I go through this PR, I think there are some limitations. I will list them and we can have more discussion: 1.Lack of multi-QR code support. The current implementation is lacking multi-QR Code support which will make this feature much less usable. With Defi booming, the transaction data became much larger. And it is almost impossible to put all the unsigned data into one QR code. So multi-QR code support is necessary. 2.Limitation of current QR-scanner library @zxing/library. The current @zxing library will stop scanning once it gets a frame of QR Codes, which is not suitable for multi-QR code. 3.Current account creation user flow seems strange. Users need to paste the address into the input box. Why not directly use the QR-scanner to do that? Or at least providing this function. Users can either paste the address or scan the QR code. 4.Extended public key or address? The current implementation is to provide the address to create an account. But how about just providing an extended public key and derivation path to MetaMask. With that feature, users can get a series of accounts/addresses on MetaMask. It will be much more user friendly. But this also introduces more changes to the current product logic and I think this is an open question. 5.Data encoding standard of the QR code(s). Currently, there seems no standard for data encoding on the QR Codes, different hardware wallets use their own way. I think an EIP of QR code data encoding is essential as QR code will be more and more adopted as a better solution compared to USB connection for hardware wallets. Our team created a proof of concept project to resolve these limitations. And we are very happy to help improve this PR based on our experience. |
At AirGap, we would also be very interested in airgapped wallet support via QR codes. We built a proof-of-concept for this more than 2 years ago and the signing part worked very well, but at the time there was not much interest for that feature and we discontinued our extension. This is a small demo, the flow would basically be the same, but instead of our own "AirGap Extension", it would now be MetaMask handling the transaction prepare: https://www.youtube.com/watch?v=q6gS0MdpUDg @aaronisme Thanks for working on this. I have a couple of notes regarding your points:
It would be great if this feature could find its way into the MetaMask extension. |
@AndreasGassmann Thanks for your input. |
Thanks for this PR. Really looking forward to it.
Agreed, Parity Signer is using UOS, and we can now add Stylo to the list. It's a fork of Signer that I launched recently. These work well for Ethereum with MyCrypto Desktop app, and for Polkadot/Kusama with the Polkadot-js apps and extension. |
Is there a comparison between both bc-ur and UOS? Regarding performance, features and available tooling? At AirGap we have been using our own custom multi-qr implementation for a couple of years now. It is similar to UOS in that it allows you to split the data up into multiple parts if necessary, and have the other party combine the parts to get the full payload. However, there is a big problem with this. If one QR is missed, the user has to wait for a "full roundtrip" again until the missed QR is shown again. This is a problem for larger payloads. We have a use-case where we do a batch transaction with our apps that results in about 200 QR codes. Scanning those consistently can be very tricky, depending on the device. With iPhones the success rate is basically 100%, but especially older Android phones often drop QRs, making it a cumbersome process. The bc-ur standard (we were not involved in designing that standard) addresses this by randomising the parts that are contained in the QRs after the initial set. In AirGap, we will most likely add support for bc-ur because of bitcoin and UOS because of polkadot. So we will support either standard and it doesn't really matter which route MetaMask / Ethereum is going. However, I do feel like bc-ur does have some clear advantages. I could even see a combination of the two. We could use bc-ur as the encoding format for QR codes, but the underlying structure of the data could still be as defined in UOS. Only the multipart section would have to be removed and the payload could be passed into bc-ur, which handles the fragmentation of the data into QR codes. |
Hi @AndreasGassmann and all people interested in this topic, I'm an Engineer from Cobo Vault team. Would you like to step to this discussion to have a further discussion? For the talk gradually running out of scope of this PR. |
Hi @AndreasGassmann, @Tbaut |
Thank you for your work on this @r001 ! We've been testing this out and found that transactions may fail if the data is too large. We'll be moving toward an animating QR solution. Thank you again! |
Bidirectional QR accounts feature allows Metamask to track accounts whose private keys are stored on a safe device, and tx data and signatures are exchanged by using QR codes. This allows very safe account password storage.
This pull request enables users to create so called bidirectional qr accounts (requestend in ISSUE #5640). This means that after applying this pull request in the "import account" menu there will be an "QR" tab that enables importing multiple ethereum addresses. There is no local private key stored, but upon confirming a transaction a QR code is presented and the transaction can be signed by an external signer. And the signature can be provided in the signature input field. By providing the signature, the transaction will be signed, and published.
The way it works is the following:
eth-bidirectional-qr-keyring
, the keyringssignTransaction()
function is called.bidirectionalQrSignables
array, which is monitored by the UImodal.js
base component.bidirectionalQrSignables
entrymodal.js
starts thebidirectional-qr-sign-modal.js
window, and displays QR code, and requests signature.There are four different signers this implementation supports:
Since signing has a defined interface, further signers can be added easily.