I need to sign JWTs in a worker, but the PEM formatted 2048-bit key is 1600 bytes and exceeds the 1kb limit for worker secrets. My options seem to be to either split up my key into multiple parts/secrets or to save the key in KV storage instead. Is either recommended or is there another approach I can take?
Might not be the most elegant approach, but you could split your PEM in 2 secrets and append them in the script.
const PEM = PART1 + PART2;
Placing it as a global variable, will do it once and PEM will be in memory until the worker is evicted.