Function encryptSafely

  • Encrypt a message in a way that obscures the message length.

    The message is padded to a multiple of 2048 before being encrypted so that the length of the resulting encrypted message can't be used to guess the exact length of the original message.

    Parameters

    • options: {
          data: unknown;
          publicKey: string;
          version: string;
      }

      The encryption options.

      • data: unknown

        The message data.

      • publicKey: string

        The public key of the message recipient.

      • version: string

        The type of encryption to use.

    Returns EthEncryptedData

    The encrypted data.