What these keys are
A WireGuard peer is identified by a Curve25519 key pair. The private key stays in the [Interface] section of that peer's config and never moves; the public key is what you hand to the other side, where it goes in a [Peer] block. Both are printed as 32 raw bytes in standard base64 — a 44-character string ending in =. That is the entire identity system: no certificates, no authority, no expiry.
Is generating them in a browser reasonable?
Here the honest answer is unusually favourable. The pair comes from your browser's own crypto.subtle.generateKey('X25519') using the browser’s cryptographic implementation, and the private key is never transmitted or stored. You can verify it in the network tab, or simply disconnect from the network and watch this page keep generating. The usual objection to browser key generation is that you must trust the page you loaded; that objection is real, and it is why the SSH page tells you to prefer ssh-keygen for a long-lived production key. WireGuard keys are cheaper to rotate than an SSH identity — you change one line on each side — so the calculus is different, but the rule still holds: for a gateway that guards a production network, run wg genkey yourself.
The preshared key is not a password
The optional preshared key is 32 random bytes mixed into the handshake on top of the Curve25519 exchange. It adds a symmetric layer intended to hedge against future quantum attacks on the key exchange. Configure the same preshared value on both peers, and protect it like the private key. See the WireGuard protocol description.