class JwtHmac implements JwtMac {

  @Override
  public Jwt verifyCompact(String compact, JwtValidator validator) throws GeneralSecurityException {
    String[] parts = compact.split("\\.", -1);
    if (parts.length != 3) {
      throw new JwtInvalidException(
          "only tokens in JWS compact serialization format are supported");
    }

    String input = parts[0] + "." + parts[1];
    byte[] expectedTag = Base64.urlSafeDecode(parts[2]);
    mac.verifyMac(expectedTag, input.getBytes(ASCII));

    ToBeSignedJwt token = new ToBeSignedJwt.Builder(input).build();
    return validator.validate(this.algo, token);
  }

  public  JwtHmac(String algo, java.security.Key key);

}