credfile

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package credfile keeps files in one private directory held open as a root: the custody the credential store's file needs, and the one package of this module that names the atomic-file dependency.

Its errors carry the dependency's text and never its values, so nothing a consumer can match with errors.Is or errors.As reaches the published surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

Dir is one private directory under a retained root handle.

func Open

func Open(dir string, logger *slog.Logger) (*Dir, error)

Open establishes custody of one directory level: created at 0700 where absent, refused where it pre-exists with group or other access or another owner, and then held as a root whose own handle is checked again, because opening the root by name re-resolves the path the custody check vouched for. Every call into the dependency carries logger, since the dependency otherwise logs to a sink this library does not own.

func (*Dir) Read

func (d *Dir) Read(ctx context.Context, name string) (data []byte, found bool, err error)

Read answers name's bytes, and false with no error where the directory holds no such file.

func (*Dir) Write

func (d *Dir) Write(ctx context.Context, name string, data []byte) (bool, error)

Write replaces name with data atomically at the private mode and reports whether the write was proved durable. A false with a nil error means the data is at the name and may not survive a crash.

Jump to

Keyboard shortcuts

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