示例#1
0
        /// <summary>
        /// Reloads the datafile in the local database
        /// </summary>
        public async void ReloadDatafile()
        {
            await CollectionAccessSemaphore.WaitAsync();

            CheckDatafile();
            CollectionAccessSemaphore.Release();
        }
示例#2
0
        /// <summary>
        /// Writes the current accounts into the datafile
        /// </summary>
        public async void WriteLocalDatafile()
        {
            var dbHash = await App.Repository.Password.GetAsync();

            var datafileDB = await App.Repository.Datafile.GetAsync();

            var iv = new AesManaged().IV;

            await CollectionAccessSemaphore.WaitAsync();

            DatafileModel file = new DatafileModel()
            {
                IV = iv, Collection = Collection
            };

            var folder = await StorageFolder.GetFolderFromPathAsync(datafileDB.Path);

            await FileService.WriteStringAsync(
                datafileDB.Name,
                NewtonsoftJSONService.SerializeEncrypt(SecretService.Helper.ReadSecret(Constants.ContainerName, dbHash.Hash),
                                                       iv,
                                                       file),
                folder);

            CollectionAccessSemaphore.Release();
        }
示例#3
0
        /// <summary>
        /// Reset the TOTP code
        /// </summary>
        public async void ResetCollection()
        {
            await CollectionAccessSemaphore.WaitAsync();

            for (int i = 0; i < Collection.Count; i++)
            {
                InitializeItem(i);
            }
            CollectionAccessSemaphore.Release();
        }