securememory

package module
v0.0.0-...-0e84ff7 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

blah

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllocCounter is used to track secret allocations.
	// nolint - Needs to be global to track allocations
	AllocCounter = metrics.GetOrRegisterCounter("secret.allocated", nil)
)

Functions

This section is empty.

Types

type Secret

type Secret interface {
	// WithBytes makes the underlying bytes readable and passes them to the function provided.
	// A reference MUST not be kept to the bytes passed to the function as the underlying array will no
	// longer be readable after the function exits.
	WithBytes(action func([]byte) error) error
	// WithBytes makes the underlying bytes readable and passes them to the function provided.
	// A reference MUST not be kept to the bytes passed to the function as the underlying array will no
	// longer be readable after the function exits.
	WithBytesFunc(action func([]byte) ([]byte, error)) ([]byte, error)
	// IsClosed returns true if the underlying data container has already been closed.
	IsClosed() bool
	// Close closes the data container and frees any associated memory.
	Close() error
}

Secret contains sensitive memory and stores data in protected page(s) in memory. Always call close after use to avoid memory leaks.

type SecretFactory

type SecretFactory interface {
	// New takes in a byte slice and returns a Secret containing that data.
	New(b []byte) (Secret, error)
	// CreateRandom returns a Secret that contains a random byte slice of the specified size.
	CreateRandom(size int) (Secret, error)
}

SecretFactory is the interface for creating specific implementations of a Secret.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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