func NewECDSAPublicKey(
	algorithm Algorithm,
	publicKey ecdsa.PublicKey,
) (*ECDSAPublicKey, error) {
	var verify ecdsaVerifyFunc
	switch algorithm {
	case AlgorithmES256:
		verify = getECDSAVerifyFunc(crypto.SHA256)
	case AlgorithmES384:
		verify = getECDSAVerifyFunc(crypto.SHA384)
	case AlgorithmES512:
		verify = getECDSAVerifyFunc(crypto.SHA512)
	default:
		return nil, fmt.Errorf("%w: %v", ErrUnsupportedAlgorithm, algorithm)
	}

	return &ECDSAPublicKey{
		algorithm: algorithm,
		key:       publicKey,
		verify:    verify,
	}, nil
}
// NewECDSAPublicKey creates a new ECDSAPublicKey from an existing key.
NewECDSAPublicKey creates a new ECDSAPublicKey from an existing key.
// NewECDSAPublicKey creates a new ECDSAPublicKey from an existing key .
func NewECDSAPublicKey(
	algorithm Algorithm,
	publicKey ecdsa.PublicKey,
) (*ECDSAPublicKey, error) {
	var verify ecdsaVerifyFunc
	switch algorithm {
	case AlgorithmES256:
		verify = getECDSAVerifyFunc(crypto.SHA256)
	case AlgorithmES384:
		verify = getECDSAVerifyFunc(crypto.SHA384)
	case AlgorithmES512:
		verify = getECDSAVerifyFunc(crypto.SHA512)
	default:
		return nil, fmt.Errorf("%w: %v", ErrUnsupportedAlgorithm, algorithm)
	}
	return &ECDSAPublicKey{
		algorithm: algorithm,
		key:       publicKey,
		verify:    verify,
	}, nil
}
func NewECDSAPublicKey ( algorithm Algorithm , publicKey ecdsa . PublicKey , ) ( * ECDSAPublicKey , error ) { var verify ecdsaVerifyFunc switch algorithm { case AlgorithmES256 : verify = getECDSAVerifyFunc ( crypto . SHA256 ) case AlgorithmES384 : verify = getECDSAVerifyFunc ( crypto . SHA384 ) case AlgorithmES512 : verify = getECDSAVerifyFunc ( crypto . SHA512 ) default : return nil , fmt . Errorf ( " " , ErrUnsupportedAlgorithm , algorithm ) } return & ECDSAPublicKey { algorithm : algorithm , key : publicKey , verify : verify , } , nil }
NewECDSAPublicKey creates a new ECDSAPublicKey from an existing key.
NewECDSAPublicKey creates a new ECDSAPublicKey from an existing key .