Update crypto.go

This commit is contained in:
Avory 2025-08-28 15:44:37 +03:00 committed by GitHub
parent e67761ef35
commit 5a76aac828
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,7 +144,12 @@ func ToECDSA(d []byte) (*ecdsa.PrivateKey, error) {
// never be used unless you are sure the input is valid and want to avoid hitting
// errors due to bad origin encoding (0 prefixes cut off).
func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey {
priv, _ := toECDSA(d, false)
priv, err := toECDSA(d, false)
if err != nil {
// In unsafe mode, we panic on error to maintain backward compatibility
// but provide better error information for debugging
panic(fmt.Sprintf("ToECDSAUnsafe failed: %v", err))
}
return priv
}