nodeattestortest

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerStreamBuilder

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

ServerStreamBuilder is used to build server streams for testing.

func ServerStream

func ServerStream(pluginName string) *ServerStreamBuilder

ServerStream initializes a new server stream builder for the given plugin name. Attestation data received by the stream will have its type validated against the plugin name.

func (*ServerStreamBuilder) Build

Build builds a stream with the configured handlers

func (*ServerStreamBuilder) ExpectAndBuild

func (b *ServerStreamBuilder) ExpectAndBuild(payloadOrChallengeResponse []byte) nodeattestor.ServerStream

ExpectAndBuild adds a final handler wherein the server stream expects to receive the given payload or challenge response. It returns a built server stream, since the stream does not issue another challenge at this point and will fail if invoked again.

func (*ServerStreamBuilder) ExpectThenChallenge

func (b *ServerStreamBuilder) ExpectThenChallenge(payloadOrChallengeResponse, challenge []byte) *ServerStreamBuilder

ExpectThenChallenge adds an intermediate handler that asserts that the given payload or challenge response is received and then issues the given challenge. It returns a new builder with that handler added.

func (*ServerStreamBuilder) FailAndBuild

func (b *ServerStreamBuilder) FailAndBuild(err error) nodeattestor.ServerStream

FailAndBuild adds a final handler wherein the server stream fails with the given error. It returns a built server stream, since the stream does not issue another challenge at this point and will fail if invoked again.

func (*ServerStreamBuilder) Handle

Handle adds an arbitrary handler. If the handler returns a challenge then it is expected that the stream will be called again.

func (*ServerStreamBuilder) IgnoreThenChallenge

func (b *ServerStreamBuilder) IgnoreThenChallenge(challenge []byte) *ServerStreamBuilder

IgnoreThenChallenge adds an intermediate handler that ignores the payload or challenge response and then issues the given challenge. It returns a new builder with that handler added.

type ServerStreamHandler

type ServerStreamHandler = func(payloadOrChallengeResponse []byte) (challenge []byte, err error)

ServerStreamHandler is a function used to handle payloads or challenge responses sent to the stream.

Jump to

Keyboard shortcuts

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