authenticity

package
v2.8.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SignatureAlgFromProto = map[string]SignatureAlg{
		"ES256K": ECDSA,
		"ENS":    ENS,
		"BJJ":    BJJ,
	}
)

Functions

This section is empty.

Types

type HashAlg added in v2.7.0

type HashAlg int32

HashAlg represents different hash algorithms.

const (
	// Sha256 represents the SHA-256 hash algorithm.
	Sha256 HashAlg = iota
	// Keccak256 represents the Keccak-256 hash algorithm.
	Keccak256 HashAlg = iota
	// Poseidon represents the Poseidon hash algorithm.
	Poseidon HashAlg = iota
	// None represents no hash algorithm.
	None HashAlg = iota
	// Unrecognized represents an unrecognized hash algorithm.
	Unrecognized HashAlg = -1
)

Constants representing specific hash algorithms.

type Signature

type Signature struct {
	// Signature is the cryptographic signature.
	Signature string
	// Alg is the algorithm used for the signature.
	Alg string
	// Kid is the key identifier associated with the signature. (public key or key ID).
	Kid string
	// MessageHash is the hash of the message that was signed.
	MessageHash string
	// Subject is an optional field representing the subject of the signature.
	Subject *string
}

Signature represents a cryptographic signature along with additional metadata.

func NewSignatureFromProto

func NewSignatureFromProto(s *proto.Signature) Signature

func (*Signature) GetAlg

func (s *Signature) GetAlg() SignatureAlg

GetAlg returns the SignatureAlg based on the algorithm specified in the Alg field.

func (Signature) ToProto

func (s Signature) ToProto() *proto.Signature

type SignatureAlg

type SignatureAlg int32

SignatureAlg represents different signature algorithms.

const (
	// ECDSA represents the ECDSA signature algorithm with the "ES256K" name.
	ECDSA SignatureAlg = iota
	// ENS represents the ENS (Ethereum Name Service) signature algorithm.
	ENS SignatureAlg = iota
	// BJJ represents the BJJ signature algorithm with the "BJJ" name.
	BJJ SignatureAlg = iota
	// UNRECOGNIZED_SIGNATURE_ALG represents an unrecognized signature algorithm.
	UNRECOGNIZED_SIGNATURE_ALG SignatureAlg = -1
)

Constants representing specific signature algorithms.

type SignatureHeaderJws added in v2.7.0

type SignatureHeaderJws struct {
	Alg string
	Kid string
}

SignatureHeaderJws represents the header of a JSON Web Signature (JWS). RFC 7515.

func NewSignatureHeaderJwsFromProto added in v2.7.0

func NewSignatureHeaderJwsFromProto(s *proto.SignatureHeaderJWS) SignatureHeaderJws

func (SignatureHeaderJws) ToProto added in v2.7.0

type SignatureJws added in v2.7.0

type SignatureJws struct {
	Signature   string
	Protected   string
	Header      SignatureHeaderJws
	MessageHash string
}

SignatureJws represents a JSON Web Signature (JWS). RFC 7515.

func NewSignatureJwsFromProto added in v2.7.0

func NewSignatureJwsFromProto(s *proto.SignatureJWS) SignatureJws

func (*SignatureJws) GetAlg added in v2.7.0

func (s *SignatureJws) GetAlg() SignatureAlg

GetAlg returns the SignatureAlg based on the algorithm specified in the header.

func (SignatureJws) ToProto added in v2.7.0

func (s SignatureJws) ToProto() *proto.SignatureJWS

type Signer

type Signer struct {
	LocalKey           *key.LocalKey
	ManagedKey         *key.ManagedKey
	ManagedCertificate *key.ManagedCertificate
	LocalCertificate   *key.LocalCertificate
	HashAlg            *HashAlg
	AccessControl      *key.AccessControl
}

Signer represents a signer with various key types and additional configurations.

func NewSignerWithLocalCertificate added in v2.7.0

func NewSignerWithLocalCertificate(key key.LocalCertificate, hashAlg *HashAlg) Signer

NewSignerWithLocalCertificate creates a Signer instance with a local certificate and specified hash algorithm.

func NewSignerWithLocalKey added in v2.7.0

func NewSignerWithLocalKey(key key.LocalKey, hashAlg *HashAlg) Signer

NewSignerWithLocalKey creates a Signer instance with a local key and specified hash algorithm.

func NewSignerWithManagedCertificate added in v2.7.0

func NewSignerWithManagedCertificate(key key.ManagedCertificate, hashAlg *HashAlg, accessControl *key.AccessControl) Signer

NewSignerWithManagedCertificate creates a Signer instance with a managed certificate, specified hash algorithm, and access control configuration.

func NewSignerWithManagedKey added in v2.7.0

func NewSignerWithManagedKey(key key.ManagedKey, hashAlg *HashAlg, accessControl *key.AccessControl) Signer

NewSignerWithManagedKey creates a Signer instance with a managed key, specified hash algorithm, and access control configuration.

func (Signer) ToProto

func (s Signer) ToProto() *proto.Signer

Jump to

Keyboard shortcuts

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