This commit is contained in:
2025-06-09 05:59:26 -07:00
parent 512b742c46
commit 1f89fce21b
5 changed files with 1984 additions and 1588 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -223,8 +223,13 @@ func (cli *CLIInstance) VaultImport(vaultName string) error {
return fmt.Errorf("failed to store long-term public key: %w", err)
}
// Calculate public key hash
publicKeyHash := vault.ComputeDoubleSHA256([]byte(ltPublicKey))
// Calculate public key hash from index 0 (same for all vaults with this mnemonic)
// This is used to identify which vaults belong to the same mnemonic family
identity0, err := agehd.DeriveIdentity(mnemonic, 0)
if err != nil {
return fmt.Errorf("failed to derive identity for index 0: %w", err)
}
publicKeyHash := vault.ComputeDoubleSHA256([]byte(identity0.Recipient().String()))
// Load existing metadata
existingMetadata, err := vault.LoadVaultMetadata(cli.fs, vaultDir)