infofile

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const UnknownGPGKey = "UnknownGPGKey"

Variables

This section is empty.

Functions

This section is empty.

Types

type InfoFile

type InfoFile struct {
	App     string `json:"app"`
	Version uint16 `json:"ver"`

	// Fields for version 1 only
	// Passphrase
	Salt             []byte `json:"slt,omitempty"`
	ConfirmationHash []byte `json:"ph,omitempty"`
	// GPG-encrypted key
	EncryptedKey []byte `json:"ek,omitempty"`

	// Fields for version 2+
	DataPath string        `json:"dp,omitempty"`
	Keys     []InfoFileKey `json:"k,omitempty"`

	// Fields for version 4+
	RepoId string `json:"id"`
}

InfoFile is the content of the info file

func New

func New() (*InfoFile, error)

New creates a new info file

func (*InfoFile) AddGPGWrappedKey

func (info *InfoFile) AddGPGWrappedKey(gpgKey string, wrappedKey []byte) error

AddGPGWrappedKey adds a GPG-wrapped key to an info file

func (*InfoFile) AddPassphrase

func (info *InfoFile) AddPassphrase(salt []byte, confirmationHash []byte, wrappedKey []byte) error

AddPassphrase adds a passphrase to an info file

func (*InfoFile) RemoveKey

func (info *InfoFile) RemoveKey(keyId string) error

RemoveKey removes a key from the info file

func (*InfoFile) Validate

func (info *InfoFile) Validate() error

Validate validates the info object

type InfoFileKey

type InfoFileKey struct {
	// Wrapped master key
	MasterKey []byte `json:"m,omitempty"`
	// Passphrase
	Salt             []byte `json:"s,omitempty"`
	ConfirmationHash []byte `json:"p,omitempty"`
	// GPG key id
	GPGKey string `json:"g,omitempty"`
}

InfoFileKey is a key that can be used to unlock a repo

Jump to

Keyboard shortcuts

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