Convert a HeerId to its string representation.
Writes into buf (up to buf_len bytes including NUL).
Returns the number of bytes written (excluding NUL) on success, -1 on error.
Returns 0 if no error is stored.
Otherwise copies the last error message into buf (up to buf_len bytes
including the NUL terminator) and returns the number of bytes written
(excluding the NUL). If the buffer is too small the message is truncated.
Convert a RanjId to its UUID string representation.
Writes into buf (up to buf_len bytes including NUL).
Returns bytes written (excluding NUL) on success, -1 on error.