src/main/java/com/hedera/hashgraph/identity/hcs/MessageEnvelope.java
/**
   * Opens a message in this envelope.
   * If the message is encrypted, the given decrypter will be used first to decrypt it.
   * If the message is not encrypted, it will be immediately returned.
   *
   * @param decrypter The function used to decrypt the message.
   * @return The message object in a plain mode.
   */
Opens a message in this envelope.
If the message is encrypted, the given decrypter will be used first to decrypt it.
If the message is not encrypted, it will be immediately returned.

@param decrypter The function used to decrypt the message.
@return The message object in a plain mode.
Opens a message in this envelope . If the message is encrypted the given decrypter will be used first to decrypt it . If the message is not encrypted it will be immediately returned . @param decrypter The function used to decrypt the message . @return The message object in a plain mode .
public T open(final BiFunction<T, Instant, T> decrypter) {
    if (decryptedMessage != null) {
      return decryptedMessage;
    }
    if (!MessageMode.ENCRYPTED.equals(mode)) {
      decryptedMessage = message;
    } else if (decrypter == null) {
      throw new IllegalArgumentException("The message is encrypted, provide decryption function.");
    } else if (decryptedMessage == null) {
      decryptedMessage = decrypter.apply(message, getConsensusTimestamp());
    }
    return decryptedMessage;
  }
public T open ( final BiFunction < T , Instant , T > decrypter ) { if ( decryptedMessage != null ) { return decryptedMessage ; } if ( ! MessageMode . ENCRYPTED . equals ( mode ) ) { decryptedMessage = message ; } else if ( decrypter == null ) { throw new IllegalArgumentException ( "The message is encrypted, provide decryption function." ) ; } else if ( decryptedMessage == null ) { decryptedMessage = decrypter . apply ( message , getConsensusTimestamp ( ) ) ; } return decryptedMessage ; }
Opens a message in this envelope.
Opens a message in this envelope .
// Only decrypt once