handshake

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PeerIDAuthScheme = "libp2p-PeerID"

Variables

View Source
var (
	ErrExpiredChallenge = errors.New("challenge expired")
	ErrExpiredToken     = errors.New("token expired")
	ErrInvalidHMAC      = errors.New("invalid HMAC")
)

Functions

This section is empty.

Types

type PeerIDAuthHandshakeClient

type PeerIDAuthHandshakeClient struct {
	Hostname string
	PrivKey  crypto.PrivKey
	// contains filtered or unexported fields
}

func (*PeerIDAuthHandshakeClient) AddHeader

func (h *PeerIDAuthHandshakeClient) AddHeader(hdr http.Header)

func (*PeerIDAuthHandshakeClient) BearerToken

func (h *PeerIDAuthHandshakeClient) BearerToken() string

BearerToken returns the server given bearer token for the client. Set this on the Authorization header in the client's request.

func (*PeerIDAuthHandshakeClient) HandshakeDone

func (h *PeerIDAuthHandshakeClient) HandshakeDone() bool

func (*PeerIDAuthHandshakeClient) ParseHeader

func (h *PeerIDAuthHandshakeClient) ParseHeader(header http.Header) error

func (*PeerIDAuthHandshakeClient) PeerID

func (h *PeerIDAuthHandshakeClient) PeerID() (peer.ID, error)

PeerID returns the peer ID of the authenticated client.

func (*PeerIDAuthHandshakeClient) Run

func (*PeerIDAuthHandshakeClient) ServerAuthenticated

func (h *PeerIDAuthHandshakeClient) ServerAuthenticated() bool

func (*PeerIDAuthHandshakeClient) SetInitiateChallenge

func (h *PeerIDAuthHandshakeClient) SetInitiateChallenge()

type PeerIDAuthHandshakeServer

type PeerIDAuthHandshakeServer struct {
	Hostname string
	PrivKey  crypto.PrivKey
	TokenTTL time.Duration
	// used to authenticate opaque blobs and tokens
	Hmac hash.Hash
	// contains filtered or unexported fields
}

func (*PeerIDAuthHandshakeServer) ParseHeaderVal

func (h *PeerIDAuthHandshakeServer) ParseHeaderVal(headerVal []byte) error

func (*PeerIDAuthHandshakeServer) PeerID

func (h *PeerIDAuthHandshakeServer) PeerID() (peer.ID, error)

PeerID returns the peer ID of the authenticated client.

func (*PeerIDAuthHandshakeServer) Reset

func (h *PeerIDAuthHandshakeServer) Reset()

func (*PeerIDAuthHandshakeServer) Run

func (*PeerIDAuthHandshakeServer) SetHeader

func (h *PeerIDAuthHandshakeServer) SetHeader(hdr http.Header)

Jump to

Keyboard shortcuts

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