keys

package
v0.0.0-...-77d204d Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package keys could be it's own thing between go-ssb and this but not today

Index

Constants

This section is empty.

Variables

View Source
var SecretPerms = os.FileMode(0600)

Functions

func EncodeKeyPairAsJSON

func EncodeKeyPairAsJSON(kp KeyPair, w io.Writer) error

EncodeKeyPairAsJSON serializes the passed Keypair into the writer w

func IsValidFeedFormat

func IsValidFeedFormat(r refs.FeedRef) error

IsValidFeedFormat checks if the passed FeedRef is for one of the two supported formats, legacy/crapp or GabbyGrove.

func SaveKeyPair

func SaveKeyPair(kp KeyPair, path string) error

SaveKeyPair serializes the passed KeyPair to path. It errors if path already exists.

Types

type KeyPair

type KeyPair struct {
	Feed refs.FeedRef
	Pair secrethandshake.EdKeyPair
}

KeyPair contains a seret handshake keypair and the assosicated feed

func LoadKeyPair

func LoadKeyPair(fname string) (*KeyPair, error)

LoadKeyPair opens fname, ignores any line starting with # and passes it ParseKeyPair

func NewKeyPair

func NewKeyPair(r io.Reader) (*KeyPair, error)

NewKeyPair generates a fresh KeyPair using the passed io.Reader as a seed. Passing nil is fine and will use crypto/rand.

func ParseKeyPair

func ParseKeyPair(r io.Reader) (*KeyPair, error)

ParseKeyPair json decodes an object from the reader. It expects std base64 encoded data under the `private` and `public` fields.

Jump to

Keyboard shortcuts

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