From 0187d06e96165b343678b879d28edf78ee34b0af Mon Sep 17 00:00:00 2001 From: Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> Date: Mon, 22 Mar 2021 10:23:13 -0700 Subject: [PATCH] SecureBuffer#wipe with block --- src/sodium/secure_buffer.cr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sodium/secure_buffer.cr b/src/sodium/secure_buffer.cr index 450a6b9..d4d01ea 100644 --- a/src/sodium/secure_buffer.cr +++ b/src/sodium/secure_buffer.cr @@ -64,6 +64,12 @@ module Sodium noaccess! end + def wipe + yield + ensure + wipe + end + def finalize LibSodium.sodium_free @ptr end