Add Crypto::Secret::Bidet
This commit is contained in:
parent
00274735c3
commit
f18b3cd6f6
23
src/crypto-secret/bidet.cr
Normal file
23
src/crypto-secret/bidet.cr
Normal 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
|
Loading…
Reference in New Issue
Block a user