Feat: simplify vault API and update docs

This commit is contained in:
2025-05-15 22:27:46 +03:00
parent cea2d7e655
commit 791752c3a5
21 changed files with 533 additions and 1106 deletions

View File

@@ -18,19 +18,19 @@ async fn wasm_test_keypair_management_and_crypto() {
log::debug!("Initialized vault and IndexedDB store");
// Step 1: Create keyspace
match vault.create_keyspace(keyspace, password, "pbkdf2", "chacha20poly1305", None).await {
match vault.create_keyspace(keyspace, password, None).await {
Ok(_) => log::debug!("Created keyspace"),
Err(e) => { log::debug!("Failed to create keyspace: {:?}", e); return; }
}
// Step 2: Add Ed25519 keypair
let key_id = match vault.add_keypair(keyspace, password, KeyType::Ed25519, Some(KeyMetadata { name: Some("edkey".into()), created_at: None, tags: None })).await {
let key_id = match vault.add_keypair(keyspace, password, Some(KeyType::Ed25519), Some(KeyMetadata { name: Some("edkey".into()), created_at: None, tags: None })).await {
Ok(id) => { log::debug!("Added Ed25519 keypair: {}", id); id },
Err(e) => { log::debug!("Failed to add Ed25519 keypair: {:?}", e); return; }
};
// Step 3: Add Secp256k1 keypair
let secp_id = match vault.add_keypair(keyspace, password, KeyType::Secp256k1, Some(KeyMetadata { name: Some("secpkey".into()), created_at: None, tags: None })).await {
let secp_id = match vault.add_keypair(keyspace, password, None, Some(KeyMetadata { name: Some("secpkey".into()), created_at: None, tags: None })).await {
Ok(id) => { log::debug!("Added Secp256k1 keypair: {}", id); id },
Err(e) => { log::debug!("Failed to add Secp256k1 keypair: {:?}", e); return; }
};