diff --git a/src/crypto-secret/key.cr b/src/crypto-secret/key.cr index 3fb10e4..b10323b 100644 --- a/src/crypto-secret/key.cr +++ b/src/crypto-secret/key.cr @@ -1,12 +1,16 @@ require "./bidet" -module Crypto::Secret - # Use this class for holding small amounts of sensitive data such as crypto keys - # - # Underlying implentation subject to change - # +# Use this class for holding small amounts of sensitive data such as crypto keys +# +# Underlying implentation subject to change +# +# Uses `Sodium::SecureBuffer` If "sodium" is required before "crypto-secret" +{% if @type.has_constant?("Sodium") %} + class Crypto::Secret::Key < ::Sodum::SecureBuffer + end +{% else %} # TODO: mlock # TODO: mprotect - class Key < Bidet + class Crypto::Secret::Key < ::Crypto::Secret::Bidet end -end +{% end %} diff --git a/src/crypto-secret/secret.cr b/src/crypto-secret/secret.cr index 08f0265..4e23287 100644 --- a/src/crypto-secret/secret.cr +++ b/src/crypto-secret/secret.cr @@ -106,7 +106,6 @@ module Crypto::Secret end end - # Marks a region allocated using as read & write depending on implementation. abstract def readwrite : self # Marks a region allocated using as read-only depending on implementation.