code: public static String encode(JSONObject claims, String secret) {
          String encodedHeader = getCommonHeader();
          String encodedClaims = encodeJson(claims);
  
          String secureBits = new StringBuilder(encodedHeader).append(TOKEN_SEP).append(encodedClaims).toString();
  
          String sig = sign(secret, secureBits);
  
          return new StringBuilder(secureBits).append(TOKEN_SEP).append(sig).toString();
      }
docs: Encode and sign a set of claims.
  
  @param claims
  @param secret
  @return