public LocalRecordStore(IRecord record, StorageFolder folder, string encryptionKey)
        {
            IObjectStore store = new FolderObjectStore(folder);

            if (!String.IsNullOrEmpty(encryptionKey))
            {
                store = new EncryptedObjectStore(store, new Cryptographer(), encryptionKey);
            }

            Initialize(record, store, null);
        }
        static IObjectStore CreateObjectStore(StorageFolder container, string encryptionKey)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            IObjectStore store = new FolderObjectStore(container);

            if (!string.IsNullOrEmpty(encryptionKey))
            {
                store = new EncryptedObjectStore(store, new Cryptographer(), encryptionKey);
            }

            return(store);
        }
Beispiel #3
0
        private async Task EnsureProvisionedAsync(CancellationToken cancelToken)
        {
            m_startupStatus = AppStartupStatus.Pending;

            bool isNewApp = !IsAppCreated;
            try
            {
                m_startupStatus = await EnsureAppCreatedAsync(cancelToken);
            }
            catch
            {
                m_startupStatus = AppStartupStatus.Failed;
                throw;
            }

            if (m_startupStatus != AppStartupStatus.Success)
            {
                await SetUserAndSaveAsync(null, cancelToken);
                return;
            }

            // Set up the encrypted local vault
            if (m_appSettings.UseEncryption)
            {
                var encryptedStore = new EncryptedObjectStore(
                    FolderObjectStore.CreateRoot(m_appSettings.Folder),
                    Client.Cryptographer,
                    Client.State.ProvisioningInfo.SharedSecret);
                m_localVault = new LocalVault(this, FolderObjectStore.CreateRoot(m_appSettings.Folder), encryptedStore);
            }

            // Set the cache setting
            m_localVault.RecordStores.MaxCachedItems = m_appSettings.MaxCachedItems;

            if (!isNewApp)
            {
                await LoadUserInfoAsync(cancelToken);
            }

            if (!HasUserInfo)
            {
                //
                // Download updated Person Information
                //
                await UpdateUserInfoAsync(cancelToken);
            }
        }
        static IObjectStore CreateObjectStore(StorageFolder container, string encryptionKey)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            IObjectStore store = new FolderObjectStore(container);
            if (!string.IsNullOrEmpty(encryptionKey))
            {
                store = new EncryptedObjectStore(store, new Cryptographer(), encryptionKey);
            }

            return store;
        }