public async Task ShouldFailWhenCompleteChallengeWithoutAccount() { using (var client = new AcmeClient(WellKnownServers.LetsEncryptStaging)) { await Assert.ThrowsAsync <InvalidOperationException>( () => client.CompleteChallenge(new ChallengeEntity())); } }
private static async Task AuthorizeDns(AcmeClient client, string name) { var authz = await client.NewAuthorization(new AuthorizationIdentifier { Type = AuthorizationIdentifierTypes.Dns, Value = name }); var httpChallengeInfo = authz.Data.Challenges .Where(c => c.Type == ChallengeTypes.Http01).First(); var httpChallenge = await client.CompleteChallenge(httpChallengeInfo); while (authz.Data.Status == EntityStatus.Pending) { // Wait for ACME server to validate the identifier await Task.Delay(1000); authz = await client.GetAuthorization(httpChallenge.Location); } }