This TypeScript-based backend system provides a secure and efficient way to authenticate podcasters through email verification. It uses Cloudflare Workers for API routing, Cloudflare D1 SQL database for data storage, and Mailjet for email notifications.
-
Generate Verification Code: Generate a code to check a podcast RSS feed ownership and send it by mail (email address provided in the
itunes:email
tag). Ownership is linked to any user ID, originally built to be tied to a user's EVM address. -
Verify Podcasters: Allow podcasters to verify their identity by submitting the verification code received via email. The system checks the code's validity and expiration.
- Generate a verification code:
curl --request POST \
--url 'https://podcast-auth.[subdomain].workers.dev/generate-code' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data rss_feed=https://www.vocast.fr/desondes/rss/main \
--data admin_address=0x64E8f7C2B4fd33f5E8470F3C6Df04974F90fc2cA
- Verify the ownership, with the code received by mail:
curl --request POST \
--url 'https://podcast-auth.[subdomain].workers.dev/validate-code' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data rss_feed=https://www.vocast.fr/desondes/rss/main \
--data admin_address=0x64E8f7C2B4fd33f5E8470F3C6Df04974F90fc2cA \
--data code=222311
- Get all validated feeds for a user (from the EVM address account):
curl --request GET \
--url 'https://podcast-auth.[subdomain].workers.dev/0x64E8f7C2B4fd33f5E8470F3C6Df04974F90fc2cA/validated-feeds'
Before you begin, ensure you have met the following requirements:
- Node.js installed
- Cloudflare account
- A Mailjet API key
To install the project, follow these steps:
git clone https://github.com/antho31/podcast-auth.git
cd podcast-auth
npm install
Create a .dev.vars
file and provide the following environment variables:
Variable Name | Description | Required |
---|---|---|
MJ_APIKEY_PUBLIC | Public API key for Mailjet | Yes |
MJ_APIKEY_PRIVATE | Private API key for Mailjet | Yes |
MJ_SENDER_MAIL | Sender's email address for Mailjet | Yes |
See .dev.example.vars
for an example.
- Use
wrangler
to log in:
npx wrangler login
- Create a D1 database:
npx wrangler d1 create PodcastAuth
Note the created database database_id
.
-
Update
database_id
in thewrangler.toml
configuration file. -
Add the required SQL table:
npm run int-db
- Add secrets in production:
npx wrangler secret put MJ_APIKEY_PRIVATE
npx wrangler secret put MJ_APIKEY_PUBLIC
npx wrangler secret put MJ_SENDER_MAIL
npm run dev-api
Access the API at http://localhost:8787
To deploy the project to Cloudflare Workers:
npm run deploy-api
Note the published API endpoint.
This project is licensed under the MIT License. See the LICENSE file for details.