format

package
v1.0.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package format implements the age file format.

Index

Constants

View Source
const BytesPerLine = ColumnsPerLine / 4 * 3
View Source
const ColumnsPerLine = 64

Variables

View Source
var EncodeToString = b64.EncodeToString

Functions

func DecodeString

func DecodeString(s string) ([]byte, error)

func NewlineWriter

func NewlineWriter(dst io.Writer) io.Writer

NewlineWriter returns a Writer that writes to dst, inserting an LF character every ColumnsPerLine bytes. It does not insert a newline neither at the beginning nor at the end of the stream.

Types

type Header struct {
	Recipients []*Stanza
	MAC        []byte
}

func Parse

func Parse(input io.Reader) (*Header, io.Reader, error)

Parse returns the header and a Reader that begins at the start of the payload.

func (*Header) Marshal

func (h *Header) Marshal(w io.Writer) error

func (*Header) MarshalWithoutMAC

func (h *Header) MarshalWithoutMAC(w io.Writer) error

type ParseError

type ParseError string

func (ParseError) Error

func (e ParseError) Error() string

type Stanza

type Stanza struct {
	Type string
	Args []string
	Body []byte
}

Stanza is assignable to age.Stanza, and if this package is made public, age.Stanza can be made a type alias of this type.

func (*Stanza) Marshal

func (r *Stanza) Marshal(w io.Writer) error

Jump to

Keyboard shortcuts

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