authenticity
import "github.com/bloock/bloock-sdk-go/v2/entity/authenticity"
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
- func (s Signer) ToProto() *proto.Signer
Variables
HashAlgFromProto
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(),
}
)
SignatureAlgFromProto
var (
SignatureAlgFromProto = map[string]SignatureAlg{
"ES256K": ECDSA,
"ENS": ENS,
"BJJ": BJJ,
}
)
HashAlg
type HashAlg
HashAlg represents different hash algorithms.
type HashAlg int32
Sha256 {#Sha256}Constants representing specific 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
)
Signature
type Signature
Signature represents a cryptographic signature along with additional metadata.
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
}
NewSignatureFromProto
func NewSignatureFromProto
func NewSignatureFromProto(s *proto.Signature) Signature
Signature.GetAlg
func (*Signature) GetAlg
func (s *Signature) GetAlg() SignatureAlg
GetAlg returns the SignatureAlg based on the algorithm specified in the Alg field.
Signature.ToProto
func (Signature) ToProto
func (s Signature) ToProto() *proto.Signature
SignatureAlg
type SignatureAlg
SignatureAlg represents different signature algorithms.
type SignatureAlg int32
ECDSA {#ECDSA}Constants representing specific 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
)
SignatureHeaderJws
type SignatureHeaderJws
SignatureHeaderJws represents the header of a JSON Web Signature (JWS). RFC 7515.
type SignatureHeaderJws struct {
Alg string
Kid string
}
NewSignatureHeaderJwsFromProto
func NewSignatureHeaderJwsFromProto
func NewSignatureHeaderJwsFromProto(s *proto.SignatureHeaderJWS) SignatureHeaderJws
SignatureHeaderJws.ToProto
func (SignatureHeaderJws) ToProto
func (s SignatureHeaderJws) ToProto() *proto.SignatureHeaderJWS
SignatureJws
type SignatureJws
SignatureJws represents a JSON Web Signature (JWS). RFC 7515.
type SignatureJws struct {
Signature string
Protected string
Header SignatureHeaderJws
MessageHash string
}
NewSignatureJwsFromProto
func NewSignatureJwsFromProto
func NewSignatureJwsFromProto(s *proto.SignatureJWS) SignatureJws
SignatureJws.GetAlg
func (*SignatureJws) GetAlg
func (s *SignatureJws) GetAlg() SignatureAlg
GetAlg returns the SignatureAlg based on the algorithm specified in the header.
SignatureJws.ToProto
func (SignatureJws) ToProto
func (s SignatureJws) ToProto() *proto.SignatureJWS
Signer
type Signer
Signer represents a signer with various key types and additional configurations.
type Signer struct {
LocalKey *key.LocalKey
ManagedKey *key.ManagedKey
ManagedCertificate *key.ManagedCertificate
LocalCertificate *key.LocalCertificate
HashAlg *HashAlg
AccessControl *key.AccessControl
}
NewSignerWithLocalCertificate
func NewSignerWithLocalCertificate
func NewSignerWithLocalCertificate(key key.LocalCertificate, hashAlg *HashAlg) Signer
NewSignerWithLocalCertificate creates a Signer instance with a local certificate and specified hash algorithm.
NewSignerWithLocalKey
func NewSignerWithLocalKey
func NewSignerWithLocalKey(key key.LocalKey, hashAlg *HashAlg) Signer
NewSignerWithLocalKey creates a Signer instance with a local key and specified hash algorithm.
NewSignerWithManagedCertificate
func NewSignerWithManagedCertificate
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.
NewSignerWithManagedKey
func NewSignerWithManagedKey
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.
Signer.ToProto
func (Signer) ToProto
func (s Signer) ToProto() *proto.Signer
Generated by gomarkdoc