From 740e49cc6b88985f879158641909b928ae94ba9f Mon Sep 17 00:00:00 2001 From: Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> Date: Mon, 26 Aug 2019 03:31:17 -0700 Subject: [PATCH] Sodium::Sign::SecretKey#initialize add erase argument. --- src/sodium/sign/secret_key.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sodium/sign/secret_key.cr b/src/sodium/sign/secret_key.cr index 2060fb7..8114d1e 100644 --- a/src/sodium/sign/secret_key.cr +++ b/src/sodium/sign/secret_key.cr @@ -37,10 +37,10 @@ module Sodium # Use existing secret and public keys. # Copies secret key to a SecureBuffer. # Recomputes the public key from a secret key if missing. - def initialize(bytes : Bytes, pkey : Bytes? = nil) + def initialize(bytes : Bytes, pkey : Bytes? = nil, *, erase = false) raise ArgumentError.new("Secret sign key must be #{KEY_SIZE}, got #{bytes.bytesize}") unless bytes.bytesize == KEY_SIZE - @sbuf = SecureBuffer.new bytes + @sbuf = SecureBuffer.new bytes, erase: erase if pk = pkey @public_key = PublicKey.new pkey else