loader

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: BSD-3-Clause Imports: 3 Imported by: 5

Documentation

Overview

Package loader defines an abstraction to store a private, or a public, key in a storage.

When the key does not exist, it will generate a new one using a generator implemented by the caller and stores it for the next time.

Documentation Last Review: 06.10.2020

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	Generate() ([]byte, error)
}

Generator is the interface to implement to generate a key.

type Loader

type Loader interface {
	// LoadOrCreate tries to load the key and returns it if found, otherwise it
	// generates a new one using the generator and stores it.
	LoadOrCreate(Generator) ([]byte, error)

	// Load loads the key and returns an error if it doesn't find it.
	Load() ([]byte, error)
}

Loader is an abstraction to load a key from a storage. It allows for instance to load a private key from the disk, or generate it if it doesn't exist.

func NewFileLoader

func NewFileLoader(path string) Loader

NewFileLoader creates a new loader that is using the file given in parameter.

Jump to

Keyboard shortcuts

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