Usually you use these identifiers only for permanent storage. Those keys you will have to look up again, and normally you'd do that using a unique identifier (e.g. a label). Those are generally not random, and if they are random, then they should be 128 bits or higher to avoid collisions (i.e. two keys possibly sharing the same number).
After some advanced Internet searching, I found the following tidbit:
After the account is created, the user can upload the keys to the server. The identity_key
and public_keys are both Curve25519 Base64 encoded public keys with a size of 33 bytes. A client will publish 100 pre-keys when registering, see figure 4.2, however, this is not a restriction. Along with these keys, a signed pre-key
will be sent with a signature over the public_key
. The key_id
is an identifier of 3 bytes.
After that there is a code example that clearly shows it is a 24 bit sequential number, presumably unsigned, so you can supply it a non-random number [0, 2^24).