mirror your GitHub repos to tangled.org automatically
1/**
2 * Generate an ES256 JWK private key for AT Proto OAuth client signing.
3 * Print the JSON-encoded private JWK on stdout. Add it to your env as
4 * `NUXT_ATPROTO_PRIVATE_JWK`. The public half is exposed at
5 * /.well-known/jwks.json by the running app.
6 *
7 * Usage:
8 * pnpm gen:jwk > .jwk.json
9 * NUXT_ATPROTO_PRIVATE_JWK="$(cat .jwk.json)" pnpm dev
10 */
11import { JoseKey } from '@atproto/jwk-jose'
12
13const key = await JoseKey.generate(['ES256'], crypto.randomUUID().slice(0, 8))
14process.stdout.write(JSON.stringify(key.privateJwk))
15process.stdout.write('\n')