identity

package
v0.9.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// default privage secret key. It can be an age key of a PIV encoded age
	// key.
	FileName = "privage-key.txt"
	TypePiv  = "PIV"
	TypeAge  = "AGE"
)
View Source
const PivAlgoRsa2048 = "RSA2048"

Variables

This section is empty.

Functions

func BackupFilePath

func BackupFilePath(dir string) string

BackupFilePath returns a path for a backup identity file.

func Create

func Create(filePath string) error

Create generates a age Identity and writes it in the file at filePath

func CreatePivRsa

func CreatePivRsa(filePath string, slot uint32, algo string) error

CreatePivRsa generates an age secret key and encrypts it using the yubikey key at slot slot.

It writes the encrypted payload in filePath.

func FmtType

func FmtType(slot string) string

func LoadRaw

func LoadRaw(path string, slot uint32, algo string) ([]byte, error)

LoadRaw returns the decrypted contents of the file at path, using the key in the slot slot

Types

type Identity

type Identity struct {

	// The age identity
	Id *age.X25519Identity

	// Path of the found key.
	// Path can contain a normal age key or a PIV encrypted one.
	//
	// Path can be not empty and still a null Id because of a decoding error.
	//
	// A empty Path means all possible paths were searched and no files were
	// found
	Path string

	// Err is the error raised finding or validating the a age identity.
	Err error
}

An Identity is a wrapper for the age Identity.

func Load

func Load(confPath string) Identity

Load returns an Age identity

it tries: 1) the path given in the config file 2) FILE in the current dir 3) FILE in the user HOME init method check if exist

func LoadPiv

func LoadPiv(path string, slot uint32, algo string) Identity

LoadPiv returns the age identity that is encrypted in the file at path, by decrypting it with the key at the yubikey slot slot.

Jump to

Keyboard shortcuts

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