-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: Add message signing #276
Conversation
Credit to @mul1sh for help on this |
Hey @sohkai this is ready for an initial review + I have a couple questions:
This isn't great, but I think it's better than aragonApi.signMessage((err, sigHash) => {
if (err) // handle it
// use sigHash
}) Because the error first callback style is familiar. Instead, the rxjs allows a front-end dev to do this: aragonApi.signMessage(response => {
if (response.error) // handle it
else // use response.result for sig hash
}) This is way less ideal because it's unfamiliar. I'm an rxjs noob, so is there a better, simple way to imitate the normal web3 callback style using observables? |
Once we settle on the API interface from the comment above, I'll update the docs |
Linking aragonone/product#33 |
No, this shouldn't be necessary. An aragon client should be responsible for connecting to an Ethereum provider that provides the connected account that will sign the message.
The
The promise returned from The rejected promise is not currently being propagated, but working to get it to work :). |
Hi @sohkai thank you for reviewing. I'm going to address all your comments (including the two inline ones) here. I want to make sure I'm following the desired logic properly. aragon/aragon needs 3 pieces of information to execute a signature and follow the given designs:
(1) is easy to handle, but there are different options for how we handle (2) and (3) with respect to getting and passing the data (between packages), so I'm going to go through both and make sure we're on the same page. (2) - the account to sign the message from
I see three ways to achieve this: a. The aragon client app developer could pass the account to sign from as a second parameter in the call to Which option do you think makes the most sense? (3) - the app that requested the message signature
If I'm understanding correctly, you can access the app address that made the call to aragon/api through Lastly, about documentation:
So does this mean that the documentation should suggest promisifying the Observable returned by |
Definitely c. This is something the client should handle itself, since it should own the connection to your "wallet" Ethereum provider. The other two options would essentially be the same thing, since the same account is injected into
Yes, the handler is the best place to grab this address. There shouldn't be a need to include another parameter in
There is technically some other development work that needs to be done too, to get this promise accept / reject. You can basically duplicate the pattern here or here, where the emitted object just holds an The propagation of this error has been implemented in #277. As for the documentation itself, you can use some of the wording from https://github.com/aragon/aragon.js/blob/master/docs/APP.md#requestaddressidentitymodification 😄. |
Understood.
Also understood.
Great, when i pulled in #277 this is working well. Although I think for documentation purposes it makes sense to suggest promisifying the -- |
|
Ha, realized I had tried the second error parameter before #277 was merged. Oops, brain fart. I'll update documentation too |
@sohkai changed variable name to |
Looking good, thanks @Schwartz10! |
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.
Nice addition. Thanks @Schwartz10
Co-Authored-By: Schwartz10 <Schwartz10@users.noreply.github.com>
…th-cache * origin/master: (29 commits) Update README.md (aragon#291) Wrapper: clarify comments about forwarding path finding strategy (aragon#289) Split quick start doc from intro (aragon#287) @aragon/wrapper 5.0.0-rc.2 wrapper: prettify setApp() descriptions (aragon#284) wrapper: fix callsscripts decoding (aragon#283) Wrapper: add installedRepos observable (aragon#268) fix: avoid infinitely looping through forwarders when looking for a transaction path (aragon#285) wrapper: enforce message to sign is string (aragon#282) api: v1.1.0 rpc-messenger: v1.1.0 feat: @aragon/wrapper api cleanup (aragon#279) Wrapper: handle SetApp for updated apps (aragon#267) feat: Add message signing (aragon#276) Wrapper: don't assign initializationBlock on non-kernel proxies when unneeded (aragon#266) chore: ignore package-lock.jsons (aragon#280) API: propagate errors to single-response APIs (aragon#277) Rpc Messenger: dedupe message bus across requests (aragon#278) Fix: changes after review (aragon#274) Docs update: include react api, aragon app architecture & fixes (aragon#271) ...
Fixes #124.
Changes
If you are modifying the external API of one of the modules, please remember to also change the documentation