code: func ExtractCertificateFromContext(ctx context.Context) *x509.Certificate {
  	pr, extracted := peer.FromContext(ctx)
  	if !extracted {
  		return nil
  	}
  
  	authInfo := pr.AuthInfo
  	if authInfo == nil {
  		return nil
  	}
  
  	tlsInfo, isTLSConn := authInfo.(credentials.TLSInfo)
  	if !isTLSConn {
  		return nil
  	}
  	certs := tlsInfo.State.PeerCertificates
  	if len(certs) == 0 {
  		return nil
  	}
  	return certs[0]
  }
docs: // ExtractCertificateFromContext returns the TLS certificate (if applicable)
  // from the given context of a gRPC stream