Exemplo n.º 1
0
        public IActionResult Open(string urlTxt)
        {
            var tokens = urlTxt.Split(".");
            var domain = tokens[tokens.Length - 2] + "." + tokens[tokens.Length - 1];
            var db     = int.Parse(tokens[tokens.Length - 3]);
            var key    = tokens[tokens.Length - 4];

            var decriptKey = _blockChain.GetDecryptKey(db, domain);
            //TODO: check token lenght, data integrity. Now an exeption will notify user about malformed url
            var item = _blockChain.Get(key, db, domain, decriptKey.Key);

            var result = new ValidationResult();

            result.ExpectedKey  = key;
            result.RequestedURL = urlTxt;
            result.Hierarchy    = _blockChain.GetAncerstor(item, db, domain, decriptKey.Key);
            result.Errors       = _blockChain.Validate(item.Data, item.Hash, db, domain, decriptKey.Key);
            result.Result       = item;
            //TODO: validate
            return(View(result));;
        }