internal bool Unlock(Passphrase passphrase) { if (Keys.CanUnlockWith(passphrase)) { this.passphrase = new Passphrase(passphrase); return(true); } else { Lock(); return(false); } }
public async Task <Result> Restore(Passphrase passphrase) { var keyPair = new KeyPair ( PublicKey, new PrivateKey(backup.EncryptedPrivateKey) ); if (IsInCache) { Debug.Assert(passphrase != null); if (!keyPair.CanUnlockWith(passphrase)) { return(false); } } var identity = await Engine.ImportIdentity(backup.Stereotype, Name, keyPair); Main.CurrentIdentity = (IdentityVM)identity; return(true); }