useAndWipeAll

inline fun <T> useAndWipeAll(data1: ByteArray, data2: ByteArray, block: (ByteArray, ByteArray) -> T): T

Executes a block with multiple byte arrays and automatically wipes them afterward.

Use case: When working with multiple sensitive arrays:

val result = MemoryUtils.useAndWipeAll(seed, chainCode) { s, cc ->
deriveChild(s, cc)
}
// Both seed and chainCode are wiped here

Return

Result of the block

Parameters

data1

First byte array to use and wipe

data2

Second byte array to use and wipe

block

Lambda that uses both byte arrays

Throws

exception thrown by the block (after wiping data)