public void GenerateNonce_Returns24ByteArray() { // Arrange // Act var nonce = CryptoF.GenerateNonce(); // Assert Assert.Equal(24, nonce.Length); }
public void GenerateNonce_ReturnsUniqueValues() { // Arrange // Act var nonce1 = CryptoF.GenerateNonce(); var nonce2 = CryptoF.GenerateNonce(); // Assert Assert.NotEqual(nonce1, nonce2); }
public void Incorrect_Nonce_Returns_None_With_IncorrectKeyOrNonceMsg() { // Arrange var value = Rnd.Str; var key = CryptoF.GenerateKey().UnsafeUnwrap(); var box = new Locked <string>(value, key) { Nonce = CryptoF.GenerateNonce() }; // Act var result = box.Unlock(key); // Assert result.AssertNone().AssertType <IncorrectKeyOrNonceExceptionMsg>(); }