code: func checkAlgorithm(key *jose.JSONWebKey, parsedJWS *jose.JSONWebSignature) error {
  	algorithm, err := sigAlgorithmForKey(key.Key)
  	if err != nil {
  		return err
  	}
  	jwsAlgorithm := parsedJWS.Signatures[0].Header.Algorithm
  	if jwsAlgorithm != string(algorithm) {
  		return 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 != string(algorithm) {
  		return 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.