Documentation
¶
Index ¶
- Variables
- type HashAlg
- type Signature
- type SignatureAlg
- type SignatureHeaderJws
- type SignatureJws
- type Signer
- func NewSignerWithLocalCertificate(key key.LocalCertificate, hashAlg *HashAlg) Signer
- func NewSignerWithLocalKey(key key.LocalKey, hashAlg *HashAlg) Signer
- func NewSignerWithManagedCertificate(key key.ManagedCertificate, hashAlg *HashAlg, accessControl *key.AccessControl) Signer
- func NewSignerWithManagedKey(key key.ManagedKey, hashAlg *HashAlg, accessControl *key.AccessControl) Signer
Constants ¶
This section is empty.
Variables ¶
var ( HashAlgFromProto = map[proto.HashAlg]HashAlg{ proto.HashAlg_SHA_256: Sha256, proto.HashAlg_KECCAK_256: Keccak256, proto.HashAlg_POSEIDON: Poseidon, proto.HashAlg_NONE: None, } HashAlgToProto = map[HashAlg]*proto.HashAlg{ Sha256: proto.HashAlg_SHA_256.Enum(), Keccak256: proto.HashAlg_KECCAK_256.Enum(), Poseidon: proto.HashAlg_POSEIDON.Enum(), None: proto.HashAlg_NONE.Enum(), } )
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 (*Signature) GetAlg ¶
func (s *Signature) GetAlg() SignatureAlg
GetAlg returns the SignatureAlg based on the algorithm specified in the Alg field.
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
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
func (s SignatureHeaderJws) ToProto() *proto.SignatureHeaderJWS
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
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.