First, we need to generate a Keypair, which includes both public and
secret halves of an asymmetric key. To do so, we need a cryptographically
secure pseudorandom number generator (CSPRNG), and a hash function which
has 512 bits of output. For this example, we'll use the operating
system's builtin PRNG and SHA-512 to generate a keypair:

PublicKeys, SecretKeys, Keypairs, and Signatures can be serialised
into byte-arrays by calling .to_bytes(). It's perfectly acceptible and
safe to transfer and/or store those bytes. (Of course, never transfer your
secret key to anyone else, since they will only need the public key to
verify your signatures!)