challenge

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

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

Challenge encapsulates the logic to generate challenge data and to verify a challenge response.

func NewChallenge

func NewChallenge(key ssh.PublicKey) (*Challenge, error)

NewChallenge returns a new challenge.

func (*Challenge) ChallengeRequest

func (c *Challenge) ChallengeRequest() ([]byte, error)

ChallengeRequest requests the serialized data of the challenge data.

func (*Challenge) VerifyResponse

func (c *Challenge) VerifyResponse(resp string) error

VerifyResponse returns nil if the public key of the challenge can verify the response data.

type Data

type Data struct {
	// Data is the random data for the private key to sign.
	Data []byte
	// Signature is the signature of random data that signed by the private key.
	Signature ssh.Signature
}

Data defines format to be used for ssh challenge-response.

func NewData

func NewData() (*Data, error)

NewData creates a Data.

func (*Data) Marshal

func (c *Data) Marshal() ([]byte, error)

Marshal returns the base64 encoded JSON for Data.

func (*Data) Unmarshal

func (c *Data) Unmarshal(data []byte) error

Unmarshal parses the base64 encoded JSON data and stores the result in the challenge data.

Jump to

Keyboard shortcuts

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