compressedKey
An elliptic-curve public key in compressed form (33 bytes: 2 or 3 for y's parity, then x), as importRaw takes
it; one written uncompressed (65 bytes: 4, x, y), as legacy DID documents write theirs, is compressed.
export function compressedKey(bytes: Uint8Array): Uint8Array { if (bytes.length !== 65 || bytes[0] !== 4) return bytes; const out = new Uint8Array(33); out[0] = bytes[64]! & 1 ? 3 : 2; out.set(bytes.subarray(1, 33), 1); return out; }