Click or drag to resize

KeeperSecurity.Authentication.Sync Namespace

Provides types for connecting to Keeper servers (sync).
Classes
 ClassDescription
Public classAuthStep Represents base Keeper authentication step
Public classAuthSync Represents Keeper authentication. (sync)
Public classConnectedStep Represents Connected step. Final step. Successfully connected to Keeper.
Public classDeviceApprovalStep Represents device approval step
Public classErrorStep Represents Error step. Final step. Failed to connect to Keeper.
Public classPasswordStep Represents Master Password step
Public classReadyToLoginStep Represents initial Login step
Public classRestrictedConnectionStep Represents Restricted Connection step. Final step. The connection is limited only to certain commands.
Public classSsoDataKeyStep Represents SSO Approval step
Public classSsoTokenStep Represents SSO Login step
Public classTwoFactorStep Represents Two Factor Authentication step
Interfaces
 InterfaceDescription
Public interfaceIAuthSyncCallback Defines the user interface methods required for authentication with Keeper (sync).
Enumerations
 EnumerationDescription
Public enumerationAuthState Specifies authentication states.
Example
C#
using System;
using System.Threading.Tasks;
using Cli;
using KeeperSecurity.Authentication;
using KeeperSecurity.Authentication.Sync;
using KeeperSecurity.Configuration;
using KeeperSecurity.Vault;

namespace Sample
{
    internal static class Program
    {
        private static async Task Main()
        {
            // Keeper SDK needs a storage to save configuration
            // such as: last login name, device token, etc
            var configuration = new JsonConfigurationStorage("config.json");
            var inputManager = new SimpleInputManager();

            // Login to Keeper
            Console.WriteLine("Logging in...");
            var authFlow = new AuthSync(configuration);
            await Utils.LoginToKeeper(authFlow, inputManager, "username@company.com");

            if (authFlow.Step is ErrorStep es)
            {
                Console.WriteLine(es.Message);
                return;
            }
            if (!authFlow.IsAuthenticated()) return;
            var auth = authFlow;
            var vault = new VaultOnline(auth);
            await vault.SyncDown();
        }
    }
}