code: func toECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error) {
  	priv := new(ecdsa.PrivateKey)
  	priv.PublicKey.Curve = S256()
  	if strict && 8*len(d) != priv.Params().BitSize {
  		return nil, fmt.Errorf("invalid length, need %d bits", priv.Params().BitSize)
  	}
  	priv.D = new(big.Int).SetBytes(d)
  
  	// The priv.D must < N
  	if priv.D.Cmp(secp256k1N) >= 0 {
  		return nil, fmt.Errorf("invalid private key, >=N")
  	}
  	// The priv.D must not be zero or negative.
  	if priv.D.Sign() <= 0 {
  		return nil, fmt.Errorf("invalid private key, zero or negative")
  	}
  
  	priv.PublicKey.X, priv.PublicKey.Y = priv.PublicKey.Curve.ScalarBaseMult(d)
  	if priv.PublicKey.X == nil {
  		return nil, errors.New("invalid private key")
  	}
  	return priv, nil
  }
docs: // toECDSA creates a private key with the given D value. The strict parameter
  // controls whether the key's length should be enforced at the curve size or
  // it can also accept legacy encodings (0 prefixes).