auth

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdSecp256k1Error                  protocol.Command = "secp256k1-error"
	CmdSecp256k1Hello                  protocol.Command = "secp256k1-hello"
	CmdSecp256k1HelloChallenge         protocol.Command = "secp256k1-hello-challenge"
	CmdSecp256k1HelloChallengeAccepted protocol.Command = "secp256k1-hello-challenge-accepted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateMessage

type AuthenticateMessage struct {
	Nonce   [nonceLength]byte // random nonce
	Message string            // human readable message
}

AuthenticateMessage

func MustNewAuthenticateMessage

func MustNewAuthenticateMessage(message string) *AuthenticateMessage

func NewAuthenticateFromBytes

func NewAuthenticateFromBytes(b []byte) (*AuthenticateMessage, error)

func NewAuthenticateMessage

func NewAuthenticateMessage(message string) (*AuthenticateMessage, error)

func (*AuthenticateMessage) Hash

func (am *AuthenticateMessage) Hash() []byte

func (*AuthenticateMessage) Serialize

func (am *AuthenticateMessage) Serialize() []byte

type Secp256k1Auth

type Secp256k1Auth struct {
	// contains filtered or unexported fields
}

func NewSecp256k1AuthClient

func NewSecp256k1AuthClient(privKey *dcrsecpk256k1.PrivateKey) (*Secp256k1Auth, error)

func NewSecp256k1AuthServer

func NewSecp256k1AuthServer() (*Secp256k1Auth, error)

func (*Secp256k1Auth) Commands

func (s *Secp256k1Auth) Commands() map[protocol.Command]reflect.Type

Commands returns the protocol commands for this authenticator.

func (*Secp256k1Auth) HandshakeClient

func (s *Secp256k1Auth) HandshakeClient(ctx context.Context, conn protocol.APIConn) error

func (*Secp256k1Auth) HandshakeServer

func (s *Secp256k1Auth) HandshakeServer(ctx context.Context, conn protocol.APIConn) error

func (*Secp256k1Auth) RemotePublicKey

func (s *Secp256k1Auth) RemotePublicKey() *dcrsecpk256k1.PublicKey

func (*Secp256k1Auth) RemoteUserAgent added in v0.3.2

func (s *Secp256k1Auth) RemoteUserAgent() string

type Secp256k1Hello

type Secp256k1Hello struct {
	// UserAgent is the client user agent.
	UserAgent string `json:"userAgent,omitempty"`

	// PublicKey is the client compressed public key.
	PublicKey string `json:"publickey"`
}

Secp256k1Hello is a client->server command that sends the client Secp256k1 public key.

type Secp256k1HelloChallenge

type Secp256k1HelloChallenge struct {
	Message string `json:"message"`
}

Secp256k1HelloChallenge is a server->client command that challenges the client to sign the hash of the provided message.

type Secp256k1HelloChallengeAccepted

type Secp256k1HelloChallengeAccepted struct {
	Signature string `json:"signature"`
}

Secp256k1HelloChallengeAccepted is a client->server command containing the signature of the Secp256k1HelloChallenge.Message hash.

Jump to

Keyboard shortcuts

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