code: func checkAlgorithm(key *jose.JSONWebKey, parsedJws *jose.JSONWebSignature) (string, error) {
  	algorithm, err := algorithmForKey(key)
  	if err != nil {
  		return noAlgorithmForKey, err
  	}
  	jwsAlgorithm := parsedJws.Signatures[0].Header.Algorithm
  	if jwsAlgorithm != algorithm {
  		return invalidJWSAlgorithm, fmt.Errorf(
  			"signature type '%s' in JWS header is not supported, expected one of RS256, ES256, ES384 or ES512",
  			jwsAlgorithm,
  		)
  	}
  	if key.Algorithm != "" && key.Algorithm != algorithm {
  		return invalidAlgorithmOnKey, fmt.Errorf("algorithm '%s' on JWK is unacceptable",
  			key.Algorithm)
  	}
  	return "", nil
  }
docs: // Check that (1) there is a suitable algorithm for the provided key based on its
  // Golang type, (2) the Algorithm field on the JWK is either absent, or matches
  // that algorithm, and (3) the Algorithm field on the JWK is present and matches
  // that algorithm. Precondition: parsedJws must have exactly one signature on
  // it. Returns stat name to increment if err is non-nil.