securebytes

package
v0.0.0-...-991afdd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL