Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PGP WKD utility

This utility helps a user to setup and manage a Web Key Directory (WKD) for PGP keys using Cloudflare Pages. WKD allows users to publish their PGP public keys in a standardized way, making it easier for others to find and use them.

Features

  • Automates the process of uploading PGP public keys to Cloudflare Pages.
  • Uses the "advanced WKD method" (i.e. serving the keys from a openpgpkey. subdomain).
  • Automated deployment through GitHub Actions.

Prerequisites

  • A Cloudflare account with Cloudflare Pages enabled.
  • A GitHub account to fork and manage the repository.
  • Basic knowledge of PGP and GitHub Actions.
  • PGP public keys to upload.
  • Node.js and npm installed on your local machine (for initializing the Cloudflare Pages project using wrangler).

How to Use

Warning

You should only upload your public key. Never upload your private key to any repository.

  1. Create a Cloudflare Pages Project
    Run the following commands to create a new Cloudflare Pages project using wrangler, replacing project-name with your desired project name. Wrangler will automatically open a browser window for you to authenticate with Cloudflare:
    npx wrangler pages project create project-name
    
    This will show yout the Cloudflare Pages project name and the associated custom domain (e.g., project-name.pages.dev). Make a note of these details as you will need them later.
  2. Fork the Repository
    Start by forking this repository to your own GitHub account.
  3. Configure GitHub Actions
    The repository is set up to use GitHub Actions for automated deployment. Go to the "Settings" tab of your forked repository, then navigate to "Secrets and variables" > "Actions".
    • Add a new secret named CLOUDFLARE_API_TOKEN with a Cloudflare API token that has permission: Account >> Cloudflare Pages >> Edit.
    • Add another secret named CLOUDFLARE_ACCOUNT_ID with your Cloudflare account ID.
    • Add a variable named PROJECT_NAME with the name of your Cloudflare Pages project (the name you entered using wrangler).
  4. Add Your Public Keys
    Place your PGP public keys in the pgp_keys directory. The filename does not matter.
  5. Commit and Push Changes
    Commit your changes and push them to your forked repository. This will trigger the GitHub Actions workflow to deploy your WKD to Cloudflare Pages.
  6. Access Your WKD
    Once the GitHub Actions workflow completes successfully, the files are deployed to your Cloudflare Pages site. Now you should add a subdomain to the email domain that points to the Cloudflare Pages domain. For example, if your email is johndoe@example.com, you should create a openpgpkey CNAME record for example.com that points to your Cloudflare Pages domain you noted down in step 1 (e.g., project-name.pages.dev). You should repeat this for any other email domains you have added PGP keys for, if applicable.
  7. Verify Your Setup
    You can verify that your WKD is set up correctly by using a PGP client to fetch your public key using your email address or by visiting a tool like Web Key Directory - Tester or Web Key Directory to check if your key is accessible.
  8. Maintain Your Keys
    Whenever you need to add or update your PGP public keys, simply modify the files in the pgp_keys directory, commit the changes, and push them to your repository. The GitHub Actions workflow will automatically redeploy your WKD with the updated keys.

License

This project is licensed under the MIT License. See the LICENSE file for details

About

This utility helps a user to setup and manage a Web Key Directory (WKD) for PGP keys using Cloudflare Pages.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages