Protect an MDX deck from invaders 👾
Uses https://paassword.now.sh to safely store your password and then allows a static site to check against it at will.
yarn add protect-a-deck
See details on how to extend the mdx-deck Provider
here: https://github.com/jxnblk/mdx-deck/blob/master/docs/advanced.md#custom-provider-component
-
Go to https://paassword.now.sh and get a link that will look like:
https://svrlss.now.sh/api/get/rec3T73O3WNZk3IZj
-
Copy the last part, the id, of the url. Which would be
rec3T73O3WNZk3IZj
from above. -
Extend the provider for mdx-deck like the example below passing in your id from step 2.
// example Provider.js
import React from 'react'
import Protection from 'protect-a-deck'
import { useDeck } from 'mdx-deck'
export default props => {
const state = useDeck()
return (
<Protection paassword="rec3T73O3WNZk3IZj">
{props.children}
</Protection>
)
}