The recovery key (v0.17.0) #21
Reference in New Issue
Block a user
Delete Branch "feature/recovery-key"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The recovery key: one long random key per two-factor vault, for the day the factors are gone. Design and format:
docs/FACTORS.md, "The recovery key".What
Vault::recovery_create(now)makes the key and returns it once (RecoveryKey: an id and 8 groups of 8 base32 characters with a check). It is in no file and no log. A new key replaces the old one.Vault::recover(bytes, key, new_password, kdf, second, label, now)is the only call that takes it. Before it returns the vault it drops every factor, makes the new password and one new second factor the vault's two factors, and replaces the recovery key. Noopenoropen_withaccepts a recovery key.Vault::recovery_remove,Vault::recovery_id,Vault::recovery_id_of(bytes).recovery-created,recovery-removed,recovered, with the key's id.RecoveryKeyMistyped(what was typed is not a key),WrongRecoveryKey,NoRecoveryKey.Tests
tests/recovery.rs8, unit tests inrecovery.rs2.Self-review
recoverwrites nothing. A caller that uses the returned vault without saving has changed nothing on disk; the desktop must save before it shows anything.cargo fmtalso reformatted one line intests/factors.rs.Not verified
custos-wasmbuilds with it (workspace tests), but the web vault has no way to recover.