Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqrlNet.Server.SqrlServer"/> class.
        /// </summary>
        /// <param name='sqrlSigner'>
        /// SQRL signer.
        /// </param>
        /// <param name='aesHandler'>
        /// AES handler.
        /// </param>
        public SqrlServer(
			ISqrlSigner sqrlSigner,
			IAesHandler aesHandler)
        {
            _sqrlSigner = sqrlSigner;
            _aesHandler = aesHandler;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqrlNet.Server.SqrlServer"/> class.
 /// </summary>
 /// <param name='sqrlSigner'>
 /// SQRL signer.
 /// </param>
 /// <param name='aesHandler'>
 /// AES handler.
 /// </param>
 public SqrlServer(
     ISqrlSigner sqrlSigner,
     IAesHandler aesHandler)
 {
     _sqrlSigner = sqrlSigner;
     _aesHandler = aesHandler;
 }
Exemplo n.º 3
0
        public void Setup()
        {
            _pbkdfHandler  = _mocks.StrictMock <IPbkdfHandler>();
            _hmacGenerator = _mocks.StrictMock <IHmacGenerator>();
            _signer        = _mocks.StrictMock <ISqrlSigner>();

            _client = new SqrlClient(_pbkdfHandler, _hmacGenerator, _signer);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SqrlNet.Client.SqrlClient"/> class.
 /// </summary>
 /// <param name='pbkdfHandler'>
 /// Pbkdf handler.
 /// </param>
 /// <param name='hmacGenerator'>
 /// Hmac generator.
 /// </param>
 /// <param name='signer'>
 /// The signer.
 /// </param>
 public SqrlClient(
     IPbkdfHandler pbkdfHandler,
     IHmacGenerator hmacGenerator,
     ISqrlSigner signer)
 {
     _pbkdfHandler  = pbkdfHandler;
     _hmacGenerator = hmacGenerator;
     _signer        = signer;
 }
Exemplo n.º 5
0
    public MainWindow(string url) : base(Gtk.WindowType.Toplevel)
    {
        Build();
        Url = url;

        _pbkdfHandler  = new PbkdfHandler();
        _hmacGenerator = new HmacGenerator();
        _sqrlSigner    = new SqrlSigner();
        _sqrlClient    = new SqrlClient(_pbkdfHandler, _hmacGenerator, _sqrlSigner);

        this.domainLabel.Text = string.Format("Do you want to log in to {0}", _sqrlClient.GetDomainFromUrl(url));

        _identities = GetIdentities();

        if (_identities.Count() <= 0)
        {
            var newIdentity = CreateNewIdentity();
            _identities.Add(newIdentity);
            SaveIdentities(_identities);
        }

        var comboList    = new ListStore(typeof(int), typeof(string));
        var textRenderer = new CellRendererText();

        identityCombo.PackStart(textRenderer, false);
        identityCombo.AddAttribute(textRenderer, "text", 1);

        var identitiesArray = _identities.ToArray();

        for (var i = 0; i < identitiesArray.Length; i++)
        {
            comboList.AppendValues(i, identitiesArray[i].Name);
        }

        identityCombo.Model = comboList;
    }
Exemplo n.º 6
0
    public MainWindow(string url)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();
        Url = url;

        _pbkdfHandler = new PbkdfHandler();
        _hmacGenerator = new HmacGenerator();
        _sqrlSigner = new SqrlSigner();
        _sqrlClient = new SqrlClient(_pbkdfHandler, _hmacGenerator, _sqrlSigner);

        this.domainLabel.Text = string.Format("Do you want to log in to {0}", _sqrlClient.GetDomainFromUrl(url));

        _identities = GetIdentities();

        if(_identities.Count() <= 0)
        {
            var newIdentity = CreateNewIdentity();
            _identities.Add(newIdentity);
            SaveIdentities(_identities);
        }

        var comboList = new ListStore(typeof(int), typeof(string));
        var textRenderer = new CellRendererText();
        identityCombo.PackStart(textRenderer, false);
        identityCombo.AddAttribute(textRenderer, "text", 1);

        var identitiesArray = _identities.ToArray();

        for(var i = 0; i < identitiesArray.Length; i++)
        {
            comboList.AppendValues(i, identitiesArray[i].Name);
        }

        identityCombo.Model = comboList;
    }
Exemplo n.º 7
0
        public void Setup()
        {
            _pbkdfHandler = _mocks.StrictMock<IPbkdfHandler>();
            _hmacGenerator = _mocks.StrictMock<IHmacGenerator>();
            _signer = _mocks.StrictMock<ISqrlSigner>();

            _client = new SqrlClient(_pbkdfHandler, _hmacGenerator, _signer);
        }