file

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package file provides a Storage implementation for storing x509 certificates as files

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	Directory: "darvaza_store",
	DirMode:   0700,
}

DefaultOptions for FileStorage Options

Functions

This section is empty.

Types

type Options

type Options struct {
	Directory string
	DirMode   fs.FileMode
}

Options is a struct containing the storage options in the case of FileStorage it only contains a directory name and the file mode

type Store

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

Store is a darvaza Storage implementation for storing x509 certificates as files

func NewStore

func NewStore(options Options) (Store, error)

NewStore will create a new File Storage. If no options are given it will use the DefaultOptions

func (*Store) Delete

func (m *Store) Delete(_ context.Context, name string) error

Delete will delete the first certificate with the same common name as the given parameter

func (*Store) DeleteCert

func (m *Store) DeleteCert(_ context.Context, cert *x509.Certificate) error

DeleteCert will delete from the store the certificate given as parameter

func (*Store) ForEach

func (m *Store) ForEach(_ context.Context, f x509utils.StoreIterFunc) error

ForEach will walk the store and ececute the StoreIterFunc for each certificate it can decode

func (*Store) Get

func (m *Store) Get(_ context.Context, name string) (*x509.Certificate, error)

Get will return the first x509 certificate and an error, the certificate having the same common name as the name parameter

func (*Store) Put

func (m *Store) Put(_ context.Context, name string, cert *x509.Certificate) error

Put will create a file in the store with the given name and the given certificate it will write in the fil eteh content of cert.Raw field

Jump to

Keyboard shortcuts

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