Example #1
0
        public async Task <WebUserRet <TResponse> > RequestAsync <TResponse>(WebMethods method, PrivKey key, string?kid, string url, object?request, CancellationToken cancel = default)
        {
            string nonce = await GetNonceAsync(cancel);

            //("*** " + url)._Debug();

            WebRet webret = await Web.RequestWithJwsObject(method, key, kid, nonce, url, request, cancel, Consts.MimeTypes.JoseJson);

            TResponse ret = webret.Deserialize <TResponse>(true);

            //webret.Headers._DebugHeaders();
            //webret.ToString()._Debug();

            return(webret.CreateUserRet(ret));
        }
Example #2
0
        public AcmeClientOptions(string directoryUrl = DefaultEntryPointUrl, TcpIpSystem?tcpIp = null)
        {
            DirectoryUrl = directoryUrl;
            this.TcpIp   = tcpIp ?? LocalNet;

            DirectoryWebContentsCache = new PersistentLocalCache <AcmeEntryPoints>($"acme/directory_{PathParser.Windows.MakeSafeFileName(this.DirectoryUrl)}",
                                                                                   CoresConfig.AcmeClientSettings.AcmeDirectoryCacheLifeTime,
                                                                                   true,
                                                                                   async(cancel) =>
            {
                using (WebApi api = new WebApi(new WebApiOptions(new WebApiSettings()
                {
                    SslAcceptAnyCerts = true, Timeout = CoresConfig.AcmeClientSettings.ShortTimeout
                })))
                {
                    WebRet ret = await api.SimpleQueryAsync(WebMethods.GET, this.DirectoryUrl, cancel);

                    return(ret.Deserialize <AcmeEntryPoints>(true)._NullCheck());
                }
            });
        }