fix: record what the authenticator agreed to, not just what the brows… #33
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
| name: GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| env: | |
| PAGES_ENABLEMENT_TOKEN: ${{ secrets.PAGES_ENABLEMENT_TOKEN }} | |
| jobs: | |
| build: | |
| name: Build demos | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js 22.x | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.x' | |
| cache: 'pnpm' | |
| - name: Install root dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install demo dependencies | |
| run: | | |
| for demo in webauthn-todo-demo ed25519-encrypted-keystore-demo webauthn-varsig-demo; do | |
| pnpm --dir "examples/${demo}" install --frozen-lockfile | |
| done | |
| - name: Build demos | |
| run: | | |
| for demo in webauthn-todo-demo ed25519-encrypted-keystore-demo webauthn-varsig-demo; do | |
| pnpm --dir "examples/${demo}" run build | |
| done | |
| - name: Assemble Pages artifact | |
| run: | | |
| mkdir -p pages | |
| touch pages/.nojekyll | |
| cp -R examples/webauthn-todo-demo/build pages/webauthn-todo-demo | |
| cp -R examples/ed25519-encrypted-keystore-demo/build pages/ed25519-encrypted-keystore-demo | |
| cp -R examples/webauthn-varsig-demo/build pages/webauthn-varsig-demo | |
| cat > pages/index.html <<'HTML' | |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>OrbitDB WebAuthn Demos</title> | |
| <style> | |
| :root { | |
| color-scheme: light dark; | |
| font-family: | |
| Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, | |
| "Segoe UI", sans-serif; | |
| background: #f5f7fb; | |
| color: #161616; | |
| } | |
| body { | |
| margin: 0; | |
| min-height: 100vh; | |
| display: grid; | |
| place-items: center; | |
| } | |
| main { | |
| width: min(960px, calc(100vw - 32px)); | |
| padding: 48px 0; | |
| } | |
| h1 { | |
| margin: 0 0 12px; | |
| font-size: clamp(2rem, 6vw, 4rem); | |
| line-height: 1; | |
| } | |
| p { | |
| max-width: 680px; | |
| color: #525252; | |
| font-size: 1.05rem; | |
| line-height: 1.6; | |
| } | |
| .demos { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); | |
| gap: 16px; | |
| margin-top: 32px; | |
| } | |
| a { | |
| color: inherit; | |
| } | |
| .demo { | |
| display: block; | |
| min-height: 156px; | |
| padding: 20px; | |
| border: 1px solid #d0d7de; | |
| border-radius: 8px; | |
| background: #ffffff; | |
| text-decoration: none; | |
| } | |
| .demo:hover { | |
| border-color: #0f62fe; | |
| box-shadow: 0 12px 32px rgb(15 98 254 / 14%); | |
| } | |
| .demo strong { | |
| display: block; | |
| margin-bottom: 10px; | |
| font-size: 1.1rem; | |
| } | |
| .demo span { | |
| color: #525252; | |
| line-height: 1.5; | |
| } | |
| @media (prefers-color-scheme: dark) { | |
| :root { | |
| background: #161616; | |
| color: #f4f4f4; | |
| } | |
| p, | |
| .demo span { | |
| color: #c6c6c6; | |
| } | |
| .demo { | |
| background: #262626; | |
| border-color: #393939; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <main> | |
| <h1>OrbitDB WebAuthn Demos</h1> | |
| <p> | |
| Choose a static demo for the OrbitDB WebAuthn identity provider. | |
| Each demo is built with OrbitDB 4, libp2p 3, and Helia 7. | |
| </p> | |
| <div class="demos"> | |
| <a class="demo" href="./ed25519-encrypted-keystore-demo/"> | |
| <strong>Encrypted Ed25519 Keystore</strong> | |
| <span>Ed25519 OrbitDB identity with WebAuthn-encrypted keystore and worker-backed signing.</span> | |
| </a> | |
| <a class="demo" href="./webauthn-varsig-demo/"> | |
| <strong>WebAuthn Varsig</strong> | |
| <span>Passkey-backed OrbitDB entry signatures without a separate browser keystore.</span> | |
| </a> | |
| <a class="demo" href="./webauthn-todo-demo/"> | |
| <strong>WebAuthn DID Todo</strong> | |
| <span>The simpler WebAuthn DID identity flow for a local-first OrbitDB todo app.</span> | |
| </a> | |
| </div> | |
| </main> | |
| </body> | |
| </html> | |
| HTML | |
| - name: Enable Pages when admin token is configured | |
| if: env.PAGES_ENABLEMENT_TOKEN != '' | |
| uses: actions/configure-pages@v6 | |
| with: | |
| enablement: true | |
| token: ${{ env.PAGES_ENABLEMENT_TOKEN }} | |
| - name: Verify Pages is enabled | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| pages_api="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pages" | |
| if curl -fsS \ | |
| -H "Authorization: Bearer ${GH_TOKEN}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| "${pages_api}" >/dev/null; then | |
| echo "GitHub Pages is enabled for ${GITHUB_REPOSITORY}." | |
| exit 0 | |
| fi | |
| cat <<'EOF' >&2 | |
| GitHub Pages is not enabled for this repository yet. | |
| Fix this once in repository settings: | |
| Settings -> Pages -> Build and deployment -> Source -> GitHub Actions | |
| Or add a repository secret named PAGES_ENABLEMENT_TOKEN containing a | |
| fine-grained token with Administration: write and Pages: write access, | |
| then rerun this workflow. The workflow will enable Pages automatically. | |
| EOF | |
| exit 1 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: pages | |
| deploy: | |
| name: Deploy demos | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |