utils

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEntity

func CreateEntity(name, email string) (*openpgp.Entity, error)

func Decrypt

func Decrypt(encoded string, entityList openpgp.EntityList) (string, error)

Decrypts the base64-encoded string end decrypts with the private key.

func DisplaySyntaxError

func DisplaySyntaxError(data []byte, syntaxError error) (err error)

displaySyntaxError will display more information such as line and error type given an error and the data that was unmarshalled. Thanks to https://github.com/markpeek/packer/commit/5bf33a0e91b2318a40c42e9bf855dcc8dd4cdec5

func Encrypt

func Encrypt(secret string, entityList openpgp.EntityList) (string, error)

Encrypts secret with all public keys and base64-encodes the result.

func GetEntityList

func GetEntityList(keys []string, passphrase string) (openpgp.EntityList, error)

Assembles entity list from keys in given files

func Includes

func Includes(haystack []string, needle string) bool

IncludesPrefix checks if needle is in haystack

func IncludesPrefix

func IncludesPrefix(haystack []string, needle string) bool

IncludesPrefix checks if any item in haystack is a prefix of needle

func JSONPointerPath

func JSONPointerPath(s string) string

JSONPointerPath builds a JSON pointer path according to spec, see https://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07#section-3.

func PrintPrivateKey

func PrintPrivateKey(entity *openpgp.Entity, filename string) error

func PrintPublicKey

func PrintPublicKey(entity *openpgp.Entity, filename string) error

func ReadFile

func ReadFile(filename string) (string, error)

ReadFile reads the content of given filename and returns it as a string

func Remove

func Remove(s []string, val string) []string

Remove removes val from slice

Types

type FileStater added in v0.13.0

type FileStater interface {
	Stat(name string) (os.FileInfo, error)
}

FileStater is a helper interface to allow testing.

type OsFS added in v0.13.0

type OsFS struct{}

OsFS implements Stat() for local disk.

func (OsFS) Stat added in v0.13.0

func (OsFS) Stat(name string) (os.FileInfo, error)

Stat proxies to os.Stat.

Jump to

Keyboard shortcuts

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