an app to share curated trails
sidetrail.app
1#!/usr/bin/env node
2
3/**
4 * Generates an ES256 JWK for OAuth client authentication.
5 *
6 * Usage:
7 * node scripts/gen-jwk.mjs
8 *
9 * Output the JWK and set it as PRIVATE_KEY_ES256 in your environment.
10 */
11
12import { JoseKey } from "@atproto/oauth-client-node";
13
14async function main() {
15 const kid = `sidetrail-${Date.now()}`;
16 const key = await JoseKey.generate(["ES256"], kid);
17 const jwk = key.privateJwk;
18
19 console.log("Generated ES256 JWK for OAuth client authentication:\n");
20 console.log(JSON.stringify(jwk));
21 console.log("\n");
22 console.log("Add this to your environment as PRIVATE_KEY_ES256:");
23 console.log(`PRIVATE_KEY_ES256='${JSON.stringify(jwk)}'`);
24}
25
26main().catch(console.error);