code: public static Token generate(final Random random, final Key key, final byte[] payload) {
          final IvParameterSpec initializationVector = generateInitializationVector(random);
          final byte[] cipherText = key.encrypt(payload, initializationVector);
          final Instant timestamp = Instant.now();
          final byte[] hmac = key.sign(supportedVersion, timestamp, initializationVector, cipherText);
          return new Token(supportedVersion, timestamp, initializationVector, cipherText, hmac);
      }
docs: Generate a new Fernet token.
  
  @param random a source of entropy for your application
  @param key the secret key for encrypting <em>payload</em> and signing the token
  @param payload the unencrypted data to embed in the token
  @return a unique Fernet token