Skip to content

Instantly share code, notes, and snippets.

@koolamusic
Created April 11, 2023 16:11
Show Gist options
  • Save koolamusic/db172285b1c44f19f1592d5e52c02019 to your computer and use it in GitHub Desktop.
Save koolamusic/db172285b1c44f19f1592d5e52c02019 to your computer and use it in GitHub Desktop.
JWT utilities
/// @see https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/jwt.ts
import { hkdf } from "@panva/hkdf"
import { EncryptJWT, jwtDecrypt } from "jose"
/// @see also https://github.com/panva/paseto
async function getDerivedEncryptionKey(secret: string) {
return await hkdf(
"sha256",
secret,
"",
"Auth.js Generated Encryption Key",
32
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment