docsify
docsify copied to clipboard
Proposal: protect docs with user authentication
Feature request
Protect docsify static pages with user authentication from any 3rd party identity provider (i.e. Github Auth).
What problem does this feature solve?
Store and serve static docs in free services like Github Pages, while having user authentication. Github only allows that in their paid layer. The proposed method would work with any hosting and identity provider.
What does the proposed API look like?
- Create an auth.json file in your root folder with these contents:
{
auth: "github",
repo: "private-repo-id"
}
- In your docsify docs root folder, run
npx docsify-protect-docs
How should this be implemented in your opinion?
-
Initialization: The command
npx docsify-protect-docs
, when called without arguments, will create a git pre-push or pre-commit hook that will automatically callnpx docsify-protect-docs now
(notice argument now). -
Automated workflow: With argument
now
, the script will create a "./docs/protected" folder, with all the encrypted markdown files and with a modified version of index.html that shows a Login form and connects to Github Auth for auth. -
On-the-fly decryption: The decryption key is obtained from the private Github repo, where it was previously placed by
npx docsify-protect-docs now
. In order to access this key, we need to require read access to that repo. The user will grant it as part of his github auth login flow.
Security: Only users with access to the private repo would be able to able to read the docs. Which is fine since they can read the plain markdown anyway.
Utility Right now the method would be specially useful for developers, as they would need a Github ID (easily extended for Gitlab and other git providers). For non-developers, other identity providers may be added, but they would need to somehow provide access to a shared decryption key.
Are you willing to work on this yourself?
Maybe, if I get support so that I don't have to learn all the Docsify codebase.