Skip to content

Using Crypto in Edge Functions and Middleware

Learn to utilize the crypto Web APIs at the edge.

Framework Next.js
Use Case Edge Functions, Documentation
CSS Tailwind
Publisher ▲ Vercel

Crypto

In this example, you'll see how you can utilize the crypto Web APIs with Edge Middleware and Edge Functions.

Working example: crypto.vercel.sh

Includes:

  • crypto.randomUUID
  • crypto.getRandomValues
  • Encryption with crypto.subtle
  • Decryption with crypto.subtle

Demo

https://edge-functions-crypto.vercel.app

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Clone and Deploy

Download this repository via git:

git clone https://github.com/vercel/examples.git

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/edge-functions/crypto crypto
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/crypto crypto

Deploy it to the cloud with Vercel (Documentation).

Using Crypto in Edge Functions and Middleware

Learn to utilize the crypto Web APIs at the edge.

Framework Next.js
Use Case Edge Functions, Documentation
CSS Tailwind
Publisher ▲ Vercel

Crypto

In this example, you'll see how you can utilize the crypto Web APIs with Edge Middleware and Edge Functions.

Working example: crypto.vercel.sh

Includes:

  • crypto.randomUUID
  • crypto.getRandomValues
  • Encryption with crypto.subtle
  • Decryption with crypto.subtle

Demo

https://edge-functions-crypto.vercel.app

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Clone and Deploy

Download this repository via git:

git clone https://github.com/vercel/examples.git

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/edge-functions/crypto crypto
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/crypto crypto

Deploy it to the cloud with Vercel (Documentation).

Unleash New Possibilities

Deploy your app on Vercel and unlock its full potential