This repository has been archived on 2025-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
trafficcue-server/test/keys.ts
Jannik fae7308af8
All checks were successful
TrafficCue Server CI / check (push) Successful in 23s
style: run eslint and prettier
2025-08-30 10:31:03 +02:00

14 lines
352 B
TypeScript

import { exportJWK, exportPKCS8, generateKeyPair } from "jose";
export async function createTestKey() {
const { publicKey, privateKey } = await generateKeyPair("RS256", {
extractable: true,
});
const jwk = await exportJWK(publicKey);
jwk.kid = "test-key";
jwk.alg = "RS256";
const pem = await exportPKCS8(privateKey);
return { jwk, pem };
}