handshake

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOathTotpProtocol = &OathTotpProtocol{
	Hash:     hash.SHA256,
	Timestep: time.Minute,
}
View Source
var ErrParse = errors.New("failed to parse")
View Source
var ErrUnsupportedHashAlgorithm = errors.New("unsupported hash algorithm")
View Source
var WireGuardProtocol = &nyquist.Protocol{
	Pattern: pattern.IK,
	DH:      dh.X25519,
	Cipher:  cipher.ChaChaPoly,
	Hash:    hash.BLAKE2s,
}

Functions

func NewInProcessPipe

func NewInProcessPipe() (*InProcessPipe, *InProcessPipe)

Types

type ChainedHandshake

type ChainedHandshake []Handshake

func NewChainedHandshake

func NewChainedHandshake(slots ...Handshake) ChainedHandshake

func (ChainedHandshake) Secret

func (cp ChainedHandshake) Secret(ctx context.Context) (s Secret, err error)

type Handshake

type Handshake interface {
	Secret(ctx context.Context) (Secret, error)
}

A SecretProvider represents a single cryptographic key accessed through a Provider

type InProcessPipe

type InProcessPipe struct {
	*io.PipeReader
	*io.PipeWriter
}

type Key

type Key struct {
	Protocol Protocol
	Key      []byte
}

func (*Key) MarshalText

func (k *Key) MarshalText() ([]byte, error)

func (*Key) PrivateKey

func (k *Key) PrivateKey() (ecdh.PrivateKey, error)

func (*Key) String

func (k *Key) String() string

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(t []byte) (err error)

type NoiseHandshake

type NoiseHandshake struct {
	*nyquist.HandshakeState
	// contains filtered or unexported fields
}

func NewNoiseHandshake

func NewNoiseHandshake(proto *nyquist.Protocol, ss dh.Keypair, sp dh.PublicKey, rw io.ReadWriter, initiator bool) (hs *NoiseHandshake, err error)

func (*NoiseHandshake) Secret

func (hs *NoiseHandshake) Secret(_ context.Context) (ss Secret, err error)

type OATHHandshake

type OATHHandshake struct {
	Timestep time.Duration
	Key      provider.PrivateKeyHMAC
	Clock    func() time.Time
}

func (*OATHHandshake) Secret

func (hs *OATHHandshake) Secret(_ context.Context) (ss Secret, err error)

type OathHotpProtocol

type OathHotpProtocol struct {
	Hash hash.Hash
}

func (*OathHotpProtocol) String

func (c *OathHotpProtocol) String() string

type OathTotpProtocol

type OathTotpProtocol struct {
	Timestep time.Duration
	Hash     hash.Hash
}

func (*OathTotpProtocol) String

func (c *OathTotpProtocol) String() string

type Protocol

type Protocol interface {
	String() string
}

func ParseProtocol

func ParseProtocol(s string) (Protocol, error)

func ParseProtocolFromMap

func ParseProtocolFromMap(m map[string]any) (Protocol, error)

type Secret

type Secret []byte

Jump to

Keyboard shortcuts

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