passport

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyProvider

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

func NewFileKeyProvider

func NewFileKeyProvider(ctx context.Context, path string) (*KeyProvider, error)

NewFileKeyProvider reads keys from a given filesystem path

func NewKeyProvider

func NewKeyProvider(ctx context.Context) (*KeyProvider, error)

NewKeyProvider creates keys and holds them in-memory

func (*KeyProvider) GetPublicKey

func (kp *KeyProvider) GetPublicKey() *ed25519.PublicKey

GetPublicKey returns the stored public key

func (*KeyProvider) GetPublicKeyHash added in v0.1.6

func (kp *KeyProvider) GetPublicKeyHash() string

GetPublicKeyHash returns the hash value of the stored public key

func (*KeyProvider) Sign

func (kp *KeyProvider) Sign(message []byte) ([]byte, error)

Sign signs the given message with priv. Ed25519 performs two passes over messages to be signed and therefore cannot handle pre-hashed messages. Thus opts.HashFunc() must return zero to indicate the message hasn't been hashed. This can be achieved by passing crypto.Hash(0) as the value for opts.

func (*KeyProvider) ToString

func (kp *KeyProvider) ToString() (string, error)

ToString returns the stored public key as a string

Jump to

Keyboard shortcuts

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