public async Task CanDeleteRegistration() { var accountKey = await Helper.LoadkeyV1(); var regLocation = new Uri("http://example.com/reg/1"); var mock = MockHttp(async req => { if (req.Method == HttpMethod.Post && req.RequestUri == regLocation) { var payload = await ParsePayload <RegistrationEntity>(req); Assert.Equal(ResourceTypes.Registration, payload.Resource); Assert.True(payload.Delete); var resp = CreateResponse(null, HttpStatusCode.OK, regLocation); resp.Headers.Add("Link", $"<{tos}>; rel=\"terms-of-service\""); return(resp); } return(null); }); using (var http = new HttpClient(mock.Object)) using (var handler = new AcmeHttpHandler(server, http)) { using (var client = new AcmeClient(handler)) { var account = new AcmeAccount { Location = regLocation, Data = new RegistrationEntity { Resource = ResourceTypes.Registration, Contact = new[] { $"another-{email}" }, Agreement = tos } }; try { await client.DeleteRegistration(account); Assert.False(true); } catch (InvalidOperationException) { } client.Use(accountKey.Export()); await client.DeleteRegistration(account); } mock.As <IDisposable>().Verify(x => x.Dispose(), Times.Never()); } }
public async Task CanDeleteRegistration() { using (var client = new AcmeClient(WellKnownServers.LetsEncryptStaging)) { var reg = await client.NewRegistraton(); await client.DeleteRegistration(reg); } }
public async Task CanChangeKey() { using (var client = new AcmeClient(WellKnownServers.LetsEncryptStaging)) { var reg = await client.NewRegistraton(); var newKey = new AccountKey().Export(); await client.ChangeKey(reg, newKey); await client.DeleteRegistration(reg); } }
public async Task RunAccountFlow(KeyAlgorithm algorithm) { var dirUri = await IntegrationHelper.GetAcmeUriV1(); var key = new AccountKey(algorithm); using (var client = new AcmeClient(IntegrationHelper.GetAcmeHttpHandler(dirUri))) { client.Use(key.Export()); var reg = await client.NewRegistraton(); reg.Data.Agreement = reg.GetTermsOfServiceUri(); await client.UpdateRegistration(reg); var newKey = new AccountKey().Export(); await client.ChangeKey(reg, newKey); await client.DeleteRegistration(reg); } }