Exemplo n.º 1
0
        public async Task <string> GetNonceAsync(CancellationToken cancel = default)
        {
            AcmeEntryPoints url = await Options.GetEntryPointsAsync(cancel);

            WebRet response = await Web.SimpleQueryAsync(WebMethods.HEAD, url.newNonce !, cancel);

            string ret = response.Headers.GetValues("Replay-Nonce").Single();

            if (ret._IsEmpty())
            {
                throw new ApplicationException("Replay-Nonce is empty.");
            }

            return(ret);
        }
Exemplo n.º 2
0
        public async Task <AcmeAccount> LoginAccountAsync(PrivKey key, string[] contacts, CancellationToken cancel = default)
        {
            AcmeEntryPoints url = await Options.GetEntryPointsAsync(cancel);

            AcmeCreateAccountPayload req = new AcmeCreateAccountPayload()
            {
                contact = contacts,
                termsOfServiceAgreed = true,
            };

            WebUserRet <object> ret = await this.RequestAsync <object>(WebMethods.POST, key, null, url.newAccount !, req, cancel);

            string accountUrl = ret.System.Headers.GetValues("Location").Single();

            if (accountUrl._IsEmpty())
            {
                throw new ApplicationException("Account Location is empty.");
            }

            return(new AcmeAccount(EnsureInternal.Yes, this, key, accountUrl));
        }