diff --git a/src/crypto-secret/lib.cr b/src/crypto-secret/lib.cr new file mode 100644 index 0000000..ce8fda4 --- /dev/null +++ b/src/crypto-secret/lib.cr @@ -0,0 +1,11 @@ +require "crypto/subtle" + +lib LibC + fun explicit_bzero(Void*, LibC::SizeT) : Void +end + +struct Slice(T) + def wipe + LibC.explicit_bzero to_unsafe, bytesize + end +end diff --git a/src/crypto-secret/secret.cr b/src/crypto-secret/secret.cr index dfc7371..bea8bb6 100644 --- a/src/crypto-secret/secret.cr +++ b/src/crypto-secret/secret.cr @@ -1,14 +1,4 @@ -require "crypto/subtle" - -lib LibC - fun explicit_bzero(Void*, LibC::SizeT) : Void -end - -struct Slice(T) - def wipe - LibC.explicit_bzero to_unsafe, bytesize - end -end +require "./lib" # Interface to hold sensitive information (often cryptographic keys) #