function decrypt(EncryptedPersonalData $data, CryptographicDetails $crypto): PersonalData {

        if ( ! $crypto->encryption() == 'libsodium') {
            throw new CryptographicDetailsNotCompatibleWithEncryption("{$crypto->encryption()} received, expected 'libsodium'");
        }

        $encrypted = $data->toString();
        $secretKey = $crypto->key('secretKey');
        $nonce     = $crypto->key('nonce');

        $decrypted = sodium_crypto_secretbox_open($encrypted, $nonce, $secretKey);

        return PersonalData::fromString($decrypted);
    }