示例#1
0
            internal bool Unlock(Passphrase passphrase)
            {
                if (Keys.CanUnlockWith(passphrase))
                {
                    this.passphrase = new Passphrase(passphrase);

                    return(true);
                }
                else
                {
                    Lock();

                    return(false);
                }
            }
示例#2
0
        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);
        }