public async Task ReturnsNullIfNoAccount() { var(secretClient, secretClientFactory) = CreateMockClient(); var store = new AzureKeyVaultAccountStore( NullLogger <AzureKeyVaultAccountStore> .Instance, Options.Create(new AzureKeyVaultLettuceEncryptOptions()), secretClientFactory, _mockCertificateAuthority); secretClient.Setup(c => c.GetSecretAsync(It.IsAny <string>(), null, default)) .Throws(new RequestFailedException(404, "Not found")); var account = await store.GetAccountAsync(default);
public async Task StoresAccountAsJsonSecret() { var(secretClient, secretClientFactory) = CreateMockClient(); var store = new AzureKeyVaultAccountStore( NullLogger <AzureKeyVaultAccountStore> .Instance, Options.Create(new AzureKeyVaultLettuceEncryptOptions()), secretClientFactory, _mockCertificateAuthority); var accountModel = new AccountModel { Id = 1234, EmailAddresses = new[] { "*****@*****.**" }, PrivateKey = KeyFactory.NewKey(Certes.KeyAlgorithm.ES512).ToDer(), }; await store.SaveAccountAsync(accountModel, default); secretClient.Verify(c => c.SetSecretAsync( "le-account-acme-v02-api-letsencrypt-org", It.IsAny <string>(), default)); }