Repository
https://github.com/MattyIce/steem-keychain
New Feature
Recently I augmented the Steem Keychain (now on the web store) to allow for adding/removing account authorities. Works for posting and active authorities.
This isn't a full flow for managing everything related to authorities (e.g. multi-sig, but it can be moved in that direction in the near future). However, it can now handle a very common use case for Steemconnect Integration, and I imagine it can be directly integrated with the Steemconnect auth flow without too much trouble.
To see it in action, you can download or update to the latest Steem Keychain extension here, and then go to the Steemkeychain test page which I've hosted at this location: https://eonwarped.github.io/steem/sk/main.html
You will find a section for adding and removing account authorities, like so:
To check that the authorities were added/removed, you can use Steemd.
Code Details
You can find the merged pull request with the highlighted changes here: https://github.com/MattyIce/steem-keychain/pull/76 (click the "Files Changed" tab).
If you click in to the changes, you will note the following changes:
README.md
-- Documentation for how to use the newly added features.example/main.html
andexample/main.js
-- Adding the function to the test page for easy testing.html/dialog.html
-- This controls the view for the dialog popup that asks for approval to sign and broadcast the transaction. The way it works is that the method name, which in this case is addAccountAuthority / removeAccountAuthority works as a class to show/hide relevant input fields. Here I added a spot for the authorized account name.js/dialog.js
-- This is the part that populates the data for the view inhtml/dialog.html
. Very simple jquery calls to select the element and populate with the data.js/popup/settings.js
-- Small change to add display names for the operation.js/steem_keychain.js
-- The start point, where therequestAddAccountAuthority
andrequestRemoveAccountAuthority
methods are defined. It follows suit in passing the data to the background thread.js/web_interface.js
-- Validation code added to do basic checks for data population.js/background.js
-- This is where the action happens. This is a relatively easy case, where all we had to do is extract the data and make the corresponding API call, and sincesteem-js
codebase already has a method for modifying authorities, we simply plugged directly into it. Another change was needed to tell the keychain to use the 'active' authority to make the call.
Notes
Any potential integrators to the keychain can follow similar steps to add functionality and submit a PR for discussion and adoption. Previously I've added abilities that was needed for condenser to use keychain. I never wrote it up, but I will likely do it in more detail in the near future because some of the methods were more involved. And a small plug, if you want to try out the keychain experience, you can use the latest keychain extension with the website I've hosted at https://cryptoempirebot.com (sometimes images don't load, though, and I have yet to figure that out).
Anyway, let me know if you have any questions below!