Add Crypto::Secret::Bidet

This commit is contained in:
Didactic Drunk 2021-06-15 15:23:02 -07:00
parent 00274735c3
commit f18b3cd6f6

View File

@ -0,0 +1,23 @@
require "./stateless"
# Leaves less sh** around if you forget to wipe. A safer default for large secrets that may stress mlock limits or low confidentiality secrets.
#
# * Not locked in memory
# * Not access protected
# * No guard pages
module Crypto::Secret
class Bidet
include Stateless
def self.new(size)
new references: Bytes.new(size)
end
def initialize(*, references : Bytes)
@bytes = references
end
delegate_to_slice @bytes
delegate_to_bytesize @bytes.bytesize
end
end