Mimics WireGuard's wg genpsk command.
Alias for randomPresharedKeyBytes, returns base64 encoded preshared key instead of Uint8Array.
Can be used directly by WireGuard as Peer PresharedKey.
Examples
Generate a base64-encoded preshared key
import { assertEquals } from "@std/assert";
import { decodeBase64 } from "@std/encoding/base64";
import { wgGenPsk } from "@hertzg/wg-keys";
const psk = wgGenPsk();
assertEquals(psk.length, 44);
assertEquals(decodeBase64(psk).length, 32);