Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SecureBytes ¶
type SecureBytes struct {
// contains filtered or unexported fields
}
SecureBytes is used to store a byte slice securely in memory. It uses memguard to protect sensitive data from being exposed in memory dumps, swap files, or other memory scanning attacks.
func NewSecureBytes ¶
func NewSecureBytes(b []byte) (*SecureBytes, error)
NewSecureBytes creates a new SecureBytes instance from the given byte slice. The original byte slice should be wiped after creating SecureBytes to ensure the sensitive data is only stored in the secure buffer.
func (*SecureBytes) Bytes ¶
func (sb *SecureBytes) Bytes() []byte
Bytes returns the securely stored byte slice. WARNING: The returned bytes are still protected by memguard, but any copies made from this slice will not be protected. Use with caution.
func (*SecureBytes) Wipe ¶
func (sb *SecureBytes) Wipe() error
Wipe removes the byte slice from memory and makes it unrecoverable. After calling Wipe, the SecureBytes instance should not be used.