public static function seal(
        HiddenString $plaintext,
        EncryptionPublicKey $publicKey,
        $encoding = Halite::ENCODE_BASE64URLSAFE
    ): string {
        $sealed = \sodium_crypto_box_seal(
            $plaintext->getString(),
            $publicKey->getRawKeyMaterial()
        );
        $encoder = Halite::chooseEncoder($encoding);
        if ($encoder) {
            return (string) $encoder($sealed);
        }
        return (string) $sealed;
    }
public static function seal(
        HiddenString $plaintext,
        EncryptionPublicKey $publicKey,
        $encoding = Halite::ENCODE_BASE64URLSAFE
    ): string {
        $sealed = \sodium_crypto_box_seal(
            $plaintext->getString(),
            $publicKey->getRawKeyMaterial()
        );
        $encoder = Halite::chooseEncoder($encoding);
        if ($encoder) {
            return (string) $encoder($sealed);
        }
        return (string) $sealed;
    }
public static function seal ( HiddenString $ plaintext , EncryptionPublicKey $ publicKey , $ encoding = Halite :: ENCODE_BASE64URLSAFE ) : string { $ sealed = \ sodium_crypto_box_seal ( $ plaintext -> getString ( ) , $ publicKey -> getRawKeyMaterial ( ) ) ; $ encoder = Halite :: chooseEncoder ( $ encoding ) ; if ( $ encoder ) { return ( string ) $ encoder ( $ sealed ) ; } return ( string ) $ sealed ; }
Encrypt a message with a target users' public key

@param HiddenString $plaintext        Message to encrypt
@param EncryptionPublicKey $publicKey Public encryption key
@param mixed $encoding                Which encoding scheme to use?
@return string                        Ciphertext

@throws InvalidType
@throws \TypeError
Encrypt a message with a target users public key