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); }
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)); }