public static function encrypt($message, $sender_private, $receiver_public)
    {
        # Test to make sure all the required variables are strings.
        Helpers::isString($message, 'PublicKeyEncryption', 'encrypt');
        Helpers::isString($sender_private, 'PublicKeyEncryption', 'encrypt');
        Helpers::isString($receiver_public, 'PublicKeyEncryption', 'encrypt');

        # Generate a keypair for the message to be sent.
        $messageKeyPair = \Sodium\crypto_box_keypair_from_secretkey_and_publickey(
            Helpers::hex2bin($sender_private),
            Helpers::hex2bin($receiver_public)
        );

        # Generate the nonce for usage.
        $nonce = Entropy::generateNonce();

        # Encrypt the message and return it.
        return base64_encode(json_encode([
            'msg'   => Helpers::bin2hex(\Sodium\crypto_box(
                $message,
                $nonce,
                $messageKeyPair
            )),
            'nonce' => Helpers::bin2hex($nonce),
        ]));

    }