plugin

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Overview

Package plugin provides the toolings to use the notation plugin.

includes a CLIManager and a CLIPlugin implementation.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotCompliant = errors.New("plugin not compliant")

ErrNotCompliant is returned by plugin methods when the response is not compliant.

View Source
var ErrNotRegularFile = errors.New("not regular file")

ErrNotRegularFile is returned when the plugin file is not an regular file.

Functions

This section is empty.

Types

type CLIManager

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

CLIManager implements Manager

func NewCLIManager

func NewCLIManager(pluginFS dir.SysFS) *CLIManager

NewCLIManager returns CLIManager for named pluginFS.

func (*CLIManager) Get

func (m *CLIManager) Get(ctx context.Context, name string) (Plugin, error)

Get returns a plugin on the system by its name.

If the plugin is not found, the error is of type os.ErrNotExist.

func (*CLIManager) List

func (m *CLIManager) List(ctx context.Context) ([]string, error)

List produces a list of the plugin names on the system.

type CLIPlugin

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

CLIPlugin implements Plugin interface to CLI plugins.

func NewCLIPlugin

func NewCLIPlugin(ctx context.Context, name, path string) (*CLIPlugin, error)

NewCLIPlugin validate the metadata of the plugin and return a *CLIPlugin.

func (*CLIPlugin) DescribeKey

DescribeKey returns the KeySpec of a key.

if ContractVersion is not set, it will be set by the function.

func (*CLIPlugin) GenerateEnvelope

GenerateEnvelope generates the Envelope with signature based on the request.

if ContractVersion is not set, it will be set by the function.

func (*CLIPlugin) GenerateSignature

GenerateSignature generates the raw signature based on the request.

if ContractVersion is not set, it will be set by the function.

func (*CLIPlugin) GetMetadata

GetMetadata returns the metadata information of the plugin.

func (*CLIPlugin) VerifySignature

VerifySignature validates the signature based on the request.

if ContractVersion is not set, it will be set by the function.

type GenericPlugin

type GenericPlugin interface {
	// GetMetadata returns the metadata information of the plugin.
	GetMetadata(ctx context.Context, req *proto.GetMetadataRequest) (*proto.GetMetadataResponse, error)
}

GenericPlugin is the base requirement to be an plugin.

type Manager

type Manager interface {
	Get(ctx context.Context, name string) (Plugin, error)
	List(ctx context.Context) ([]string, error)
}

Manager manages plugins installed on the system.

type Plugin

type Plugin interface {
	SignPlugin
	VerifyPlugin
}

Plugin defines required methods to be an Plugin.

type SignPlugin

type SignPlugin interface {
	GenericPlugin

	// DescribeKey returns the KeySpec of a key.
	DescribeKey(ctx context.Context, req *proto.DescribeKeyRequest) (*proto.DescribeKeyResponse, error)

	// GenerateSignature generates the raw signature based on the request.
	GenerateSignature(ctx context.Context, req *proto.GenerateSignatureRequest) (*proto.GenerateSignatureResponse, error)

	// GenerateEnvelope generates the Envelope with signature based on the
	// request.
	GenerateEnvelope(ctx context.Context, req *proto.GenerateEnvelopeRequest) (*proto.GenerateEnvelopeResponse, error)
}

SignPlugin defines the required methods to be a SignPlugin.

type VerifyPlugin

type VerifyPlugin interface {
	GenericPlugin

	// VerifySignature validates the signature based on the request.
	VerifySignature(ctx context.Context, req *proto.VerifySignatureRequest) (*proto.VerifySignatureResponse, error)
}

VerifyPlugin defines the required method to be a VerifyPlugin.

Directories

Path Synopsis
Package proto defines the protocol layer for communication between notation and notation external plugin.
Package proto defines the protocol layer for communication between notation and notation external plugin.

Jump to

Keyboard shortcuts

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