plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const BytesPerLine = ColumnsPerLine / 4 * 3
View Source
const ColumnsPerLine = 64
View Source
const (
	Name = "op"
)

Variables

View Source
var (
	Log *log.Logger
)

Functions

func DecodeString

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

func EncodeRecipient

func EncodeRecipient(r *OpRecipient) string

func Marshal

func Marshal(w io.Writer)

func MarshalIdentity

func MarshalIdentity(i *OpIdentity, w io.Writer) error

func MarshalStanza

func MarshalStanza(s *age.Stanza, w io.Writer) error

func NewIndexedErrorStanza

func NewIndexedErrorStanza(kind string, index int, err error) *age.Stanza

func NewInternalErrorStanza

func NewInternalErrorStanza(err error) *age.Stanza

func ParseStanza

func ParseStanza(rr *bufio.Reader) (*age.Stanza, error)

func ReadKeyOp

func ReadKeyOp(privateKeyPath string) ([]byte, error)

func SetLogger

func SetLogger(w io.Writer)

func SplitArgs

func SplitArgs(line []byte) (string, []string)

Types

type OpIdentity

type OpIdentity struct {
	Version uint8
	// contains filtered or unexported fields
}

func CreateIdentity

func CreateIdentity(privateKeyPath string) (*OpIdentity, error)

CreateIdentity creates a new identity. Returns the identity and the corresponding recipient.

func DecodeIdentity

func DecodeIdentity(s string) (*OpIdentity, error)

func NewOpIdentity

func NewOpIdentity(privateKeyPath string) *OpIdentity

func (*OpIdentity) Recipient

func (i *OpIdentity) Recipient() *OpRecipient

func (*OpIdentity) Unwrap

func (i *OpIdentity) Unwrap(stanzas []*age.Stanza) ([]byte, error)

type OpRecipient

type OpRecipient struct {
	// contains filtered or unexported fields
}

func DecodeRecipient

func DecodeRecipient(s string) (*OpRecipient, error)

func NewRecipient

func NewRecipient(opPath string) *OpRecipient

func (*OpRecipient) Identity

func (r *OpRecipient) Identity() *OpIdentity

func (*OpRecipient) String

func (r *OpRecipient) String() string

func (*OpRecipient) Tag

func (r *OpRecipient) Tag() []byte

Tag returns the 4 first bytes of the path to the key this is used to find the correct identity in a stanza

func (*OpRecipient) Wrap

func (r *OpRecipient) Wrap(fileKey []byte) ([]*age.Stanza, error)

type ParseError

type ParseError struct {
	// contains filtered or unexported fields
}

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

type StanzaReader

type StanzaReader struct {
	// contains filtered or unexported fields
}

func NewStanzaReader

func NewStanzaReader(r *bufio.Reader) *StanzaReader

func (*StanzaReader) ReadStanza

func (r *StanzaReader) ReadStanza() (s *age.Stanza, err error)

type WrappedBase64Encoder

type WrappedBase64Encoder struct {
	// contains filtered or unexported fields
}

WrappedBase64Encoder is a standard base64 encoder that inserts an LF character every ColumnsPerLine bytes. It does not insert a newline neither at the beginning nor at the end of the stream, but it ensures the last line is shorter than ColumnsPerLine, which means it might be empty.

func NewWrappedBase64Encoder

func NewWrappedBase64Encoder(enc *base64.Encoding, dst io.Writer) *WrappedBase64Encoder

NewWrappedBase64Encoder returns a WrappedBase64Encoder that writes to dst.

func (*WrappedBase64Encoder) Close

func (w *WrappedBase64Encoder) Close() error

func (*WrappedBase64Encoder) Write

func (w *WrappedBase64Encoder) Write(p []byte) (int, error)

type WriterFunc

type WriterFunc func(p []byte) (int, error)

func (WriterFunc) Write

func (f WriterFunc) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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