public static IKeePassGroup GetGroup(this IKeePassDatabase db, KeePassId id)
        {
            if (id.IsEmpty)
            {
                return(db.Root);
            }

            foreach (var entry in db.EnumerateAllGroups())
            {
                if (entry.Id.Equals(id))
                {
                    return(entry);
                }
            }

            Debug.Assert(false, "Must find a group in the database");

            return(null);
        }
Exemple #2
0
        public async Task <IKeePassDatabase> UnlockAsync(KeePassId id, ICredentialProvider credentialProvider)
        {
            Log.Info("Unlock {Database}", id);

            var dbFile = await _fileAccess.GetDatabaseAsync(id);

            Debug.Assert(dbFile != null);

            var credentials = await credentialProvider.GetCredentialsAsync(dbFile);

            if (credentials.Equals(default(KeePassCredentials)))
            {
                Log.Warning("Failed to retrieve credentials for {Database}", id);
                return(null);
            }

            Log.Info("Successfully retrieved credentials for {Database}", id);

            return(await UnlockAsync(dbFile, credentials));
        }
 protected KbdxId(PwUuid id, PwDatabase db)
 {
     Database = db;
     Id       = new KeePassId(new Guid(id.UuidBytes));
 }
 public KdbxDatabase(IFile file, PwDatabase db, KeePassId id)
 {
     _file = file;
     _db   = db;
     Id    = id;
 }