public static function unseal(
        string $ciphertext,
        SealingSecretKey $secretKey
    ): string {
        $ephemeralPublicKey = \ParagonIE_Sodium_Core_Util::substr($ciphertext, 0, 32);

        $sharedSecret = static::keyExchange(
            $secretKey,
            new SealingPublicKey($ephemeralPublicKey),
            true,
            56
        );
        $sharedKey = \ParagonIE_Sodium_Core_Util::substr($sharedSecret, 0, 32);
        $nonce = \ParagonIE_Sodium_Core_Util::substr($sharedSecret, 32, 24);
        try {
            \ParagonIE_Sodium_Compat::memzero($sharedSecret);
        } catch (\Throwable $ex) {
        }

        $plaintext = \ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt(
            \ParagonIE_Sodium_Core_Util::substr($ciphertext, 32),
            $ephemeralPublicKey,
            $nonce,
            $sharedKey
        );
        if (!\is_string($plaintext)) {
            throw new InvalidMessageException('Incorrect message authentication tag');
        }
        return $plaintext;
    }
public static function unseal(
        string $ciphertext,
        SealingSecretKey $secretKey
    ): string {
        $ephemeralPublicKey = \ParagonIE_Sodium_Core_Util::substr($ciphertext, 0, 32);

        $sharedSecret = static::keyExchange(
            $secretKey,
            new SealingPublicKey($ephemeralPublicKey),
            true,
            56
        );
        $sharedKey = \ParagonIE_Sodium_Core_Util::substr($sharedSecret, 0, 32);
        $nonce = \ParagonIE_Sodium_Core_Util::substr($sharedSecret, 32, 24);
        try {
            \ParagonIE_Sodium_Compat::memzero($sharedSecret);
        } catch (\Throwable $ex) {
        }

        $plaintext = \ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_decrypt(
            \ParagonIE_Sodium_Core_Util::substr($ciphertext, 32),
            $ephemeralPublicKey,
            $nonce,
            $sharedKey
        );
        if (!\is_string($plaintext)) {
            throw new InvalidMessageException('Incorrect message authentication tag');
        }
        return $plaintext;
    }
public static function unseal ( string $ ciphertext , SealingSecretKey $ secretKey ) : string { $ ephemeralPublicKey = \ ParagonIE_Sodium_Core_Util :: substr ( $ ciphertext , 0 , 32 ) ; $ sharedSecret = static :: keyExchange ( $ secretKey , new SealingPublicKey ( $ ephemeralPublicKey ) , true , 56 ) ; $ sharedKey = \ ParagonIE_Sodium_Core_Util :: substr ( $ sharedSecret , 0 , 32 ) ; $ nonce = \ ParagonIE_Sodium_Core_Util :: substr ( $ sharedSecret , 32 , 24 ) ; try { \ ParagonIE_Sodium_Compat :: memzero ( $ sharedSecret ) ; } catch ( \ Throwable $ ex ) { } $ plaintext = \ ParagonIE_Sodium_Compat :: crypto_aead_xchacha20poly1305_ietf_decrypt ( \ ParagonIE_Sodium_Core_Util :: substr ( $ ciphertext , 32 ) , $ ephemeralPublicKey , $ nonce , $ sharedKey ) ; if ( ! \ is_string ( $ plaintext ) ) { throw new InvalidMessageException ( 'Incorrect message authentication tag' ) ; } return $ plaintext ; }
Decrypt a message with your secret key.

@param string $ciphertext
@param SealingSecretKey $secretKey
@return string
@throws InvalidMessageException
Decrypt a message with your secret key .