if (secret == null) {
throw new IllegalStateException();
}
byte[] plaintext = FathomdbCrypto.serialize(userSecret);
byte[] ciphertext = secret.encrypt(plaintext);
byte[] header = new byte[1];
header[0] = tokenId;
return Bytes.concat(header, ciphertext);
}