forked from sergeych/crypto2
		
	EncryptedKVStorage: can destroy exisint creating one with a new key
This commit is contained in:
		
							parent
							
								
									fbbe4d3a34
								
							
						
					
					
						commit
						85b13ed8ca
					
				@ -74,12 +74,13 @@ class StorageTest {
 | 
			
		||||
        val c1 = EncryptedKVStorage(plain, SymmetricKey.new(), removeExisting = false)  // 1
 | 
			
		||||
        c1.write("hello", "world")
 | 
			
		||||
        assertFailsWith<DecryptionFailedException> {
 | 
			
		||||
            val c2 = EncryptedKVStorage(plain, SymmetricKey.new(), removeExisting = false)  // 2
 | 
			
		||||
            EncryptedKVStorage(plain, SymmetricKey.new(), removeExisting = false)  // 2
 | 
			
		||||
        }
 | 
			
		||||
        val c2 = EncryptedKVStorage(plain, SymmetricKey.new(), removeExisting = true)  // 2
 | 
			
		||||
        EncryptedKVStorage(plain, SymmetricKey.new(), removeExisting = true)  // 2
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@Suppress("unused")
 | 
			
		||||
fun KVStorage.dump() {
 | 
			
		||||
    for (k in keys)
 | 
			
		||||
        println("$k: ${this[k]?.toDump()}")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user