keys

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoSuchKey

func IsNoSuchKey(err error) bool

Types

type Base64String

type Base64String Key

func (*Base64String) UnmarshalJSON

func (s *Base64String) UnmarshalJSON(data []byte) error

type Error

type Error struct {
	Code   ErrorCode
	Scheme KeyScheme
	ID     ID

	// TODO: add unwrap
	Cause error
}

func (Error) Error

func (err Error) Error() string

type ErrorCode

type ErrorCode uint8
const (
	ErrorCodeInternal ErrorCode = iota
	ErrorCodeInvalidKeyScheme
	ErrorCodeNoSuchKey
)

func (ErrorCode) String

func (code ErrorCode) String() string

type ID

type ID []byte

func IDFromFeed added in v0.2.1

func IDFromFeed(r refs.FeedRef) ID

type Info

type Info []byte

func (Info) Len

func (info Info) Len() int

type Infos

type Infos []Info

func (Infos) Encode

func (is Infos) Encode(out []byte) int

func (Infos) Len

func (is Infos) Len() int

type Key

type Key []byte

Key holds actual key material

func (Key) Derive

func (k Key) Derive(buf []byte, infos Infos, outLen int) (Key, error)

Derive returns a new key derived from the internal key data and the passed infos.

type KeyScheme

type KeyScheme string
const (
	SchemeLargeSymmetricGroup         KeyScheme = "envelope-large-symmetric-group"
	SchemeDiffieStyleConvertedED25519 KeyScheme = "envelope-id-based-dm-converted-ed25519"
	SchemeFeedMessageSigningKey       KeyScheme = "feed-message-signing-key"
	SchemeMetafeedSubkey              KeyScheme = "metafeed-subkey"
)

func (KeyScheme) Valid

func (ks KeyScheme) Valid() bool

type Keys

type Keys []Key

Keys is a list of keys

type Metadata

type Metadata struct {
	GroupRoot refs.MessageRef
	ForFeed   refs.FeedRef
}

should be either or but differently typed enums are hard in go :-/

type Recipient

type Recipient struct {
	Key Key

	Scheme KeyScheme // (shared secret, diffie, etc)

	Metadata Metadata
}

Recipient combines key data with a scheme

type Recipients

type Recipients []Recipient

Recipients are a list of Recipients

type Store

type Store struct {
	Index librarian.SetterIndex
}

func (*Store) AddKey

func (mgr *Store) AddKey(id ID, r Recipient) error

func (*Store) GetKeys

func (mgr *Store) GetKeys(ks KeyScheme, id ID) (Recipients, error)

func (*Store) GetKeysForMessage added in v0.2.1

func (mgr *Store) GetKeysForMessage(ks KeyScheme, msg refs.MessageRef) (Recipients, error)

func (*Store) RmKey added in v0.2.1

func (mgr *Store) RmKey(ks KeyScheme, id ID, rmKey Recipient) error

func (*Store) RmKeys

func (mgr *Store) RmKeys(ks KeyScheme, id ID) error

func (*Store) SetKey

func (mgr *Store) SetKey(id ID, r Recipient) error

Jump to

Keyboard shortcuts

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