Runs an async operation with secret bytes and wipes them afterwards — even if the operation throws.
Guarantees that data is zeroed in the finally block regardless of whether operation succeeds or throws.
data
finally
operation
Secret byte array to wipe after operation.
Async function receiving the data.
The result of the operation.
Whatever the operation throws, after wiping data.
const result = await withSecureWipe(privateKey, async (key) => { return await encrypt(payload, key);});// privateKey is wiped now Copy
const result = await withSecureWipe(privateKey, async (key) => { return await encrypt(payload, key);});// privateKey is wiped now
Runs an async operation with secret bytes and wipes them afterwards — even if the operation throws.
Guarantees that
datais zeroed in thefinallyblock regardless of whetheroperationsucceeds or throws.