Crypto::Secret::Key used Sodium::SecureBuffer when available

master
Didactic Drunk 2021-06-17 13:04:26 -07:00
parent 8977222b44
commit 39a5f558b2
2 changed files with 11 additions and 8 deletions

View File

@ -1,12 +1,16 @@
require "./bidet" require "./bidet"
module Crypto::Secret # Use this class for holding small amounts of sensitive data such as crypto keys
# Use this class for holding small amounts of sensitive data such as crypto keys #
# # Underlying implentation subject to change
# 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: mlock
# TODO: mprotect # TODO: mprotect
class Key < Bidet class Crypto::Secret::Key < ::Crypto::Secret::Bidet
end end
end {% end %}

View File

@ -106,7 +106,6 @@ module Crypto::Secret
end end
end end
# Marks a region allocated using as read & write depending on implementation. # Marks a region allocated using as read & write depending on implementation.
abstract def readwrite : self abstract def readwrite : self
# Marks a region allocated using as read-only depending on implementation. # Marks a region allocated using as read-only depending on implementation.