def verify!(req)
      verifiable_req = @adapter.call(req)
      signature_parameters = get_signature_parameters(verifiable_req)

      key = get_key(signature_parameters.key_id)
      alg = get_algorithm(signature_parameters.algorithm)
      string_for_signing = RequestSigning.make_string_for_signing(signature_parameters.headers, verifiable_req)
      signature = decode_signature(signature_parameters.signature)
      unless alg.verify_signature(key, signature, string_for_signing)
        raise SignatureMismatch, key_id: signature_parameters.key_id
      end
    end
def verify!(req)
      verifiable_req = @adapter.call(req)
      signature_parameters = get_signature_parameters(verifiable_req)

      key = get_key(signature_parameters.key_id)
      alg = get_algorithm(signature_parameters.algorithm)
      string_for_signing = RequestSigning.make_string_for_signing(signature_parameters.headers, verifiable_req)
      signature = decode_signature(signature_parameters.signature)
      unless alg.verify_signature(key, signature, string_for_signing)
        raise SignatureMismatch, key_id: signature_parameters.key_id
      end
    end
@param adapter [Symbol] name of the library adapter.
 @param key_store [#fetch, #key?] signature verification key store

 @raise [RequestSigning::UnsupportedAdapter] when the adapter is not registered

 @see RequestSigning::Adapters
 @see RequestSigning::KeyStores::Static


 Verifies request signature

 @param req - an http request object from the library specified via :adapter

 @raise [RequestSigning::SignatureMismatch] when the signature is invalid
 @raise [RequestSigning::KeyNotFound] when the key store does not contain the key
   referenced in the request
 @raise [RequestSigning::BadSignatureParameters] when the signature is malformed
 @raise [RequestSigning::UnsupportedAlgorithm] when the algorithm referenced
   in the request is not supported
 @raise [RequestSigning::InvalidKey] when the key in key store can not be used
   to verify the signature
 @raise [RequestSigning::HeaderNotInRequest] when one of the headers specified
   in `headers` signature component is not present in the request
 @raise [RequestSigning::MissingSignatureHeader] when neither `Signature` nor
   `Authorization` headers are present
 @raise [RequestSigning::UnsupportedAuthorizationScheme] when the scheme
   specified in the `Authorization` header is not `Signature` and the `Signature`
   header is absent