header

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: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize          = 512 // bytes
	MaxLenghtCategory  = 40
	MaxLenghtLabel     = 200
	CategoryCredential = "credential"
)

Variables

This section is empty.

Functions

func PadEncrypted

func PadEncrypted(header []byte) ([]byte, error)

PadEncrypted fills the encrypted (with age) header up to BlockSize with 0x20 characters

func Unpad

func Unpad(header []byte) ([]byte, error)

Unpad removes the filled characters of a encrypted header.

Types

type Header struct {
	Version  string
	Category string
	Label    string

	// Path of the privage file containing the header
	Path string

	// Error when unpadding or decrypting the header of the  file
	Err error
}

A Header contains the filename and a category (the metadata) of a file.

This metadata is serialized and encrypted at the start of a privage file.

func Parse

func Parse(h []byte) *Header

Parse parses a serialized version of a header and creates a Header struct

func (*Header) Pad

func (h *Header) Pad() []byte

Pad returns a serialized version of the header: string concatenation with padding

func (*Header) String

func (h *Header) String() string

Jump to

Keyboard shortcuts

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