sig

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package sig provides interfaces for signature.

Index

Constants

This section is empty.

Variables

View Source
var ErrHashUnavailable = errors.New("sig: hash is unavailable")

ErrSignatureMismatch is an error for unavailable hash.

View Source
var ErrSignUnavailable = errors.New("sig: sign method is unavailable")

ErrSignUnavailable means sign method is not unavailable.

View Source
var ErrSignatureMismatch = errors.New("sig: signature mismatch")

ErrSignatureMismatch is signature mismatch error.

Functions

This section is empty.

Types

type Algorithm

type Algorithm interface {
	// NewSigningKey returns a new key for signing.
	NewSigningKey(key Key) SigningKey
}

Algorithm is an algorithm for signing.

type Key

type Key interface {
	PrivateKey() crypto.PrivateKey
	PublicKey() crypto.PublicKey
}

type SigningKey

type SigningKey interface {
	Sign(payload []byte) (signature []byte, err error)
	Verify(payload, signature []byte) error
}

SigningKey is a key for signing.

func NewErrorKey

func NewErrorKey(err error) SigningKey

NewInvalidKey returns a new key that returns an error for all Sign and Verify operations.

func NewInvalidKey

func NewInvalidKey(alg string, privateKey, publicKey any) SigningKey

NewInvalidKey returns a new key that returns an error for all Sign and Verify operations.

Jump to

Keyboard shortcuts

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