public async Task Is_able_to_create_folder_if_needed() { using var key = new AesEncryptionKey(); var sut = new DevelopKeyValueStore(Path.GetTempPath() + Guid.NewGuid().ToString()); var encrypted = await sut.EncryptAsync(key).ConfigureAwait(false); var decrypted = await sut.DecriptAsync(encrypted).ConfigureAwait(false); Assert.Equal(key, decrypted); }
public async Task Can_resuse_key_upon_dispose() { // create a key encrypt byte[] encrypted; using var key = new AesEncryptionKey(); var sut = new DevelopKeyValueStore(Path.GetTempPath()); encrypted = await sut.EncryptAsync(key).ConfigureAwait(false); // then decrypt with another instance of the keyvalue store. var anotherSut = new DevelopKeyValueStore(Path.GetTempPath()); var decrypted = await anotherSut.DecriptAsync(encrypted).ConfigureAwait(false); Assert.Equal(key, decrypted); }