tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
869 stars 242 forks source link

[stronghold] v1 - Illegal non-contiguous size #706

Open joezak11 opened 11 months ago

joezak11 commented 11 months ago

I'm trying to use the stronghold plugin but for some reason an error shows up in the console when trying to initialize it. I'm using SvelteKit.

main.rs

// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use argon2::{
    password_hash::{rand_core::OsRng, SaltString},
    Argon2, PasswordHasher,
};

fn main() {
    tauri::Builder::default()
        .plugin(
            tauri_plugin_stronghold::Builder::new(|password| {
                let salt = SaltString::generate(&mut OsRng);
                let argon2 = Argon2::default();
                argon2
                    .hash_password(password.as_bytes(), &salt)
                    .unwrap()
                    .to_string()
                    .as_bytes()
                    .to_vec()
            })
            .build(),
        )
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

+page.svelte

<script lang="ts">
    import { Stronghold } from 'tauri-plugin-stronghold-api';

    let strongholdPath = '~/data.stronghold';
    let password = 'Password123';
    Stronghold.load(strongholdPath, password)
        .then((r) => console.log(r))
        .catch((e) => console.error(e));
</script>

When run I get Illegal non-contiguous size error in the console.

I'm using:

tauri = { version = "1.5.2", features = [] }
tauri-plugin-stronghold = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
argon2 = "0.5.2"
"@sveltejs/kit": "^1.20.4",
"tauri-plugin-stronghold-api": "https://github.com/tauri-apps/tauri-plugin-stronghold#v1"
DrummerSi commented 8 months ago

I get the same thing.. Tried using Argon2, Bcrypt and plain strings.. Always the same error.. Think there's an incompatibility between the plugin and the underlying Stronghold package.

MZPL commented 7 months ago

Same here. Anyone got a solution to this?

Giuliano1993 commented 6 months ago

Same thing here, is someone looking into this?