commit inicial do projeto

This commit is contained in:
Júnior
2025-05-23 10:44:32 -03:00
commit 8f04473c0b
106 changed files with 5673 additions and 0 deletions

27
internal/crypto/signer.go Normal file
View File

@ -0,0 +1,27 @@
package crypto
import "errors"
// Signer representa qualquer esquema de assinatura digital
// (ex: ECDSA, pós-quântico, etc)
type Signer interface {
GenerateKeys() (privKey string, pubKey string, err error)
Sign(message, privKey string) (string, error)
Verify(message, signature, pubKey string) bool
Name() string
}
var registered = make(map[string]Signer)
// Register um novo esquema de assinatura
func Register(signer Signer) {
registered[signer.Name()] = signer
}
// Get retorna o esquema de assinatura por nome
func Get(name string) (Signer, error) {
if s, ok := registered[name]; ok {
return s, nil
}
return nil, errors.New("assinador não encontrado")
}