With openssl:
openssl genpkey -algorithm ed25519 -out institute_ed25519.pem openssl pkey -in institute_ed25519.pem -pubout -outform DER \ | tail -c 32 | base64 | tr '+/' '-_' | tr -d '=' # → PUBLIC_KEY_B64URL
With Node ≥ 18 (also computes the fingerprint and signs):
import crypto from "node:crypto";
const { publicKey, privateKey } = crypto.generateKeyPairSync("ed25519");
const raw = publicKey.export({ type: "spki", format: "der" }).subarray(-32); // 32 raw bytes
const b64u = (b) => Buffer.from(b).toString("base64url");
const PUBLIC_KEY_B64URL = b64u(raw);
const JWK = `{"crv":"Ed25519","kty":"OKP","x":"${b64u(raw)}"` + `}`; // exact RFC order
const FINGERPRINT = b64u(crypto.createHash("sha256").update(JWK).digest());
const b64uJson = (o) => b64u(JSON.stringify(o)); // no padding
function signJws(claims) { // compact JWS, EdDSA — mirrors identity.js
const head = b64uJson({ alg: "EdDSA", typ: "JWT", kid: FINGERPRINT });
const body = b64uJson(claims);
const sig = b64u(crypto.sign(null, Buffer.from(`${head}.${body}`), privateKey));
return `${head}.${body}.${sig}`;
}
Constraints: assertion `iat`/`exp` within 300 s; a challenge nonce lives 120 s; `kid` must equal the `jkt` claim. The six-step enrollment call sequence is on the /join page and in docs/API.md §2.