keys

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 7 Imported by: 114

Documentation

Overview

Package keys provides access to public and private keys for signing and verification of signatures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSigner

func NewSigner(ctx context.Context, keyProto proto.Message) (crypto.Signer, error)

NewSigner uses a registered ProtoHandler (see RegisterHandler()) to convert a protobuf message into a crypto.Signer. If there is no ProtoHandler registered for this type of protobuf message, an error will be returned.

func RegisterHandler

func RegisterHandler(keyProto proto.Message, handler ProtoHandler)

RegisterHandler enables transformation of protobuf messages of the same type as keyProto into crypto.Signer by invoking the provided handler. The keyProto need only be an empty example of the type of protobuf message that the handler can process - only its type is examined. If a handler for this type of protobuf message has already been added, it will be replaced.

Types

type ProtoHandler

type ProtoHandler func(context.Context, proto.Message) (crypto.Signer, error)

ProtoHandler uses the information in a protobuf message to obtain a crypto.Signer. For example, the protobuf message may contain a key or identify where a key can be found.

Directories

Path Synopsis
Package testonly contains code and data that should only be used by tests.
Package testonly contains code and data that should only be used by tests.

Jump to

Keyboard shortcuts

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