public async Task <IActionResult> SignUp([FromBody] SignUpRequest request) { Guid id = _identityService.GenerateIdentityHash(request.Email); Identity identity = await _identityDataSource.Read(id); if (identity != null) { return(StatusCode((int)HttpStatusCode.Conflict, "Email is already used.")); } _identityService.GeneratePasswordHashAndSalt( request.Password, out byte[] hash, out byte[] salt); User user = await _userDataSource.Create(request.Name, "", request.Birthday); identity = await _identityDataSource.Create(id, user.Id, salt, hash); TokenResponse tokenResponse = _jwtAuthenticationService.CreateTokenResponse(identity); return(Ok(tokenResponse)); }