commit inicial do projeto
This commit is contained in:
27
internal/config/config.go
Normal file
27
internal/config/config.go
Normal file
@ -0,0 +1,27 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
GlobalPrivateKey *ecdsa.PrivateKey
|
||||
GlobalPublicKey *ecdsa.PublicKey
|
||||
once sync.Once
|
||||
)
|
||||
|
||||
// SetGlobalKeys configura a chave privada e pública globais, se ainda não estiverem definidas.
|
||||
func SetGlobalKeys(priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey) {
|
||||
once.Do(func() {
|
||||
GlobalPrivateKey = priv
|
||||
GlobalPublicKey = pub
|
||||
})
|
||||
}
|
||||
|
||||
// ResetGlobalKeys limpa as chaves globais (usado em testes)
|
||||
func ResetGlobalKeys() {
|
||||
GlobalPrivateKey = nil
|
||||
GlobalPublicKey = nil
|
||||
once = sync.Once{}
|
||||
}
|
||||
Reference in New Issue
Block a user