示例#1
0
        public IActionResult GetSessionInfo(long spId)
        {
            string            nonce     = ConfidentialAssetsHelper.GetRandomSeed().ToHexString();
            AccountDescriptor spAccount = _accountsService.GetById(spId);

            return(Ok(new
            {
                publicKey = spAccount.PublicSpendKey.ToHexString(),
                sessionKey = nonce,
            }));
        }
示例#2
0
 public IActionResult Register([FromBody] AccountDto accountDto)
 {
     try
     {
         long accountId         = _accountsService.Create((AccountType)accountDto.AccountType, accountDto.AccountInfo, accountDto.Password);
         var  accountDescriptor = _accountsService.GetById(accountId);
         return(Ok(_translatorsRepository.GetInstance <AccountDescriptor, AccountDto>().Translate(accountDescriptor)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { ex.Message }));
     }
 }
示例#3
0
        public IActionResult GetById(long accountId)
        {
            AccountDescriptor account = _accountsService.GetById(accountId);

            if (account == null)
            {
                return(BadRequest());
            }

            var identityProvider = new IdentityProviderInfoDto
            {
                Id          = account.AccountId.ToString(CultureInfo.InvariantCulture),
                Description = account.AccountInfo,
                Target      = account.PublicSpendKey.ToHexString()
            };

            return(Ok(identityProvider));
        }