plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

[stronghold] v1 - Illegal non-contiguous size

Open joezak11 opened this issue 3 years ago • 7 comments

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"

joezak11 avatar Nov 07 '23 18:11 joezak11

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.

DrummerSi avatar Jan 22 '24 21:01 DrummerSi

Same here. Anyone got a solution to this?

MZPL avatar Feb 23 '24 22:02 MZPL

Same thing here, is someone looking into this?

Giuliano1993 avatar Apr 02 '24 15:04 Giuliano1993

Using tauri_plugin_stronghold::Builder::with_argon2 fixed it for me.

jonassterud avatar Jan 04 '25 07:01 jonassterud

This fixed it https://v2.tauri.app/plugin/stronghold/#initialize-with-argon2-password-hash-function

Paul4673 avatar Aug 16 '25 14:08 Paul4673

Using tauri_plugin_stronghold::Builder::with_argon2 fixed it for me.

this worked for me

mwael01 avatar Feb 05 '26 04:02 mwael01

https://github.com/tauri-apps/plugins-workspace/issues/3494

FabianLars avatar Jul 16 '26 14:07 FabianLars