metakeys

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeedLength = 64
)

Some constants

Variables

This section is empty.

Functions

func GenerateSeed

func GenerateSeed() ([]byte, error)

GenerateSeed returns a fresh seed of Seedlength bytes, using crypto/rand as a source

Types

type KeyPair

type KeyPair struct {
	Seed []byte

	Feed       refs.FeedRef
	PrivateKey ed25519.PrivateKey
}

KeyPair is a bendybutt metafeed keypair and the corresponding feed refrence. It also keeps the seed around for deriving further keys from it.

func DeriveFromSeed

func DeriveFromSeed(seed []byte, label string, algo refs.RefAlgo) (KeyPair, error)

DeriveFromSeed generates a new KeyPair using the seed and label for hkdf derivation

func (KeyPair) ID

func (kp KeyPair) ID() refs.FeedRef

ID returns the feed reference of the keypair (implements ssb.KeyPair)

func (KeyPair) MarshalJSON

func (kp KeyPair) MarshalJSON() ([]byte, error)

MarshalJSON turns a keypair into json data adding a `Type: "bendy-butt"` to it

func (KeyPair) Secret

func (kp KeyPair) Secret() ed25519.PrivateKey

Secret returns the private part of the keypair (implements ssb.KeyPair)

func (*KeyPair) UnmarshalJSON

func (kp *KeyPair) UnmarshalJSON(input []byte) error

UnmarshalJSON checks if the input data is indeed an object that descripts a bendy-butt keypair

Jump to

Keyboard shortcuts

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