コード例 #1
0
        public async Task HandleUrlActivationAsync(string url)
        {
            try
            {
                string encodedRequest = UrlFormat.GetRequestData(url);
                IpcMsg decodeResult   = await Session.DecodeIpcMessageAsync(encodedRequest);

                if (decodeResult.GetType() == typeof(AuthIpcMsg))
                {
                    Debug.WriteLine("Received Auth Granted from Authenticator");
                    AuthIpcMsg ipcMsg = decodeResult as AuthIpcMsg;

                    if (ipcMsg != null)
                    {
                        _session = await Session.AppRegisteredAsync(AppId, ipcMsg.AuthGranted);

                        DialogHelper.ShowToast("Auth Granted", DialogType.Success);
                        MessagingCenter.Send(this, MessengerConstants.NavigateToItemPage);
                    }
                }
                else
                {
                    Debug.WriteLine("Decoded Req is not Auth Granted");
                }
            }
            catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Error", $"Description: {ex.Message}", "OK");

                DialogHelper.ShowToast(AuthDeniedMessage, DialogType.Error);
            }
        }
コード例 #2
0
        private async Task <Session> CreateTestAppAsync(AuthReq authReq)
        {
            (uint _, string reqMsg) = await Session.EncodeAuthReqAsync(authReq);

            IpcReq ipcReq = await _authenticator.DecodeIpcMessageAsync(reqMsg);

            AuthIpcReq authIpcReq = ipcReq as AuthIpcReq;
            string     resMsg     = await _authenticator.EncodeAuthRespAsync(authIpcReq, true);

            IpcMsg ipcResponse = await Session.DecodeIpcMessageAsync(resMsg);

            AuthIpcMsg authResponse = ipcResponse as AuthIpcMsg;

            return(await Session.AppRegisteredAsync(authReq.App.Id, authResponse.AuthGranted));
        }