pair

package
v0.0.0-...-f5f0bdb Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// XSalsa20_Poly1305 ...
	XSalsa20_Poly1305 encodingTypeEnum = iota
	// None ...
	None
)
View Source
const (
	// PKCS8 ...
	PKCS8 encodingContentEnum = iota
)

Variables

View Source
var (
	// DEFAULT_PKCS8_DIVIDER ...
	DEFAULT_PKCS8_DIVIDER = []byte{161, 35, 3, 33, 0}
	// DEFAULT_PKCS8_HEADER ...
	DEFAULT_PKCS8_HEADER = []byte{48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32}
	// DEFAULT_KEY_LENGTH ...
	DEFAULT_KEY_LENGTH = 32
	// DEFAULT_SEED_OFFSET ...
	DEFAULT_SEED_OFFSET = len(DEFAULT_PKCS8_HEADER)
	// DEFAULT_DIV_OFFSET ...
	DEFAULT_DIV_OFFSET = DEFAULT_SEED_OFFSET + DEFAULT_KEY_LENGTH
	// DEFAULT_PUBLIC_OFFSET ...
	DEFAULT_PUBLIC_OFFSET = DEFAULT_SEED_OFFSET + DEFAULT_KEY_LENGTH + len(DEFAULT_PKCS8_DIVIDER)
)
View Source
var ErrUnknownEncodingContent = errors.New("encoding content: unknown")

ErrUnknownEncodingContent ...

View Source
var ErrUnknownEncodingType = errors.New("encoding type: unknown")

ErrUnknownEncodingType ...

Functions

func Decode

func Decode(passphrase *string, encrypted []byte) ([32]byte, [64]byte, error)

Decode ...

func Encode

func Encode(secretKey [64]byte, passphrase *string) ([]byte, error)

Encode ...

Types

type EncodingContentEnum

type EncodingContentEnum interface {
	Type() encodingContentEnum
	String() string
}

EncodingContentEnum ...

func AllEncodingContentEnums

func AllEncodingContentEnums() []EncodingContentEnum

AllEncodingContentEnums returns all of the encoding content enums

func EncodingContentEnumFromString

func EncodingContentEnumFromString(s string) (EncodingContentEnum, error)

EncodingContentEnumFromString ...

type EncodingTypeEnum

type EncodingTypeEnum interface {
	Type() encodingTypeEnum
	String() string
}

EncodingTypeEnum ...

func AllEncodingTypeEnums

func AllEncodingTypeEnums() []EncodingTypeEnum

AllEncodingTypeEnums returns all of the encoding type enums

func EncodingTypeEnumFromString

func EncodingTypeEnumFromString(s string) (EncodingTypeEnum, error)

EncodingTypeEnumFromString ...

type InterfacePair

type InterfacePair interface {
	Address() (string, error)
	DecodePkcs8(password *string, encoded []byte) error
	EncodePkcs8(password *string) ([]byte, error)
	GetMeta() (ktypes.Meta, error)
	IsLocked() bool
	Lock() error
	PublicKey() ([32]byte, error)
	SetMeta(meta ktypes.Meta) error
	Sign(message []byte) ([]byte, error)
	// note: change to Marshal?
	ToJSON(password *string) ([]byte, error)
	Verify(message, signature []byte) (bool, error)
}

InterfacePair ...

type InterfacePairs

type InterfacePairs interface {
	Add(pair *Pair) (*Pair, error)
	All() ([]*Pair, error)
	Get(addr []byte) (*Pair, error)
	Remove(addr []byte) error
}

InterfacePairs ...

type MapPair

type MapPair map[string]*Pair

MapPair ...

type Pair

type Pair struct {
	State *State
	// contains filtered or unexported fields
}

Pair ...

func NewPair

func NewPair(naclPub [32]byte, naclPriv [64]byte, meta ktypes.Meta, defaultEncoded []byte) (*Pair, error)

NewPair ...

func NewPairFromJSON

func NewPairFromJSON(data []byte, password *string) (*Pair, error)

NewPairFromJSON ...

func (*Pair) Address

func (p *Pair) Address() (string, error)

Address ...

func (*Pair) DecodePkcs8

func (p *Pair) DecodePkcs8(passphrase *string, encoded []byte) error

DecodePkcs8 ...

func (*Pair) EncodePkcs8

func (p *Pair) EncodePkcs8(passphrase *string) ([]byte, error)

EncodePkcs8 ...

func (*Pair) GetMeta

func (p *Pair) GetMeta() (ktypes.Meta, error)

GetMeta ...

func (*Pair) IsLocked

func (p *Pair) IsLocked() bool

IsLocked ...

func (*Pair) Lock

func (p *Pair) Lock() error

Lock ...

func (*Pair) PublicKey

func (p *Pair) PublicKey() ([32]byte, error)

PublicKey ...

func (*Pair) SetMeta

func (p *Pair) SetMeta(meta ktypes.Meta) error

SetMeta ...

func (*Pair) Sign

func (p *Pair) Sign(message []byte) ([]byte, error)

Sign ...

func (*Pair) ToJSON

func (p *Pair) ToJSON(passphrase *string) ([]byte, error)

ToJSON ...

func (*Pair) Verify

func (p *Pair) Verify(message, signature []byte) (bool, error)

Verify ...

type Pairs

type Pairs struct {
	PairMap MapPair
}

Pairs ...

func NewPairs

func NewPairs() (*Pairs, error)

NewPairs ...

func (*Pairs) Add

func (p *Pairs) Add(pair *Pair) (*Pair, error)

Add ...

func (*Pairs) All

func (p *Pairs) All() ([]*Pair, error)

All ...

func (*Pairs) Get

func (p *Pairs) Get(addr []byte) (*Pair, error)

Get ...

func (*Pairs) Remove

func (p *Pairs) Remove(addr []byte) error

Remove ...

type State

type State struct {
	Meta      ktypes.Meta
	PublicKey [32]byte
}

State ...

Jump to

Keyboard shortcuts

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