示例#1
0
        private async Task <byte[]> GetServerPublicKey()
        {
            if (_serverPublicKey != null)
            {
                return(_serverPublicKey);
            }

            var response = await _api.GetServerPublicKey();

            if (response.IsSuccessStatusCode)
            {
                _serverPublicKey = await response.Content.ReadAsByteArrayAsync();

                return(_serverPublicKey);
            }

            var one = AuthMain.ParseGenericErrors(await response.Content.ReadAsStringAsync(), response.StatusCode);

            if (one != null)
            {
                throw one;
            }

            throw new Exception($"Unknown error during SignIn: {response.StatusCode}");
        }