delago.dedis.ch/dela/crypto/loader Index | Files

package loader

import "go.dedis.ch/dela/crypto/loader"

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

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.

Source Files

file.go mod.go

Version
v0.1.0 (latest)
Published
Apr 10, 2024
Platform
linux/amd64
Imports
3 packages
Last checked
1 month ago

Tools for package owners.