public CredentialStorageFailureEventArgs(
     ICredentialStorageProvider credentialProvider,
     ISavedCredentialsViewModelFactory credentialViewModelFactory,
     IDatabaseCandidate candidate,
     IBuffer credential
     ) : base()
 {
     this.credentialProvider         = credentialProvider ?? throw new ArgumentNullException(nameof(credentialProvider));
     this.credentialViewModelFactory = credentialViewModelFactory ?? throw new ArgumentNullException(nameof(credentialViewModelFactory));
     this.candidate  = candidate ?? throw new ArgumentNullException(nameof(candidate));
     this.credential = credential ?? throw new ArgumentNullException(nameof(credential));
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="syncContext">Synchronization context used for marshalling to the UI thread.</param>
        /// <param name="file">The candidate document file.</param>
        /// <param name="isSampleFile">Whether the file is a PassKeep sample.</param>
        /// <param name="futureAccessList">A database access list for persisting permission to the database.</param>
        /// <param name="reader">The IKdbxReader implementation used for parsing document files.</param>
        /// <param name="proxyProvider">Generates file proxies that the app controls.</param>
        /// <param name="candidateFactory">Factory used to generate new candidate files as needed.</param>
        /// <param name="keyChangeVmFactory">Factory used to generate the objects used to modify the master key of the database.</param>
        /// <param name="taskNotificationService">A service used to notify the UI of blocking operations.</param>
        /// <param name="identityService">The service used to verify the user's consent for saving credentials.</param>
        /// <param name="credentialProvider">The provider used to store/load saved credentials.</param>
        /// <param name="credentialViewModelFactory">A factory used to generate <see cref="ISavedCredentialsViewModel"/> instances.</param>
        public DatabaseUnlockViewModel(
            ISyncContext syncContext,
            IDatabaseCandidate file,
            bool isSampleFile,
            IDatabaseAccessList futureAccessList,
            IKdbxReader reader,
            IFileProxyProvider proxyProvider,
            IDatabaseCandidateFactory candidateFactory,
            IMasterKeyChangeViewModelFactory keyChangeVmFactory,
            ITaskNotificationService taskNotificationService,
            IIdentityVerificationService identityService,
            ICredentialStorageProvider credentialProvider,
            ISavedCredentialsViewModelFactory credentialViewModelFactory
            )
        {
            this.syncContext                = syncContext ?? throw new ArgumentNullException(nameof(syncContext));
            this.futureAccessList           = futureAccessList;
            this.kdbxReader                 = reader ?? throw new ArgumentNullException(nameof(reader));
            this.proxyProvider              = proxyProvider ?? throw new ArgumentNullException(nameof(proxyProvider));
            this.candidateFactory           = candidateFactory ?? throw new ArgumentNullException(nameof(candidateFactory));
            this.keyChangeVmFactory         = keyChangeVmFactory ?? throw new ArgumentNullException(nameof(keyChangeVmFactory));
            this.taskNotificationService    = taskNotificationService ?? throw new ArgumentNullException(nameof(taskNotificationService));
            this.identityService            = identityService ?? throw new ArgumentNullException(nameof(identityService));
            this.credentialProvider         = credentialProvider ?? throw new ArgumentNullException(nameof(credentialProvider));
            this.credentialViewModelFactory = credentialViewModelFactory ?? throw new ArgumentNullException(nameof(credentialViewModelFactory));

            SaveCredentials            = false;
            IdentityVerifiability      = UserConsentVerifierAvailability.Available;
            UnlockCommand              = new AsyncActionCommand(CanUnlock, DoUnlockAsync);
            UseSavedCredentialsCommand = new AsyncActionCommand(
                () => UnlockCommand.CanExecute(null) && HasSavedCredentials,
                DoUnlockWithSavedCredentials
                );
            IsSampleFile     = isSampleFile;
            RememberDatabase = true;

            this.initialConstruction = UpdateCandidateFileAsync(file);
        }
Пример #3
0
        /// <summary>
        /// Constructs the ViewModel.
        /// </summary>
        /// <param name="settingsService">Provides access to the app's settings.</param>
        /// <param name="cachedFilesViewModelFactory">ViewModel factory for managing cached files.</param>
        /// <param name="savedCredentialsViewModelFactory">ViewModel factory for managing saved credentials.</param>
        public AppSettingsViewModel(
            IAppSettingsService settingsService,
            ICachedFilesViewModelFactory cachedFilesViewModelFactory,
            ISavedCredentialsViewModelFactory savedCredentialsViewModelFactory
            )
        {
            this.settingsService                  = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
            this.cachedFilesViewModelFactory      = cachedFilesViewModelFactory ?? throw new ArgumentNullException(nameof(cachedFilesViewModelFactory));
            this.savedCredentialsViewModelFactory = savedCredentialsViewModelFactory ?? throw new ArgumentNullException(nameof(savedCredentialsViewModelFactory));

            Themes = new List <ApplicationTheme>
            {
                ApplicationTheme.Dark,
                ApplicationTheme.Light
            };

            this._selectedTheme = settingsService.AppTheme;
            this._clipboardClearTimerEnabled = settingsService.EnableClipboardTimer;
            this._idleLockTimerEnabled       = settingsService.EnableLockTimer;
            this._clipboardClearTimerMax     = (int)settingsService.ClearClipboardOnTimer;
            this._idleLockTimerMax           = (int)settingsService.LockTimer;
            this._motdEnabled       = settingsService.EnableMotd;
            this._copyPasswordOnUrl = settingsService.CopyPasswordOnUrlOpen;
        }