Blockstack as decentralised auth provider for Rocket.Chat#10462
Closed
timkinnane wants to merge 63 commits intoRocketChat:developfrom
Closed
Blockstack as decentralised auth provider for Rocket.Chat#10462timkinnane wants to merge 63 commits intoRocketChat:developfrom
timkinnane wants to merge 63 commits intoRocketChat:developfrom
Conversation
WIP: Have added stub classes and login elements without functionality BREAKING CHANGE: No other login or auth provider will function on this branch from now on.
Redirects and request generation are triggered, but response not yet handled.
Now successfully processing auth request and getting user data back to server, just need to wire up user login methods.
Can log users in, but not out. Not much catching or logging.
# Conflicts: # README.md # package-lock.json # package.json
Allows deploying to production, will write manifest attributes on request from settings and environment.
This reverts commit c2cd7ce.
Encountered bugs using the autoredirect, which would lose the manifest settings when it came through to Blockstack
Throws errors using next() because headers already sent.
Added Cordova app links to Readme
Also reverted the manual auth redirect handling, just to keep things simple. BREAKING CHANGE: Users can be added with the same empty email, but the unique index check is re-applied on boot preventing startup. Needs resolution with RC team.
Found that service config was not always available in login template on render, moved to Template.currentdata() which is reactive and will update when the config query is returned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issues below outline current blockers, gotchas and todos related to merging my “Blockparty” fork of Rocket.Chat back inline with the core project.
Most of the diffs will come from
packages/rocketchat-blockstack- with a handful of UX and logic changes made in other places.Before you begin, the only feasible way to work on this project is to first register and download the Blockstack app.
Also, be sure to reference the
blockstack.jsdocumentation.Versions out of sync
My last merge while the project was in active development was 0.62.0-rc.2.
I haven’t had time to work on the project lately, so the first task would be addressing any merge conflicts with current development branch.
Custom auth process
The Blockstack auth process requires some specifics that are unique from standard Oauth. I’ve completed the process in this fork by adding Meteor accounts handlers, which are similar in ways to the oauth providers, but have some key differences:
manifest.json- this is generated with the instance’s detailsblockstack.emailas a stop-gapI intend to publish a meteor package that consolidates these changes to be consumable by any Meteor app, but they should be acceptable in the meantime as is.
Admin / Service Settings
A number of admin settings are added for the package behaviour and auth request details.
The following are loaded through admin entered settings or manually populated defaults and provided as service configs through Meteor accounts helpers.
enable- I think is currently ignored, was intended as a toggle to disable the auth methodloginStyle- Also incomplete, would have allowed auth requests through a popupgenerateUsername- If true, would suggest a username by converting first/last name, not ideal for privacy focused communitymanifestURI- The location of the instance manifestredirectURI- The location to redirect to for authenticationauthDescription- Description provided in auth request screen within BlockstackServer side routes
I added the
Pickerpackage to generate the manifest from current admin settings.It also adds the instance’s icon file to auth requests displayed in the Blockstack app.
Avatars
Avatars are loaded directly from Blockstack.org. This included merging some work in progress from an existing Rocket.Chat branch to allow auth providers as an avatar source. The image is provided as stream, not a standard URI.
These changes might not comply with core methods without some tweaking.
The no email thing
Because Blockstack accounts do not contain an email address, yet Rocket.Chat fundamentally requires one, I've found a workaround by populating the email field with their ID @
blockstack.email.I also modified the profile page to include some descriptive text to that effect. I think it's important to communicate what's going on here, or new users will be very confused about the format and requirements.
No other auth providers
I've customised login screens to remove other auth providers, including some hacks to disable password logins by default. The whole point of Blockstack is to decentralise a user's account and let them alone be the sole issuer.
To provide side-by-side auth from centralised providers, or even to keep their pass credentials on the server, goes against the primary principle of a decentralised app. If this is brought into core, that concern must be addressed with some considered configuration and UX changes.
I've added a user/pass login method as a subtle toggle that would only be used for admins or account recovery if some fault occurred with Blockstack authentication.
Settings defaults
Certain related settings should be forced if Blockstack auth is enabled.
Any recent advances to OTR or E2E encryption should also be bundled with this release, as they would be highly value valued by the Blockstack community.
Verify tokens and whitelist fields
My project was an MVP. The auth process has lots of room for improvement and the Blockstack API has also improved recently.
Please investigate what more can be done to improve the security of token handling on returned requests, such as using the Blockstack API to verify tokens and the Meteor accounts methods to whitelist only the specific fields from the returned user data that are necessary.
e.g. see
rocketchat-lib/server/oath/google.jsAdded dependencies
Rocket.Chat required
meteor-node-stubspackage to support thecryptomodule in client. I think this is because the Node library bundled with Meteor/Rocket.Chat does not contain the full set up Node utilities, such as crypto.There may be a lighter work around for this issue, such as explicitly building Node with the crypto module, instead of adding the entire
meteor-node-stubspackage.Questions for Blockstack
In order to merge and create a community for Blockstack within Rocket.Chat, we need to establish some objectives with their input.